1 19 20 package org.netbeans.modules.junit.wizards; 21 22 import java.awt.*; 23 import javax.accessibility.AccessibleContext ; 24 import javax.swing.JComponent ; 25 import javax.swing.JLabel ; 26 import javax.swing.JPanel ; 27 import javax.swing.JTextField ; 28 import javax.swing.event.ChangeListener ; 29 import org.netbeans.api.project.Project; 30 import org.netbeans.api.project.ProjectUtils; 31 import org.netbeans.modules.junit.GuiUtils; 32 import org.openide.WizardDescriptor; 33 import org.openide.util.HelpCtx; 34 import org.openide.util.NbBundle; 35 36 40 public class StepProblemMessage implements WizardDescriptor.Panel { 41 42 private final String msg; 43 private final Project project; 44 private JPanel panel; 45 46 47 public StepProblemMessage(Project project, String message) { 48 this.project = project; 49 this.msg = message; 50 } 51 52 public void addChangeListener(ChangeListener l) { 53 } 55 56 public Component getComponent() { 57 if (panel == null) { 58 panel = new JPanel (new GridBagLayout()); 59 JLabel lblProject = new JLabel ( 60 NbBundle.getMessage(StepProblemMessage.class, 61 "LBL_Project")); JTextField tfProject = new JTextField ( 63 ProjectUtils.getInformation(project).getDisplayName()); 64 JComponent message = GuiUtils.createMultilineLabel(msg); 65 66 lblProject.setLabelFor(tfProject); 67 tfProject.setEditable(false); 68 tfProject.setFocusable(false); 69 70 AccessibleContext accContext = tfProject.getAccessibleContext(); 71 accContext.setAccessibleName( 72 NbBundle.getMessage(StepProblemMessage.class, 73 "AD_Name_Project_name")); accContext.setAccessibleDescription( 75 NbBundle.getMessage(StepProblemMessage.class, 76 "AD_Descr_Project_name")); 78 GridBagConstraints gbc = new GridBagConstraints(); 79 80 gbc.anchor = GridBagConstraints.WEST; 81 gbc.insets = new Insets(0, 0, 18, 12); 82 panel.add(lblProject, gbc); 83 84 gbc.gridwidth = GridBagConstraints.REMAINDER; 85 gbc.fill = GridBagConstraints.HORIZONTAL; 86 gbc.weightx = 1.0; 87 gbc.insets = new Insets(0, 0, 18, 0); 88 panel.add(tfProject, gbc); 89 90 gbc.weighty = 1.0; 91 gbc.insets = new Insets(0, 0, 0, 0); 92 panel.add(message, gbc); 93 94 panel.setPreferredSize(new Dimension(500,0)); 95 } 96 return panel; 97 } 98 99 public HelpCtx getHelp() { 100 return new HelpCtx(StepProblemMessage.class); 101 } 102 103 106 public boolean isValid() { 107 return false; 108 } 109 110 public void readSettings(Object settings) { 111 } 113 114 public void removeChangeListener(ChangeListener l) { 115 } 117 118 public void storeSettings(Object settings) { 119 } 121 122 } 123 | Popular Tags |