KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > subversion > client > CommandReport


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.subversion.client;
21
22 import java.util.*;
23 import javax.swing.JComponent JavaDoc;
24 import javax.swing.JLabel JavaDoc;
25 import javax.swing.JTextArea JavaDoc;
26
27 /**
28  * Small notification dialog similar to ErrorManager's one. The main purpose is to show (possibly long) list
29  * of warning and error messages.
30  *
31  * @author Maros Sandor
32  */

33 public class CommandReport extends javax.swing.JPanel JavaDoc {
34
35     
36     public CommandReport(String JavaDoc prompt, String JavaDoc message) {
37         initComponents();
38         JComponent JavaDoc msg = createCenterComponent(message);
39         jScrollPane1.setViewportView(msg);
40         jLabel1.setText(prompt);
41     }
42
43     private JComponent JavaDoc createCenterComponent(String JavaDoc text) {
44         if (text.startsWith("<html") || text.startsWith("<HTML")) { // NOI18N
45
JLabel JavaDoc msg = new JLabel JavaDoc(text);
46             return msg;
47         } else {
48             JTextArea JavaDoc msg = new JTextArea JavaDoc();
49             msg.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.inactiveBackground")); // NOI18N
50
msg.setColumns(40);
51             msg.setEditable(false);
52             msg.setRows(10);
53             msg.setMargin(new java.awt.Insets JavaDoc(4, 4, 0, 0));
54             msg.setText(text);
55             return msg;
56         }
57     }
58     
59     /** This method is called from within the constructor to
60      * initialize the form.
61      * WARNING: Do NOT modify this code. The content of this method is
62      * always regenerated by the Form Editor.
63      */

64     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
65
private void initComponents() {
66         jLabel1 = new javax.swing.JLabel JavaDoc();
67         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
68
69         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
70         this.setLayout(layout);
71         layout.setHorizontalGroup(
72             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
73             .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
74                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
75                     .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 484, Short.MAX_VALUE)
76                     .add(jLabel1))
77                 .addContainerGap())
78         );
79         layout.setVerticalGroup(
80             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
81             .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
82                 .addContainerGap()
83                 .add(jLabel1)
84                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
85                 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE))
86         );
87     }
88     // </editor-fold>//GEN-END:initComponents
89

90     
91     // Variables declaration - do not modify//GEN-BEGIN:variables
92
private javax.swing.JLabel JavaDoc jLabel1;
93     private javax.swing.JScrollPane JavaDoc jScrollPane1;
94     // End of variables declaration//GEN-END:variables
95

96 }
97
Popular Tags