1 19 20 package org.netbeans.modules.tasklist.javadoc; 21 22 import java.awt.*; 23 import javax.swing.*; 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) { 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 Dimension d = jScrollPane1.getPreferredSize(); 64 int width = (int)d.getWidth(); 65 int height = (int)d.getHeight(); 66 if ((width > 400) || (height > 200)) { 67 if (width > 400) { 68 width = 400; 69 } 70 if (height > 200) { 71 height = 200; 72 } 73 jScrollPane1.setPreferredSize(new Dimension(width, height)); 74 } 75 d = jScrollPane2.getPreferredSize(); 76 width = (int)d.getWidth(); 77 height = (int)d.getHeight(); 78 if ((width > 400) || (height > 200)) { 79 if (width > 400) { 80 width = 400; 81 } 82 if (height > 200) { 83 height = 200; 84 } 85 jScrollPane2.setPreferredSize(new Dimension(width, height)); 86 } 87 } 88 89 94 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 96 97 mainLabel = new javax.swing.JLabel (); 98 jScrollPane1 = new javax.swing.JScrollPane (); 99 beforeLabel = new javax.swing.JLabel (); 100 changedToLabel = new javax.swing.JLabel (); 101 jScrollPane2 = new javax.swing.JScrollPane (); 102 afterLabel = new javax.swing.JLabel (); 103 jLabel3 = new javax.swing.JLabel (); 104 fileLabel = new javax.swing.JLabel (); 105 jLabel5 = new javax.swing.JLabel (); 106 lineLabel = new javax.swing.JLabel (); 107 108 setLayout(new java.awt.GridBagLayout ()); 109 110 setPreferredSize(new java.awt.Dimension (600, 400)); 111 gridBagConstraints = new java.awt.GridBagConstraints (); 112 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 113 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 114 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 115 add(mainLabel, gridBagConstraints); 116 117 beforeLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); 118 beforeLabel.setBackground((java.awt.Color ) javax.swing.UIManager.getDefaults().get("TextField.background")); 119 beforeLabel.setOpaque(true); 120 jScrollPane1.setViewportView(beforeLabel); 121 122 gridBagConstraints = new java.awt.GridBagConstraints (); 123 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 124 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 125 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 126 gridBagConstraints.weightx = 1.0; 127 gridBagConstraints.weighty = 1.0; 128 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 129 add(jScrollPane1, gridBagConstraints); 130 131 gridBagConstraints = new java.awt.GridBagConstraints (); 132 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 133 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 134 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 135 add(changedToLabel, gridBagConstraints); 136 137 afterLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); 138 afterLabel.setBackground((java.awt.Color ) javax.swing.UIManager.getDefaults().get("TextField.background")); 139 afterLabel.setOpaque(true); 140 jScrollPane2.setViewportView(afterLabel); 141 142 gridBagConstraints = new java.awt.GridBagConstraints (); 143 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 144 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 145 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 146 gridBagConstraints.weightx = 1.0; 147 gridBagConstraints.weighty = 1.0; 148 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 11); 149 add(jScrollPane2, gridBagConstraints); 150 151 jLabel3.setText(NbBundle.getMessage(ConfPanel.class, "File")); gridBagConstraints = new java.awt.GridBagConstraints (); 153 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 154 gridBagConstraints.insets = new java.awt.Insets (18, 12, 0, 11); 155 add(jLabel3, gridBagConstraints); 156 157 gridBagConstraints = new java.awt.GridBagConstraints (); 158 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 159 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 160 gridBagConstraints.insets = new java.awt.Insets (18, 0, 0, 11); 161 add(fileLabel, gridBagConstraints); 162 163 jLabel5.setText(NbBundle.getMessage(ConfPanel.class, "Line")); gridBagConstraints = new java.awt.GridBagConstraints (); 165 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 166 gridBagConstraints.insets = new java.awt.Insets (0, 12, 0, 11); 167 add(jLabel5, gridBagConstraints); 168 169 gridBagConstraints = new java.awt.GridBagConstraints (); 170 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 171 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 172 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 11); 173 add(lineLabel, gridBagConstraints); 174 175 } 177 178 private javax.swing.JLabel mainLabel; 180 private javax.swing.JLabel fileLabel; 181 private javax.swing.JLabel changedToLabel; 182 private javax.swing.JLabel beforeLabel; 183 private javax.swing.JLabel afterLabel; 184 private javax.swing.JLabel jLabel5; 185 private javax.swing.JLabel jLabel3; 186 private javax.swing.JScrollPane jScrollPane2; 187 private javax.swing.JScrollPane jScrollPane1; 188 private javax.swing.JLabel lineLabel; 189 191 } 192 | Popular Tags |