Example usage for javax.swing JTextArea setWrapStyleWord

List of usage examples for javax.swing JTextArea setWrapStyleWord

Introduction

In this page you can find the example usage for javax.swing JTextArea setWrapStyleWord.

Prototype

@BeanProperty(description = "should wrapping occur at word boundaries")
public void setWrapStyleWord(boolean word) 

Source Link

Document

Sets the style of wrapping used if the text area is wrapping lines.

Usage

From source file:UI.SecurityDashboard.java

private void performMetric7(MainViewPanel mvp) {
    Metric7 metric7 = new Metric7();

    JPanel graphPanel7 = new JPanel();
    graphPanel7.setLayout(new BorderLayout());
    graphPanel7.add(metric7.run(), BorderLayout.NORTH);

    PortPanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nOpen ports that are not being used by a secure service on a system may result in a malicious "
                    + "attacker gaining access to the network. By listing all open ports on each device, this can aid in ensuring that ports "
                    + "currently open are know of.\n");
    header.setLineWrap(true);/*from  w w  w  . j  av a 2  s. com*/
    header.setWrapStyleWord(true);
    header.setEditable(false);
    PortPanel.add(header, BorderLayout.NORTH);
    PortPanel.add(graphPanel7, BorderLayout.CENTER);

    Metric7Panel.setBackground(Color.WHITE);
    Metric7Panel.setLayout(new BorderLayout());

    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel portTitleLabel = new JLabel("              Open Ports");
    portTitleLabel.setFont(titleFont);

    Metric7Panel.add(portTitleLabel, BorderLayout.NORTH);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    JLabel emptyLabel = new JLabel(" ");
    JLabel emptyLabel2 = new JLabel(" ");
    JLabel emptyLabel3 = new JLabel("   ");
    JLabel emptyLabel4 = new JLabel("   ");

    emptyLabel.setBackground(Color.white);
    emptyLabel2.setBackground(Color.white);
    emptyLabel3.setBackground(Color.white);
    emptyLabel4.setBackground(Color.white);

    emptyLabel.setOpaque(true);
    emptyLabel2.setOpaque(true);
    emptyLabel3.setOpaque(true);
    emptyLabel4.setOpaque(true);

    p.add(emptyLabel, BorderLayout.NORTH);
    p.add(emptyLabel3, BorderLayout.WEST);
    p.add(mvp.getPanel7(metric7), BorderLayout.CENTER);
    p.add(emptyLabel4, BorderLayout.EAST);
    p.add(emptyLabel2, BorderLayout.SOUTH);
    Metric7Panel.add(p, BorderLayout.CENTER);
    Metric7Panel.setBackground(Color.white);
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopTextArea.java

@Override
protected JTextArea createTextComponentImpl() {
    final JTextArea impl = new TextAreaFlushableField();

    if (isTabTraversal()) {
        Set<KeyStroke> forwardFocusKey = Collections.singleton(getKeyStroke(KeyEvent.VK_TAB, 0));
        impl.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forwardFocusKey);

        Set<KeyStroke> backwardFocusKey = Collections
                .singleton(getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_MASK));
        impl.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, backwardFocusKey);

        impl.addKeyListener(new KeyAdapter() {
            @Override//from ww  w  .  j a  va  2 s  .com
            public void keyPressed(KeyEvent e) {
                if (isEnabled() && isEditable() && e.getKeyCode() == KeyEvent.VK_TAB
                        && e.getModifiers() == KeyEvent.CTRL_MASK) {

                    if (StringUtils.isEmpty(impl.getText())) {
                        impl.setText("\t");
                    } else {
                        impl.append("\t");
                    }
                }
            }
        });
    }

    impl.setLineWrap(true);
    impl.setWrapStyleWord(true);

    int height = (int) impl.getPreferredSize().getHeight();
    impl.setMinimumSize(new Dimension(0, height));

    composition = new JScrollPane(impl);
    composition.setPreferredSize(new Dimension(150, height));
    composition.setMinimumSize(new Dimension(0, height));

    doc.putProperty("filterNewlines", false);

    return impl;
}

From source file:UI.SecurityDashboard.java

private void performMetric6(MainViewPanel mvp) {
    Metric6 metric6 = new Metric6();

    JPanel graphPanel6 = new JPanel();
    graphPanel6.setLayout(new BorderLayout());
    graphPanel6.add(metric6.run(), BorderLayout.NORTH);

    DefencePanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nThe network defence panel is designated to analysing network devices such as Firewalls, Routers, "
                    + "and Switches, and helps to ensure that the boundary defence is the work is well maintained. These devices must be updated "
                    + "correctly configured in order to prevent unauthorised external access.\n");
    header.setLineWrap(true);/*from   ww  w. j av  a  2s  .  c om*/
    header.setWrapStyleWord(true);
    header.setEditable(false);
    DefencePanel.add(header, BorderLayout.NORTH);
    DefencePanel.add(graphPanel6, BorderLayout.CENTER);

    ChartPanel sixthPanel = mvp.getPanel6(metric6);

    sixthPanel.addChartMouseListener(new ChartMouseListener() {

        @Override
        public void chartMouseClicked(ChartMouseEvent cme) {
            dashboardTabs.setSelectedIndex(6);
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    Metric6Panel.setLayout(new BorderLayout());
    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel netDefTitleLabel = new JLabel("           Network Defence");
    netDefTitleLabel.setFont(titleFont);
    Metric6Panel.add(netDefTitleLabel, BorderLayout.NORTH);
    Metric6Panel.add(sixthPanel, BorderLayout.CENTER);
    Metric6Panel.setBackground(Color.white);
}

From source file:org.agmip.ui.afsirs.frames.SWFrame.java

private void showSoilDataButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showSoilDataButtonActionPerformed
    // TODO add your handling code here:

    boolean isFileEnabled = jRadioFile.isSelected();
    boolean isFileLocationEnabled = jRadioButtonSavedLocation.isSelected();
    String str = "";

    if (isFileLocationEnabled) {
        SoilData soilData;/*from ww w.j av a  2  s  . c  o m*/
        File latestFile;
        try {
            latestFile = findLatestFile(soilFileListCombo.getSelectedIndex());
            str = readFromJsonFileForSoilDetailsButton(latestFile);

        } catch (FileNotFoundException e) {
            JOptionPane.showMessageDialog(null, e.getMessage());
            return;
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else if (isFileEnabled) {
        str += "Soil Name = " + SNAME + "\n";
        str += "Texture = " + TXT[0] + "\n";
        str += "Number of Layers = " + NL + "\n";
        str += "    DU        WCL        WCU        (WCU-WCL)\n";
        for (int i = 0; i < NL; i++) {
            str += (i + 1) + "  " + DU[i] + "       " + WCL[i] + "       " + WCU[i] + "       "
                    + (WCU[i] - WCL[i]) + "\n";
        }
    }

    JTextArea textArea = new JTextArea(str);
    JScrollPane scrollPane = new JScrollPane(textArea);
    textArea.setLineWrap(true);
    textArea.setEditable(false);
    textArea.setWrapStyleWord(true);
    scrollPane.setPreferredSize(new Dimension(500, 300));
    JOptionPane.showMessageDialog(null, scrollPane, "Soil Info", JOptionPane.NO_OPTION);

    //JOptionPane.showMessageDialog(null, str);            

}

From source file:UI.SecurityDashboard.java

private void performMetric3(MainViewPanel mvp) {
    Metric3 metric3 = new Metric3();

    JPanel graphPanel3 = new JPanel();
    graphPanel3.setLayout(new BorderLayout());
    graphPanel3.add(metric3.run(), BorderLayout.NORTH);

    AntiVirusPanel.setLayout(new BorderLayout());
    JTextArea header = new JTextArea(
            "\nThis page lists all devices on the network, divided into two tables. The top table shows the "
                    + "critical issues where the devices listed are either not running an anti-virus solution or the solution is not updated. It "
                    + "will also list those anti-virus solutions which have services which are not running (Scanning is disabled). The bottom "
                    + "table shows the updated table where the devices listed have updated and running anti-virus solutions.\n");
    header.setLineWrap(true);/*from w w  w  .  j  a v a2  s .com*/
    header.setWrapStyleWord(true);
    header.setEditable(false);
    AntiVirusPanel.add(header, BorderLayout.NORTH);
    AntiVirusPanel.add(graphPanel3, BorderLayout.CENTER);

    ChartPanel thirdPanel = mvp.getPanel3(metric3);

    thirdPanel.addChartMouseListener(new ChartMouseListener() {

        @Override
        public void chartMouseClicked(ChartMouseEvent cme) {
            dashboardTabs.setSelectedIndex(3);
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    Metric3Panel.setLayout(new BorderLayout());
    Font titleFont = new Font("Calibri", Font.BOLD, 27);
    JLabel avTitleLabel = new JLabel("           AV Scan Check");
    avTitleLabel.setFont(titleFont);
    Metric3Panel.add(avTitleLabel, BorderLayout.NORTH);
    Metric3Panel.add(thirdPanel, BorderLayout.CENTER);
    Metric3Panel.setBackground(Color.white);
}

From source file:gui.LauncherFrame.java

/**
 * creates a text pane containing text and adds it to a tabbed frame
 * //from   www  . jav a  2  s . c o m
 * @param tabbedPane - the tabbed frame to add the text panel to
 * @param tabName  - title of the text panel tab
 * @param filename - name of file containing the text to add to the text panel
 */
private void addTextTab(javax.swing.JTabbedPane tabbedPane, String tabName, String filename) {

    File textfile = new File(filename);
    if (!textfile.isFile()) {
        debug.print(DebugMessage.StatusType.Error, "File is not valid: " + filename);
        return;
    }
    if (tabName == null || tabName.isEmpty()) {
        debug.print(DebugMessage.StatusType.Error, "Invalid name for tab: " + tabName);
        return;
    }

    BufferedReader in = null;
    try {
        // create a text area and place it in a scrollable panel
        javax.swing.JTextArea fileText = new javax.swing.JTextArea(0, 0);
        fileText.setLineWrap(true);
        fileText.setWrapStyleWord(true);
        javax.swing.JScrollPane fileScroll = new javax.swing.JScrollPane(fileText);

        // place the scroll pane in the tabbed pane
        tabbedPane.addTab(tabName, fileScroll);

        // now read the file contents into the text area
        in = new BufferedReader(new FileReader(textfile));
        String line = in.readLine();
        while (line != null) {
            fileText.append(line + "\n");
            line = in.readLine();
        }
        fileText.setCaretPosition(0); // set position to start of file
    } catch (FileNotFoundException ex) {
        debug.print(DebugMessage.StatusType.Error, ex + "<FILE_NOT_FOUND> - accessing " + tabName + " file");
    } catch (IOException ex) {
        debug.print(DebugMessage.StatusType.Error, ex + "<IO_EXCEPTION>");
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException ex) {
                debug.print(DebugMessage.StatusType.Error, ex + "<IO_EXCEPTION>");
            }
        }
    }
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Creates a JTextArea for display purposes only.
 * @param cellField FormCellField info/*from  ww  w .  jav  a2 s .  c o m*/
 * @return the control
 */
public static JScrollPane changeTextAreaForDisplay(final JTextArea ta) {
    Insets insets = ta.getBorder().getBorderInsets(ta);
    ta.setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom));
    ta.setForeground(Color.BLACK);
    ta.setEditable(false);
    ta.setBackground(viewFieldColor.getColor());
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);

    JScrollPane scrollPane = new JScrollPane(ta);
    insets = scrollPane.getBorder().getBorderInsets(scrollPane);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane
            .setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom));

    return scrollPane;
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.DataImportDialog.java

/**
* Takes the list of data import errors and displays then to the user
* 
* void//from  www .j a va 2 s .  c  o  m
*/
protected void showErrors() {
    JList listOfErrors = genListOfErrorWhereTableDataDefiesSizeConstraints(model.getColumnNames(),
            model.getData());

    if ((model.getColumnNames() == null) || (model.getData() == null) || (listOfErrors == null)
            || (listOfErrors.getModel().getSize() == 0)) {
        JTextArea textArea = new JTextArea();
        textArea.setRows(25);
        textArea.setColumns(60);
        //String newline = "\n";
        //for (int i = 0; i < listOfErrors.getModel().getSize(); i++)
        //{
        textArea.append(getResourceString("WB_PARSE_FILE_ERROR2"));
        //}
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        textArea.setEditable(false);
        textArea.setCaretPosition(0);
        JScrollPane pane = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), pane, getResourceString("DATA_IMPORT_ISSUES"),
                JOptionPane.WARNING_MESSAGE);
        okBtn.setEnabled(false);
    } else if (listOfErrors.getModel().getSize() > 0) {
        JTextArea textArea = new JTextArea();
        textArea.setRows(25);
        textArea.setColumns(60);
        String newline = "\n";
        for (int i = 0; i < listOfErrors.getModel().getSize(); i++) {
            textArea.append((String) listOfErrors.getModel().getElementAt(i) + newline + newline);
        }
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        textArea.setEditable(false);
        textArea.setCaretPosition(0);
        JScrollPane pane = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        JOptionPane.showMessageDialog(UIRegistry.getTopWindow(), pane, getResourceString("DATA_IMPORT_ISSUES"),
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:ffx.ui.ModelingPanel.java

private void loadCommand() {
    synchronized (this) {
        // Force Field X Command
        Element command;//  w  ww .j a  v  a2 s  .  c o m
        // Command Options
        NodeList options;
        Element option;
        // Option Values
        NodeList values;
        Element value;
        // Options may be Conditional based on previous Option values (not
        // always supplied)
        NodeList conditionalList;
        Element conditional;
        // JobPanel GUI Components that change based on command
        JPanel optionPanel;
        // Clear the previous components
        commandPanel.removeAll();
        optionsTabbedPane.removeAll();
        conditionals.clear();
        String currentCommand = (String) currentCommandBox.getSelectedItem();
        if (currentCommand == null) {
            commandPanel.validate();
            commandPanel.repaint();
            return;
        }
        command = null;
        for (int i = 0; i < commandList.getLength(); i++) {
            command = (Element) commandList.item(i);
            String name = command.getAttribute("name");
            if (name.equalsIgnoreCase(currentCommand)) {
                break;
            }
        }
        int div = splitPane.getDividerLocation();
        descriptTextArea.setText(currentCommand.toUpperCase() + ": " + command.getAttribute("description"));
        splitPane.setBottomComponent(descriptScrollPane);
        splitPane.setDividerLocation(div);
        // The "action" tells Force Field X what to do when the
        // command finishes
        commandActions = command.getAttribute("action").trim();
        // The "fileType" specifies what file types this command can execute
        // on
        String string = command.getAttribute("fileType").trim();
        String[] types = string.split(" +");
        commandFileTypes.clear();
        for (String type : types) {
            if (type.contains("XYZ")) {
                commandFileTypes.add(FileType.XYZ);
            }
            if (type.contains("INT")) {
                commandFileTypes.add(FileType.INT);
            }
            if (type.contains("ARC")) {
                commandFileTypes.add(FileType.ARC);
            }
            if (type.contains("PDB")) {
                commandFileTypes.add(FileType.PDB);
            }
            if (type.contains("ANY")) {
                commandFileTypes.add(FileType.ANY);
            }
        }
        // Determine what options are available for this command
        options = command.getElementsByTagName("Option");
        int length = options.getLength();
        for (int i = 0; i < length; i++) {
            // This Option will be enabled (isEnabled = true) unless a
            // Conditional disables it
            boolean isEnabled = true;
            option = (Element) options.item(i);
            conditionalList = option.getElementsByTagName("Conditional");
            /*
             * Currently, there can only be 0 or 1 Conditionals per Option
             * There are three types of Conditionals implemented. 1.)
             * Conditional on a previous Option, this option may be
             * available 2.) Conditional on input for this option, a
             * sub-option may be available 3.) Conditional on the presence
             * of keywords, this option may be available
             */
            if (conditionalList != null) {
                conditional = (Element) conditionalList.item(0);
            } else {
                conditional = null;
            }
            // Get the command line flag
            String flag = option.getAttribute("flag").trim();
            // Get the description
            String optionDescript = option.getAttribute("description");
            JTextArea optionTextArea = new JTextArea("  " + optionDescript.trim());
            optionTextArea.setEditable(false);
            optionTextArea.setLineWrap(true);
            optionTextArea.setWrapStyleWord(true);
            optionTextArea.setBorder(etchedBorder);
            // Get the default for this Option (if one exists)
            String defaultOption = option.getAttribute("default");
            // Option Panel
            optionPanel = new JPanel(new BorderLayout());
            optionPanel.add(optionTextArea, BorderLayout.NORTH);
            String swing = option.getAttribute("gui");
            JPanel optionValuesPanel = new JPanel(new FlowLayout());
            optionValuesPanel.setBorder(etchedBorder);
            ButtonGroup bg = null;
            if (swing.equalsIgnoreCase("CHECKBOXES")) {
                // CHECKBOXES allows selection of 1 or more values from a
                // predefined set (Analyze, for example)
                values = option.getElementsByTagName("Value");
                for (int j = 0; j < values.getLength(); j++) {
                    value = (Element) values.item(j);
                    JCheckBox jcb = new JCheckBox(value.getAttribute("name"));
                    jcb.addMouseListener(this);
                    jcb.setName(flag);
                    if (defaultOption != null && jcb.getActionCommand().equalsIgnoreCase(defaultOption)) {
                        jcb.setSelected(true);
                    }
                    optionValuesPanel.add(jcb);
                }
            } else if (swing.equalsIgnoreCase("TEXTFIELD")) {
                // TEXTFIELD takes an arbitrary String as input
                JTextField jtf = new JTextField(20);
                jtf.addMouseListener(this);
                jtf.setName(flag);
                if (defaultOption != null && defaultOption.equals("ATOMS")) {
                    FFXSystem sys = mainPanel.getHierarchy().getActive();
                    if (sys != null) {
                        jtf.setText("" + sys.getAtomList().size());
                    }
                } else if (defaultOption != null) {
                    jtf.setText(defaultOption);
                }
                optionValuesPanel.add(jtf);
            } else if (swing.equalsIgnoreCase("RADIOBUTTONS")) {
                // RADIOBUTTONS allows one choice from a set of predifined
                // values
                bg = new ButtonGroup();
                values = option.getElementsByTagName("Value");
                for (int j = 0; j < values.getLength(); j++) {
                    value = (Element) values.item(j);
                    JRadioButton jrb = new JRadioButton(value.getAttribute("name"));
                    jrb.addMouseListener(this);
                    jrb.setName(flag);
                    bg.add(jrb);
                    if (defaultOption != null && jrb.getActionCommand().equalsIgnoreCase(defaultOption)) {
                        jrb.setSelected(true);
                    }
                    optionValuesPanel.add(jrb);
                }
            } else if (swing.equalsIgnoreCase("PROTEIN")) {
                // Protein allows selection of amino acids for the protein
                // builder
                optionValuesPanel.setLayout(new BoxLayout(optionValuesPanel, BoxLayout.Y_AXIS));
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(getAminoAcidPanel());
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidComboBox.removeAllItems();
                JButton add = new JButton("Edit");
                add.setActionCommand("PROTEIN");
                add.addActionListener(this);
                add.setAlignmentX(Button.CENTER_ALIGNMENT);
                JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidTextField);
                comboPanel.add(add);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton remove = new JButton("Remove");
                add.setMinimumSize(remove.getPreferredSize());
                add.setPreferredSize(remove.getPreferredSize());
                remove.setActionCommand("PROTEIN");
                remove.addActionListener(this);
                remove.setAlignmentX(Button.CENTER_ALIGNMENT);
                comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidComboBox);
                comboPanel.add(remove);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(acidScrollPane);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton reset = new JButton("Reset");
                reset.setActionCommand("PROTEIN");
                reset.addActionListener(this);
                reset.setAlignmentX(Button.CENTER_ALIGNMENT);
                optionValuesPanel.add(reset);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidTextArea.setText("");
                acidTextField.setText("");
            } else if (swing.equalsIgnoreCase("NUCLEIC")) {
                // Nucleic allows selection of nucleic acids for the nucleic
                // acid builder
                optionValuesPanel.setLayout(new BoxLayout(optionValuesPanel, BoxLayout.Y_AXIS));
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(getNucleicAcidPanel());
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidComboBox.removeAllItems();
                JButton add = new JButton("Edit");
                add.setActionCommand("NUCLEIC");
                add.addActionListener(this);
                add.setAlignmentX(Button.CENTER_ALIGNMENT);
                JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidTextField);
                comboPanel.add(add);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton remove = new JButton("Remove");
                add.setMinimumSize(remove.getPreferredSize());
                add.setPreferredSize(remove.getPreferredSize());
                remove.setActionCommand("NUCLEIC");
                remove.addActionListener(this);
                remove.setAlignmentX(Button.CENTER_ALIGNMENT);
                comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                comboPanel.add(acidComboBox);
                comboPanel.add(remove);
                optionValuesPanel.add(comboPanel);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                optionValuesPanel.add(acidScrollPane);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                JButton button = new JButton("Reset");
                button.setActionCommand("NUCLEIC");
                button.addActionListener(this);
                button.setAlignmentX(Button.CENTER_ALIGNMENT);
                optionValuesPanel.add(button);
                optionValuesPanel.add(Box.createRigidArea(new Dimension(0, 5)));
                acidTextArea.setText("");
                acidTextField.setText("");
            } else if (swing.equalsIgnoreCase("SYSTEMS")) {
                // SYSTEMS allows selection of an open system
                JComboBox<FFXSystem> jcb = new JComboBox<>(mainPanel.getHierarchy().getNonActiveSystems());
                jcb.setSize(jcb.getMaximumSize());
                jcb.addActionListener(this);
                optionValuesPanel.add(jcb);
            }
            // Set up a Conditional for this Option
            if (conditional != null) {
                isEnabled = false;
                String conditionalName = conditional.getAttribute("name");
                String conditionalValues = conditional.getAttribute("value");
                String cDescription = conditional.getAttribute("description");
                String cpostProcess = conditional.getAttribute("postProcess");
                if (conditionalName.toUpperCase().startsWith("KEYWORD")) {
                    optionPanel.setName(conditionalName);
                    String keywords[] = conditionalValues.split(" +");
                    if (activeSystem != null) {
                        Hashtable<String, Keyword> systemKeywords = activeSystem.getKeywords();
                        for (String key : keywords) {
                            if (systemKeywords.containsKey(key.toUpperCase())) {
                                isEnabled = true;
                            }
                        }
                    }
                } else if (conditionalName.toUpperCase().startsWith("VALUE")) {
                    isEnabled = true;
                    // Add listeners to the values of this option so
                    // the conditional options can be disabled/enabled.
                    for (int j = 0; j < optionValuesPanel.getComponentCount(); j++) {
                        JToggleButton jtb = (JToggleButton) optionValuesPanel.getComponent(j);
                        jtb.addActionListener(this);
                        jtb.setActionCommand("Conditional");
                    }
                    JPanel condpanel = new JPanel();
                    condpanel.setBorder(etchedBorder);
                    JLabel condlabel = new JLabel(cDescription);
                    condlabel.setEnabled(false);
                    condlabel.setName(conditionalValues);
                    JTextField condtext = new JTextField(10);
                    condlabel.setLabelFor(condtext);
                    if (cpostProcess != null) {
                        condtext.setName(cpostProcess);
                    }
                    condtext.setEnabled(false);
                    condpanel.add(condlabel);
                    condpanel.add(condtext);
                    conditionals.add(condlabel);
                    optionPanel.add(condpanel, BorderLayout.SOUTH);
                } else if (conditionalName.toUpperCase().startsWith("REFLECTION")) {
                    String[] condModifiers;
                    if (conditionalValues.equalsIgnoreCase("AltLoc")) {
                        condModifiers = activeSystem.getAltLocations();
                        if (condModifiers != null && condModifiers.length > 1) {
                            isEnabled = true;
                            bg = new ButtonGroup();
                            for (int j = 0; j < condModifiers.length; j++) {
                                JRadioButton jrbmi = new JRadioButton(condModifiers[j]);
                                jrbmi.addMouseListener(this);
                                bg.add(jrbmi);
                                optionValuesPanel.add(jrbmi);
                                if (j == 0) {
                                    jrbmi.setSelected(true);
                                }
                            }
                        }
                    } else if (conditionalValues.equalsIgnoreCase("Chains")) {
                        condModifiers = activeSystem.getChainNames();
                        if (condModifiers != null && condModifiers.length > 0) {
                            isEnabled = true;
                            for (int j = 0; j < condModifiers.length; j++) {
                                JRadioButton jrbmi = new JRadioButton(condModifiers[j]);
                                jrbmi.addMouseListener(this);
                                bg.add(jrbmi);
                                optionValuesPanel.add(jrbmi, j);
                            }
                        }
                    }
                }
            }
            optionPanel.add(optionValuesPanel, BorderLayout.CENTER);
            optionPanel.setPreferredSize(optionPanel.getPreferredSize());
            optionsTabbedPane.addTab(option.getAttribute("name"), optionPanel);
            optionsTabbedPane.setEnabledAt(optionsTabbedPane.getTabCount() - 1, isEnabled);
        }
    }
    optionsTabbedPane.setPreferredSize(optionsTabbedPane.getPreferredSize());
    commandPanel.setLayout(borderLayout);
    commandPanel.add(optionsTabbedPane, BorderLayout.CENTER);
    commandPanel.validate();
    commandPanel.repaint();
    loadLogSettings();
    statusLabel.setText("  " + createCommandInput());
}

From source file:edu.ku.brc.specify.tasks.InteractionsTask.java

/**
 * @param list// w  ww .jav  a2 s  .  c  o m
 */
protected void showMissingDetsDlg(final List<CollectionObject> noCurrDetList) {
    StringBuilder sb = new StringBuilder();
    for (CollectionObject co : noCurrDetList) {
        if (sb.length() > 0)
            sb.append(", ");
        sb.append(co.getIdentityTitle());
    }

    PanelBuilder pb = new PanelBuilder(new FormLayout("p:g", "p,2px,p"));
    CellConstraints cc = new CellConstraints();
    JTextArea ta = UIHelper.createTextArea(5, 40);
    JScrollPane scroll = UIHelper.createScrollPane(ta);
    JLabel lbl = UIHelper.createLabel(getResourceString("InteractionsTask.MISSING_DET"));

    pb.add(lbl, cc.xy(1, 1));
    pb.add(scroll, cc.xy(1, 3));

    ta.setText(sb.toString());
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setEditable(false);

    pb.setDefaultDialogBorder();

    CustomDialog dlg = new CustomDialog((Frame) UIRegistry.getTopWindow(),
            getResourceString("InteractionsTask.MISSING_DET_TITLE"), true, CustomDialog.OK_BTN, pb.getPanel());
    //dlg.setOkLabel(getResourceString(key))
    dlg.setVisible(true);
}