KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > core > ConfPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.tasklist.core;
21
22 import java.awt.BorderLayout JavaDoc;
23 import javax.swing.JPanel JavaDoc;
24 import org.openide.util.NbBundle;
25
26 import javax.swing.text.*;
27
28
29 /**
30  * A confirmation panel for suggestion fixes etc.
31  *
32  * @author Tor Norbye
33  */

34 public class ConfPanel extends javax.swing.JPanel JavaDoc {
35
36     private static final long serialVersionUID = 1;
37
38     /** Creates new form ConfPanel */
39     public ConfPanel(String JavaDoc beforeDesc, String JavaDoc beforeContents,
40                      String JavaDoc afterDesc, String JavaDoc afterContents,
41                      String JavaDoc filename, int line, JPanel JavaDoc 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 JavaDoc());
65             addPanel.add(bottomPanel, BorderLayout.CENTER);
66         } else {
67             addPanel.setVisible(false);
68         }
69     }
70     
71     /** This method is called from within the constructor to
72      * initialize the form.
73      * WARNING: Do NOT modify this code. The content of this method is
74      * always regenerated by the Form Editor.
75      */

76     private void initComponents() {//GEN-BEGIN:initComponents
77
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
78
79         mainLabel = new javax.swing.JLabel JavaDoc();
80         beforeLabel = new javax.swing.JLabel JavaDoc();
81         changedToLabel = new javax.swing.JLabel JavaDoc();
82         afterLabel = new javax.swing.JLabel JavaDoc();
83         jLabel3 = new javax.swing.JLabel JavaDoc();
84         fileLabel = new javax.swing.JLabel JavaDoc();
85         jLabel5 = new javax.swing.JLabel JavaDoc();
86         lineLabel = new javax.swing.JLabel JavaDoc();
87         addPanel = new javax.swing.JPanel JavaDoc();
88
89         setLayout(new java.awt.GridBagLayout JavaDoc());
90
91         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
92         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
93         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
94         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 11);
95         add(mainLabel, gridBagConstraints);
96
97         beforeLabel.setBackground((java.awt.Color JavaDoc) javax.swing.UIManager.getDefaults().get("TextField.background"));
98         beforeLabel.setOpaque(true);
99         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(12, 12, 0, 11);
105         add(beforeLabel, gridBagConstraints);
106
107         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
108         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
109         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
110         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 11);
111         add(changedToLabel, gridBagConstraints);
112
113         afterLabel.setBackground((java.awt.Color JavaDoc) javax.swing.UIManager.getDefaults().get("TextField.background"));
114         afterLabel.setOpaque(true);
115         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(12, 12, 0, 11);
121         add(afterLabel, gridBagConstraints);
122
123         jLabel3.setText(NbBundle.getMessage(ConfPanel.class, "File")); // NOI18N();
124
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
125         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
126         gridBagConstraints.insets = new java.awt.Insets JavaDoc(18, 12, 0, 11);
127         add(jLabel3, gridBagConstraints);
128
129         fileLabel.setText("Test1");
130         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
131         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
132         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
133         gridBagConstraints.insets = new java.awt.Insets JavaDoc(18, 0, 0, 11);
134         add(fileLabel, gridBagConstraints);
135
136         jLabel5.setText(NbBundle.getMessage(ConfPanel.class, "Line")); // NOI18N();
137
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
138         gridBagConstraints.insets = new java.awt.Insets JavaDoc(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 JavaDoc();
144         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
145         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 11);
146         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
147         add(lineLabel, gridBagConstraints);
148
149         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(12, 12, 11, 11);
156         add(addPanel, gridBagConstraints);
157
158     }//GEN-END:initComponents
159

160     
161     // Variables declaration - do not modify//GEN-BEGIN:variables
162
private javax.swing.JLabel JavaDoc mainLabel;
163     private javax.swing.JPanel JavaDoc addPanel;
164     private javax.swing.JLabel JavaDoc fileLabel;
165     private javax.swing.JLabel JavaDoc changedToLabel;
166     private javax.swing.JLabel JavaDoc beforeLabel;
167     private javax.swing.JLabel JavaDoc afterLabel;
168     private javax.swing.JLabel JavaDoc jLabel5;
169     private javax.swing.JLabel JavaDoc jLabel3;
170     private javax.swing.JLabel JavaDoc lineLabel;
171     // End of variables declaration//GEN-END:variables
172

173 }
174
Popular Tags