1 19 20 package org.netbeans.modules.subversion.client; 21 22 import java.util.*; 23 import javax.swing.JComponent ; 24 import javax.swing.JLabel ; 25 import javax.swing.JTextArea ; 26 27 33 public class CommandReport extends javax.swing.JPanel { 34 35 36 public CommandReport(String prompt, String message) { 37 initComponents(); 38 JComponent msg = createCenterComponent(message); 39 jScrollPane1.setViewportView(msg); 40 jLabel1.setText(prompt); 41 } 42 43 private JComponent createCenterComponent(String text) { 44 if (text.startsWith("<html") || text.startsWith("<HTML")) { JLabel msg = new JLabel (text); 46 return msg; 47 } else { 48 JTextArea msg = new JTextArea (); 49 msg.setBackground(javax.swing.UIManager.getDefaults().getColor("TextField.inactiveBackground")); msg.setColumns(40); 51 msg.setEditable(false); 52 msg.setRows(10); 53 msg.setMargin(new java.awt.Insets (4, 4, 0, 0)); 54 msg.setText(text); 55 return msg; 56 } 57 } 58 59 64 private void initComponents() { 66 jLabel1 = new javax.swing.JLabel (); 67 jScrollPane1 = new javax.swing.JScrollPane (); 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 90 91 private javax.swing.JLabel jLabel1; 93 private javax.swing.JScrollPane jScrollPane1; 94 96 } 97 | Popular Tags |