public void showMessage(String messageInfo, boolean isError) { messagePanel.showMessage(messageInfo, isError); okButton.setEnabled(!isError); }
protected void initGuiComponents() { selectButtonGroup = new javax.swing.ButtonGroup(); getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); messagePanel = new IpssMessagePanel(); getContentPane().add(messagePanel); messagePanel.setPreferredSize(new Dimension(0, 30)); messagePanel.setBorder(new EmptyBorder(0, 5, 0, 0)); messagePanel.getMessageLabel().setPreferredSize(new Dimension(0, 30)); getContentPane().add(Box.createVerticalStrut(10)); mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.setBorder(new EmptyBorder(0, 5, 0, 5)); getContentPane().add(mainPanel); mainPanel.add(Box.createVerticalStrut(10)); selectpanel = new JPanel(); mainPanel.add(selectpanel); final GridLayout gridLayout = new GridLayout(0, 1); selectpanel.setLayout(gridLayout); selectpanel.setBorder( new TitledBorder( null, "Contents", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); newRadioButton = new JRadioButton(); selectpanel.add(newRadioButton); newRadioButton.setSelected(true); newRadioButton.setMnemonic('N'); newRadioButton.setText("Create a new graphic project"); selectButtonGroup.add(newRadioButton); fromRadioButton = new JRadioButton(); selectpanel.add(fromRadioButton); fromRadioButton.setMnemonic('x'); fromRadioButton.setText("Import a graphic project from existing source"); browsePanel = new JPanel(); selectpanel.add(browsePanel); browsePanel.setLayout(new BorderLayout()); dirTextField = new JTextField(); dirTextField.setEditable(false); dirTextField.setFocusAccelerator('f'); browsePanel.add(dirTextField); dirLabel = new JLabel(); dirLabel.setDisplayedMnemonic(KeyEvent.VK_F); browsePanel.add(dirLabel, BorderLayout.WEST); dirLabel.setText("File: "); browseButton = new JButton(); browseButton.setMnemonic('B'); browseButton.setText("Browse..."); browsePanel.add(browseButton, BorderLayout.EAST); selectButtonGroup.add(fromRadioButton); final JPanel panel = new JPanel(); mainPanel.add(panel, BorderLayout.NORTH); panel.setLayout(new BorderLayout()); nameLabel = new JLabel(); panel.add(nameLabel, BorderLayout.WEST); nameLabel.setDisplayedMnemonic(KeyEvent.VK_G); nameLabel.setText("Graphic Project File Name:"); nameTextField = new JTextField(); panel.add(nameTextField, BorderLayout.CENTER); nameTextField.setFocusAccelerator('g'); buttonPanel = new JPanel(); getContentPane().add(buttonPanel); okButton = new JButton(); okButton.setMnemonic('O'); buttonPanel.add(okButton); okButton.setText("OK"); cancelButton = new JButton(); buttonPanel.add(cancelButton); cancelButton.setMnemonic('C'); cancelButton.setText("Cancel"); // selectpanel.setVisible(false); }