1 19 20 package org.netbeans.modules.tasklist.core; 21 22 import java.awt.BorderLayout ; 23 import javax.swing.JPanel ; 24 import org.openide.util.NbBundle; 25 26 import javax.swing.text.*; 27 28 29 34 public class ConfPanel extends javax.swing.JPanel { 35 36 private static final long serialVersionUID = 1; 37 38 39 public ConfPanel(String beforeDesc, String beforeContents, 40 String afterDesc, String afterContents, 41 String filename, int line, JPanel bottomPanel) { 42 initComponents(); 43 44 mainLabel.setText(beforeDesc); 45 beforeLabel.setText(beforeContents); 46 if (afterDesc != null) { 47 changedToLabel.setText(afterDesc); 48 } else { 49 changedToLabel.setVisible(false); 50 } 51 if (afterContents != null) { 52 afterLabel.setText(afterContents); 53 } else { 54 afterLabel.setVisible(false); 55 } 56 fileLabel.setText(filename); 57 if (line >= 0) { 58 lineLabel.setText(Integer.toString(line)); 59 } else { 60 lineLabel.setVisible(false); 61 jLabel5.setVisible(false); 62 } 63 if (bottomPanel != null) { 64 addPanel.setLayout(new BorderLayout ()); 65 addPanel.add(bottomPanel, BorderLayout.CENTER); 66 } else { 67 addPanel.setVisible(false); 68 } 69 } 70 71 76 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 78 79 mainLabel = new javax.swing.JLabel (); 80 beforeLabel = new javax.swing.JLabel (); 81 changedToLabel = new javax.swing.JLabel (); 82 afterLabel = new javax.swing.JLabel (); 83 jLabel3 = new javax.swing.JLabel (); 84 fileLabel = new javax.swing.JLabel (); 85 jLabel5 = new javax.swing.JLabel (); 86 lineLabel = new javax.swing.JLabel (); 87 addPanel = new javax.swing.JPanel (); 88 89 setLayout(new java.awt.GridBagLayout ()); 90 91 gridBagConstraints = new java.awt.GridBagConstraints (); 92 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 93 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 94 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 95 add(mainLabel, gridBagConstraints); 96 97 beforeLabel.setBackground((java.awt.Color ) javax.swing.UIManager.getDefaults().get("TextField.background")); 98 beforeLabel.setOpaque(true); 99 gridBagConstraints = new java.awt.GridBagConstraints (); 100 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 101 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 102 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 103 gridBagConstraints.weightx = 1.0; 104 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 105 add(beforeLabel, gridBagConstraints); 106 107 gridBagConstraints = new java.awt.GridBagConstraints (); 108 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 109 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 110 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 111 add(changedToLabel, gridBagConstraints); 112 113 afterLabel.setBackground((java.awt.Color ) javax.swing.UIManager.getDefaults().get("TextField.background")); 114 afterLabel.setOpaque(true); 115 gridBagConstraints = new java.awt.GridBagConstraints (); 116 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 117 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 118 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 119 gridBagConstraints.weightx = 1.0; 120 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 121 add(afterLabel, gridBagConstraints); 122 123 jLabel3.setText(NbBundle.getMessage(ConfPanel.class, "File")); gridBagConstraints = new java.awt.GridBagConstraints (); 125 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 126 gridBagConstraints.insets = new java.awt.Insets (18, 12, 0, 11); 127 add(jLabel3, gridBagConstraints); 128 129 fileLabel.setText("Test1"); 130 gridBagConstraints = new java.awt.GridBagConstraints (); 131 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 132 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 133 gridBagConstraints.insets = new java.awt.Insets (18, 0, 0, 11); 134 add(fileLabel, gridBagConstraints); 135 136 jLabel5.setText(NbBundle.getMessage(ConfPanel.class, "Line")); gridBagConstraints = new java.awt.GridBagConstraints (); 138 gridBagConstraints.insets = new java.awt.Insets (0, 12, 0, 11); 139 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 140 add(jLabel5, gridBagConstraints); 141 142 lineLabel.setText("Test2"); 143 gridBagConstraints = new java.awt.GridBagConstraints (); 144 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 145 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 11); 146 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 147 add(lineLabel, gridBagConstraints); 148 149 gridBagConstraints = new java.awt.GridBagConstraints (); 150 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 151 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 152 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 153 gridBagConstraints.weightx = 1.0; 154 gridBagConstraints.weighty = 1.0; 155 gridBagConstraints.insets = new java.awt.Insets (12, 12, 11, 11); 156 add(addPanel, gridBagConstraints); 157 158 } 160 161 private javax.swing.JLabel mainLabel; 163 private javax.swing.JPanel addPanel; 164 private javax.swing.JLabel fileLabel; 165 private javax.swing.JLabel changedToLabel; 166 private javax.swing.JLabel beforeLabel; 167 private javax.swing.JLabel afterLabel; 168 private javax.swing.JLabel jLabel5; 169 private javax.swing.JLabel jLabel3; 170 private javax.swing.JLabel lineLabel; 171 173 } 174 | Popular Tags |