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:org.photovault.swingui.PhotoInfoEditor.java

private void createRightsUI() {
    JPanel pane = new JPanel();
    tabPane.addTab("Rights", pane);

    JLabel copyrightLabel = new JLabel("Copyright");
    JTextField copyrightField = createMvTextField("usageRights.copyright", 30);
    JLabel attributionLabel = new JLabel("Name for attribution");
    JTextField attributionField = createMvTextField("usageRights.attributionName", 30);
    JLabel attributionUrlLabel = new JLabel("Url for attribution");
    JTextField attributionUrlField = createMvTextField("usageRights.attributionUrl", 30);

    JLabel licenseLabel = new JLabel("License");
    List<License> licenses = new ArrayList();
    licenses.addAll(EnumSet.allOf(License.class));
    JComboBox licenseCombo = createMvComboBox("usageRights.license", licenses);

    // Tech note text
    JLabel termsLabel = new JLabel("Usage terms");
    JTextArea termsTextArea = createMvTextArea("usageRights.usageTerms", 5, 40);
    termsTextArea.setLineWrap(true);/* w  ww. ja v a  2 s. c  o m*/
    termsTextArea.setWrapStyleWord(true);
    JScrollPane termsScrollPane = new JScrollPane(termsTextArea);
    termsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    Border termsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    termsBorder = BorderFactory.createTitledBorder(termsBorder, "Usage terms");
    termsScrollPane.setBorder(termsBorder);

    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    pane.setLayout(layout);
    JLabel[] labels = { copyrightLabel, licenseLabel, attributionLabel, attributionUrlLabel };
    JComponent[] fields = { copyrightField, licenseCombo, attributionField, attributionUrlField };
    addLabelTextRows(labels, fields, layout, pane);
    pane.add(termsScrollPane);
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.BOTH;
    layout.setConstraints(termsScrollPane, c);
}

From source file:org.p_vcd.ui.LicenseDialog.java

public LicenseDialog(String libName, String libHomepage, String licenseName, String licenseFilename) {
    setSize(680, 480);//from   w  w  w .  j a  va 2  s  . co m
    setTitle(libName);
    getContentPane().setLayout(new BorderLayout());
    {
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.NORTH);
        panel.setLayout(new MigLayout("", "[grow,trailing][grow]", "[20px][][]"));
        {
            JLabel lblSoft = new JLabel(libName);
            lblSoft.setFont(new Font("Tahoma", Font.BOLD, 16));
            panel.add(lblSoft, "center,cell 0 0 2 1");
        }
        {
            JLabel lblHomePage = new JLabel("Home page:");
            lblHomePage.setFont(new Font("Tahoma", Font.BOLD, 14));
            panel.add(lblHomePage, "cell 0 1");
        }
        {
            JLabel lblHome = SwingUtil.createLink(libHomepage, libHomepage);
            lblHome.setFont(new Font("Tahoma", Font.PLAIN, 14));
            panel.add(lblHome, "cell 1 1");
        }
        {
            JLabel lblNewLabel = new JLabel("License:");
            lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14));
            panel.add(lblNewLabel, "cell 0 2");
        }
        {
            JLabel lblLicense = new JLabel(licenseName);
            lblLicense.setFont(new Font("Tahoma", Font.PLAIN, 14));
            panel.add(lblLicense, "cell 1 2");
        }
    }
    {
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.CENTER);
        panel.setLayout(new FlowLayout());
        panel.setBorder(new EmptyBorder(5, 5, 5, 5));
        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setPreferredSize(new Dimension(600, 300));
        scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        panel.add(scrollPane);
        {
            JTextArea txtLicense = new JTextArea();
            txtLicense.setEditable(false);
            txtLicense.setFont(new Font("Monospaced", Font.PLAIN, 11));
            txtLicense.setWrapStyleWord(true);
            txtLicense.setLineWrap(true);
            try {
                InputStream is = Thread.currentThread().getContextClassLoader()
                        .getResourceAsStream("org/p_vcd/licenses/" + licenseFilename);
                String text = IOUtils.toString(is, "UTF-8");
                IOUtils.closeQuietly(is);
                txtLicense.setText(text);
                txtLicense.setCaretPosition(0);
            } catch (Exception e) {
                e.printStackTrace();
            }
            scrollPane.setViewportView(txtLicense);
        }
    }
    {
        JPanel panel = new JPanel();
        getContentPane().add(panel, BorderLayout.SOUTH);
        panel.setLayout(new FlowLayout(FlowLayout.CENTER));
        JButton okButton = new JButton("OK");
        okButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                LicenseDialog.this.dispose();
            }
        });
        okButton.setActionCommand("OK");
        panel.add(okButton);
        getRootPane().setDefaultButton(okButton);
    }
}

From source file:org.revager.tools.GUITools.java

/**
 * Creates a new title text area for popup windows.
 * //w  ww.  j  a va  2  s.  c  o m
 * @param titleText
 *            the title text
 * 
 * @return the newly created text area
 */
public static JTextArea newPopupTitleArea(String titleText) {
    JTextArea textTitle = new JTextArea();
    textTitle.setEditable(false);
    textTitle.setText(titleText);
    textTitle.setBackground(UI.POPUP_BACKGROUND);
    textTitle.setFont(UI.STANDARD_FONT.deriveFont(Font.BOLD));
    textTitle.setLineWrap(true);
    textTitle.setWrapStyleWord(true);
    textTitle.setFocusable(false);
    textTitle.setBorder(new EmptyBorder(5, 5, 5, 5));
    return textTitle;
}

From source file:org.revager.tools.GUITools.java

/**
 * Sets the given text area into a scroll pane.
 * /*  ww w .jav  a2s  .c o  m*/
 * @param txt
 *            the text area
 * 
 * @return the scroll pane
 */
public static JScrollPane setIntoScrllPn(JTextArea txt) {
    txt.setLineWrap(true);
    txt.setWrapStyleWord(true);
    return new JScrollPane(txt, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}

From source file:org.tinymediamanager.ui.dialogs.BugReportDialog.java

/**
 * Instantiates a new feedback dialog./* w  w  w  . j a va2s. co m*/
 */
public BugReportDialog() {
    super(BUNDLE.getString("BugReport"), "bugReportdialog");
    getContentPane().setLayout(new BorderLayout(0, 0));

    JPanel panelContent = new JPanel();
    getContentPane().add(panelContent, BorderLayout.CENTER);
    panelContent.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.UNRELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC,
                    RowSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_ROWSPEC, }));

    final JTextArea taDescription = new JTextArea();
    taDescription.setOpaque(false);
    taDescription.setWrapStyleWord(true);
    taDescription.setLineWrap(true);
    taDescription.setEditable(false);
    taDescription.setText(BUNDLE.getString("BugReport.description")); //$NON-NLS-1$
    panelContent.add(taDescription, "2, 2, 6, 1, fill, fill");

    final JButton btnSaveLogs = new JButton(BUNDLE.getString("BugReport.createlogs")); //$NON-NLS-1$
    btnSaveLogs.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            // open the log download window
            try {
                Path file = TmmUIHelper.saveFile(BUNDLE.getString("BugReport.savelogs"), "tmm_logs.zip", //$NON-NLS-1$
                        new FileNameExtensionFilter("Zip files", ".zip"));
                if (file != null) {
                    writeLogsFile(file.toFile());
                }
            } catch (Exception ex) {
                LOGGER.error("Could not write logs.zip: " + ex.getMessage());
            }
        }
    });

    final JLabel lblStep1 = new JLabel(BUNDLE.getString("BugReport.step1")); //$NON-NLS-1$
    panelContent.add(lblStep1, "2, 4, default, top");

    final JTextArea taStep1 = new JTextArea();
    taStep1.setText(BUNDLE.getString("BugReport.step1.description")); //$NON-NLS-1$
    taStep1.setOpaque(false);
    taStep1.setEditable(false);
    panelContent.add(taStep1, "5, 4, fill, fill");
    panelContent.add(btnSaveLogs, "7, 4");

    final JButton btnCreateIssue = new JButton(BUNDLE.getString("BugReport.craeteissue")); //$NON-NLS-1$
    btnCreateIssue.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            // create the url for github
            String baseUrl = "https://github.com/tinyMediaManager/tinyMediaManager/issues/new?body=";
            String params = "Version: " + ReleaseInfo.getRealVersion();
            params += "\nBuild: " + ReleaseInfo.getRealBuildDate();
            params += "\nOS: " + System.getProperty("os.name") + " " + System.getProperty("os.version");
            params += "\nJDK: " + System.getProperty("java.version") + " " + System.getProperty("os.arch") + " "
                    + System.getProperty("java.vendor");
            params += "\n\n__What is the actual behaviour?__\n\n";
            params += "\n\n__What is the expected behaviour?__\n\n";
            params += "\n\n__Steps to reproduce:__\n\n";
            params += "\n\n__Additional__\nHave you attached the logfile from the day it happened?";

            String url = "";
            try {
                url = baseUrl + URLEncoder.encode(params, "UTF-8");
                TmmUIHelper.browseUrl(url);
            } catch (Exception e1) {
                LOGGER.error("FAQ", e1);
                MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, url, "message.erroropenurl",
                        new String[] { ":", e1.getLocalizedMessage() }));
            }
        }
    });

    final JLabel lblStep2 = new JLabel(BUNDLE.getString("BugReport.step2")); //$NON-NLS-1$
    panelContent.add(lblStep2, "2, 6, default, top");

    final JTextArea taStep2 = new JTextArea();
    taStep2.setOpaque(false);
    taStep2.setEditable(false);
    taStep2.setText(BUNDLE.getString("BugReport.step2.description")); //$NON-NLS-1$
    panelContent.add(taStep2, "5, 6, fill, fill");
    panelContent.add(btnCreateIssue, "7, 6");

    final JLabel lblHintIcon = new JLabel(IconManager.HINT);
    panelContent.add(lblHintIcon, "3, 8");

    final JLabel lblHint = new JLabel(BUNDLE.getString("BugReport.languagehint")); //$NON-NLS-1$
    panelContent.add(lblHint, "5, 8");

    JPanel panelButtons = new JPanel();

    getContentPane().add(panelButtons, BorderLayout.SOUTH);

    JButton btnClose = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$
    btnClose.setIcon(IconManager.CANCEL);
    btnClose.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });
    panelButtons.setLayout(new FormLayout(
            new ColumnSpec[] { ColumnSpec.decode("default:grow"), FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("25px"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));
    panelButtons.add(btnClose, "2, 2");
}

From source file:org.tinymediamanager.ui.dialogs.RegisterDonatorVersionDialog.java

public RegisterDonatorVersionDialog() {
    super(BUNDLE.getString("tmm.registerdonator"), "registerDonator"); //$NON-NLS-1$
    setBounds(166, 5, 400, 300);//  ww w .  j  a v  a  2s.c o m
    boolean isDonator = Globals.isDonator();
    Properties props = null;
    if (isDonator) {
        props = License.decrypt();
    }

    {
        JPanel panelContent = new JPanel();
        getContentPane().add(panelContent, BorderLayout.CENTER);
        panelContent.setLayout(new FormLayout(
                new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                        FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"),
                        FormFactory.RELATED_GAP_COLSPEC, },
                new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                        FormFactory.PARAGRAPH_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.UNRELATED_GAP_ROWSPEC, }));

        {
            JTextArea textArea = new JTextArea();
            textArea.setOpaque(false);
            textArea.setLineWrap(true);
            textArea.setWrapStyleWord(true);
            textArea.setEditable(false);
            panelContent.add(textArea, "2, 2, 3, 1, default, center");
            if (isDonator) {
                textArea.setText(BUNDLE.getString("tmm.registerdonator.thanks")); //$NON-NLS-1$
            } else {
                textArea.setText(BUNDLE.getString("tmm.registerdonator.hint")); //$NON-NLS-1$
            }
        }
        {
            JLabel lblName = new JLabel(BUNDLE.getString("tmm.registerdonator.name")); //$NON-NLS-1$
            panelContent.add(lblName, "2, 4, right, default");
            tfName = new JTextField("");
            lblName.setLabelFor(tfName);
            panelContent.add(tfName, "4, 4, fill, default");
            tfName.setColumns(10);
            if (isDonator) {
                tfName.setText(props.getProperty("user"));
                tfName.setEnabled(false);
            }
        }
        {
            JLabel lblEmailAddress = new JLabel(BUNDLE.getString("tmm.registerdonator.email")); //$NON-NLS-1$
            panelContent.add(lblEmailAddress, "2, 6, right, default");
            tfEmailAddress = new JTextField("");
            lblEmailAddress.setLabelFor(tfEmailAddress);
            panelContent.add(tfEmailAddress, "4, 6, fill, default");
            tfEmailAddress.setColumns(10);
            if (isDonator) {
                tfEmailAddress.setText(props.getProperty("email"));
                tfEmailAddress.setEnabled(false);
            }
        }
    }
    {
        JPanel panelButtons = new JPanel();
        panelButtons.setBorder(new EmptyBorder(4, 4, 4, 4));
        getContentPane().add(panelButtons, BorderLayout.SOUTH);
        EqualsLayout layout = new EqualsLayout(5);
        layout.setMinWidth(100);
        panelButtons.setLayout(layout);
        {
            JButton btnRegister = new JButton(BUNDLE.getString("Button.register")); //$NON-NLS-1$
            btnRegister.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    try {
                        LOGGER.debug("registering for donator version: ", tfEmailAddress.getText());
                        Properties p = new Properties();
                        p.setProperty("user", tfName.getText());
                        p.setProperty("email", tfEmailAddress.getText());
                        p.setProperty("generated", String.valueOf(new Date().getTime()));
                        p.setProperty("uuid", FileUtils.readFileToString(new File("tmm.uuid")));

                        // get encrypted string and write tmm.lic
                        if (License.encrypt(p) && License.isValid()) {
                            JOptionPane.showMessageDialog(RegisterDonatorVersionDialog.this,
                                    BUNDLE.getString("tmm.registerdonator.success")); //$NON-NLS-1$
                            setVisible(false);
                        } else {
                            JOptionPane.showMessageDialog(RegisterDonatorVersionDialog.this,
                                    BUNDLE.getString("tmm.registerdonator.error")); //$NON-NLS-1$
                        }
                    } catch (Exception ex) {
                        LOGGER.error("Error registering donator version: " + ex.getMessage());
                    }
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                }
            });
            if (isDonator) {
                btnRegister.setEnabled(false);
            }
            panelButtons.add(btnRegister);
        }
        {
            JButton btnClose = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$
            btnClose.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent arg0) {
                    setVisible(false);
                }
            });
            panelButtons.add(btnClose);
        }
    }
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            tfName.requestFocus();
        }
    });
}

From source file:org.ut.biolab.medsavant.client.filter.TabularFilterView.java

protected final void initContentPanel() {

    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    if (availableValues == null) {
        JTextArea label = new JTextArea(
                "There are too many unique values to generate this list. You will not be able to filter on this column. ");
        label.setOpaque(false);// w w w  .  jav a 2  s .co  m
        label.setLineWrap(true);
        label.setWrapStyleWord(true);

        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.insets = new Insets(3, 3, 3, 3);
        add(label, gbc);
        this.showViewCard();
        return;
    }

    applyButton = new JButton("Apply");
    applyButton.setEnabled(false);

    AbstractListModel model = new SimpleListModel();

    field = new QuickListFilterField(model);
    field.setHintText("Type here to filter options");

    // the width of the field has to be less than the width
    // provided to the filter, otherwise, it will push the grid wider
    // and components will be inaccessible
    field.setPreferredSize(new Dimension(FIELD_WIDTH, 22));

    filterableList = new FilterableCheckBoxList(field.getDisplayListModel()) {
        @Override
        public int getNextMatch(String prefix, int startIndex, Position.Bias bias) {
            return -1;
        }

        @Override
        public boolean isCheckBoxEnabled(int index) {
            return true;
        }
    };
    filterableList.getCheckBoxListSelectionModel()
            .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    if (model.getSize() > 0) {
        filterableList.setPrototypeCellValue(model.getElementAt(0)); // Makes it much faster to determine the view's preferred size.
    }

    SearchableUtils.installSearchable(filterableList);

    filterableList.getCheckBoxListSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                applyButton.setEnabled(true);
            }
        }
    });

    setAllSelected(true);

    applyButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            applyFilter();
        }
    });

    JScrollPane jsp = new JScrollPane(filterableList) {
        @Override
        public Dimension getPreferredSize() {
            Dimension result = super.getPreferredSize();
            result = new Dimension(Math.min(result.width, TabularFilterView.this.getWidth() - 20),
                    result.height);
            return result;
        }
    };

    selectAll = ViewUtil.createHyperLinkButton("Select All");
    selectAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setAllSelected(true);
            applyButton.setEnabled(true);
        }
    });

    JButton selectNone = ViewUtil.createHyperLinkButton("Select None");

    selectNone.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setAllSelected(false);
            applyButton.setEnabled(true);
        }
    });

    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 15, 3, 15);
    add(field, gbc);

    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(3, 3, 3, 3);
    add(jsp, gbc);

    gbc.gridwidth = 1;
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    add(selectAll, gbc);
    add(selectNone, gbc);

    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.EAST;
    add(applyButton, gbc);

    this.showViewCard();

}

From source file:org.ut.biolab.medsavant.client.view.component.SelectableListView.java

protected final void initContentPanel() {

    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    if (availableValues == null) {
        JTextArea label = new JTextArea("There are too many values to display.");
        label.setOpaque(false);//from ww w . j  a v a2 s .co  m
        label.setLineWrap(true);
        label.setWrapStyleWord(true);

        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.insets = new Insets(3, 3, 3, 3);
        add(label, gbc);
        return;
    }

    AbstractListModel model = new SelectableListView.SimpleListModel();

    field = new QuickListFilterField(model);
    field.setHintText("Type here to filter options");

    // the width of the field has to be less than the width
    // provided to the filter, otherwise, it will push the grid wider
    // and components will be inaccessible
    field.setPreferredSize(new Dimension(FIELD_WIDTH, 22));

    filterableList = new FilterableCheckBoxList(field.getDisplayListModel()) {
        @Override
        public int getNextMatch(String prefix, int startIndex, Position.Bias bias) {
            return -1;
        }

        @Override
        public boolean isCheckBoxEnabled(int index) {
            return true;
        }
    };
    filterableList.getCheckBoxListSelectionModel()
            .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    if (model.getSize() > 0) {
        filterableList.setPrototypeCellValue(model.getElementAt(0)); // Makes it much faster to determine the view's preferred size.
    }

    SearchableUtils.installSearchable(filterableList);

    setAllSelected(true);

    JScrollPane jsp = new JScrollPane(filterableList) {
        @Override
        public Dimension getPreferredSize() {
            Dimension result = super.getPreferredSize();
            result = new Dimension(Math.min(result.width, SelectableListView.this.getWidth() - 20),
                    result.height);
            return result;
        }
    };

    selectAll = ViewUtil.createHyperLinkButton("Select All");
    selectAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setAllSelected(true);
        }
    });

    JButton selectNone = ViewUtil.createHyperLinkButton("Select None");

    selectNone.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setAllSelected(false);
        }
    });

    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 15, 3, 15);
    add(field, gbc);

    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(3, 3, 3, 3);
    add(jsp, gbc);

    gbc.gridwidth = 1;
    gbc.weightx = 0.0;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    JPanel bottom = new JPanel();
    ViewUtil.applyHorizontalBoxLayout(bottom);

    bottom.add(selectAll);
    bottom.add(selectNone);
    bottom.add(Box.createHorizontalGlue());

    JButton applyButton = new JButton("Apply");
    applyButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            saveSelections();
        }

    });
    bottom.add(applyButton);
    add(bottom, gbc);
}

From source file:pcgen.gui2.dialog.AboutDialog.java

/**
 * Build up a scrollable list of monkeys, given the monkey names.
 * @param monkeys The names of the monkeys
 * @return A JScrollPane to display the monkeys.
 *///from w w w . j  av  a 2  s. c  o m
private JScrollPane buildMonkeyList(String monkeys) {
    JTextArea textArea = new JTextArea();
    JScrollPane scroller = new JScrollPane();

    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    textArea.setEditable(false);
    textArea.setText(monkeys);
    scroller.setViewportView(textArea);
    textArea.setCaretPosition(0);

    return scroller;
}

From source file:pcgen.gui2.dialog.AboutDialog.java

/**
 * Construct the includes panel. This panel shows details
 * and licencing statrements about any libraries distributed
 * with PCGen./*from w  ww  .  j ava 2s. c  o  m*/
 *
 * @return The includes panel.
 */
private JPanel buildIncludesPanel() {
    JPanel iPanel = new JPanel();

    JTextArea otherLibrariesField = new JTextArea();

    iPanel.setLayout(new BorderLayout());

    String s = LanguageBundle.getString("in_abt_lib_apache"); //$NON-NLS-1$
    s += LanguageBundle.getString("in_abt_lib_jdom"); //$NON-NLS-1$
    s += LanguageBundle.getString("in_abt_lib_l2f"); //$NON-NLS-1$
    otherLibrariesField.setText(s);
    otherLibrariesField.setWrapStyleWord(true);
    otherLibrariesField.setLineWrap(true);
    otherLibrariesField.setEditable(false);
    otherLibrariesField.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    iPanel.add(otherLibrariesField, BorderLayout.CENTER);

    return iPanel;
}