Search in sources :

Example 16 with JTextArea

use of javax.swing.JTextArea in project neo4j by neo4j.

the class ScrollableOptionPane method createWrappingScrollPane.

private static JScrollPane createWrappingScrollPane(String message) {
    JTextArea view = new JTextArea(message, 10, 80);
    view.setLineWrap(true);
    view.setEditable(false);
    view.setWrapStyleWord(true);
    return new JScrollPane(view);
}
Also used : JScrollPane(javax.swing.JScrollPane) JTextArea(javax.swing.JTextArea)

Example 17 with JTextArea

use of javax.swing.JTextArea in project pcgen by PCGen.

the class RunConvertPanel method getMessageArea.

/**
	 * This method initializes messageArea
	 *
	 * @return javax.swing.JTextArea
	 */
private JTextArea getMessageArea() {
    if (messageArea == null) {
        messageArea = new JTextArea();
        messageArea.setName("errorMessageBox");
        messageArea.setEditable(false);
        messageArea.setTabSize(8);
    }
    return messageArea;
}
Also used : JTextArea(javax.swing.JTextArea)

Example 18 with JTextArea

use of javax.swing.JTextArea in project pcgen by PCGen.

the class SummaryPanel method setupDisplay.

/**
	 * @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
	 */
@Override
public void setupDisplay(JPanel panel, CDOMObject pc) {
    panel.setLayout(new GridBagLayout());
    JLabel introLabel = new JLabel("Ready to convert.");
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
    gbc.insets = new Insets(50, 25, 10, 25);
    panel.add(introLabel, gbc);
    JLabel instructLabel = new JLabel("Press Next to begin converting using the following settings:");
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
    gbc.insets = new Insets(10, 25, 20, 25);
    panel.add(instructLabel, gbc);
    JLabel[] labels = new JLabel[4];
    JComponent[] values = new JComponent[4];
    labels[0] = new JLabel("Source Folder:");
    labels[1] = new JLabel("Destination Folder:");
    labels[2] = new JLabel("Game mode:");
    labels[3] = new JLabel("Sources:");
    values[0] = new JLabel(pc.get(ObjectKey.DIRECTORY).getAbsolutePath());
    values[1] = new JLabel(pc.get(ObjectKey.WRITE_DIRECTORY).getAbsolutePath());
    values[2] = new JLabel(pc.get(ObjectKey.GAME_MODE).getDisplayName());
    List<Campaign> campaigns = pc.getSafeListFor(ListKey.CAMPAIGN);
    StringBuilder campDisplay = new StringBuilder();
    for (int i = 0; i < campaigns.size(); i++) {
        campDisplay.append(campaigns.get(i).getDisplayName());
        campDisplay.append("\n");
    }
    JTextArea campText = new JTextArea(campDisplay.toString());
    campText.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(campText);
    values[3] = scrollPane;
    // Place the labels on the page and lay them out
    Font plainFont = FontManipulation.plain(panel.getFont());
    for (int i = 0; i < labels.length; i++) {
        Utility.buildRelativeConstraints(gbc, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
        gbc.insets = new Insets(10, 25, 10, 10);
        panel.add(labels[i], gbc);
        if (i < labels.length - 1) {
            Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
        } else {
            Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
        }
        gbc.insets = new Insets(10, 10, 10, 25);
        panel.add(values[i], gbc);
        values[i].setFont(plainFont);
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) GridBagLayout(java.awt.GridBagLayout) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) Font(java.awt.Font) Campaign(pcgen.core.Campaign)

Example 19 with JTextArea

use of javax.swing.JTextArea in project pcgen by PCGen.

the class DIWarningDialog method initComponents.

/**
	 * Initialises the user interface.
	 */
private void initComponents() {
    setLayout(new GridBagLayout());
    JLabel introLabel = new JLabel(introText);
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(10, 10, 5, 10);
    add(introLabel, gbc);
    JTextArea messageArea = new JTextArea();
    messageArea.setName("errorMessageBox");
    messageArea.setEditable(false);
    messageArea.setTabSize(8);
    messageArea.setText(fileText);
    JScrollPane messageAreaContainer = new JScrollPane(messageArea);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 1.0);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(5, 10, 5, 10);
    add(messageAreaContainer, gbc);
    JLabel dummy = new JLabel(" ");
    Utility.buildRelativeConstraints(gbc, 1, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    add(dummy, gbc);
    JButton yesButton = new JButton(LanguageBundle.getString("in_yes"));
    yesButton.setActionCommand(ACTION_YES);
    yesButton.addActionListener(this);
    Utility.buildRelativeConstraints(gbc, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.EAST);
    gbc.insets = new Insets(5, 5, 10, 5);
    add(yesButton, gbc);
    JButton noButton = new JButton(LanguageBundle.getString("in_no"));
    noButton.setActionCommand(ACTION_NO);
    noButton.addActionListener(this);
    Utility.buildRelativeConstraints(gbc, 1, 1, 0.0, 0.0, GridBagConstraints.NONE, GridBagConstraints.EAST);
    add(noButton, gbc);
    JButton cancelButton = new JButton(LanguageBundle.getString("in_cancel"));
    cancelButton.setActionCommand(ACTION_CANCEL);
    cancelButton.addActionListener(this);
    getRootPane().setDefaultButton(cancelButton);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
    gbc.insets = new Insets(5, 5, 10, 10);
    add(cancelButton, gbc);
    pack();
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            result = JOptionPane.CANCEL_OPTION;
            setVisible(false);
        }
    });
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JTextArea(javax.swing.JTextArea) GridBagLayout(java.awt.GridBagLayout) WindowEvent(java.awt.event.WindowEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter)

Example 20 with JTextArea

use of javax.swing.JTextArea in project pcgen by PCGen.

the class MainAbout method buildAwardsPanel.

/**
	 * Construct the awards panel. This panel shows each award
	 * the pcgen project has been awarded
	 *
	 * @return The awards panel.
	 */
private JPanel buildAwardsPanel() {
    JScrollPane sp = new JScrollPane();
    JPanel panel = new JPanel();
    JPanel aPanel = new JPanel();
    aPanel.setLayout(new GridBoxLayout(2, 2));
    aPanel.setBackground(Color.WHITE);
    Icon goldIcon = Icons.createImageIcon("gold200x200-2005.gif");
    if (goldIcon != null) {
        JLabel e2005 = new JLabel(goldIcon);
        aPanel.add(e2005);
        JTextArea title = new JTextArea();
        title.setLineWrap(true);
        title.setWrapStyleWord(true);
        title.setEditable(false);
        title.setText(LanguageBundle.getString("in_abt_awards_2005_ennie"));
        aPanel.add(title);
    }
    Icon bronzeIcon = Icons.createImageIcon("bronze200x200-2003.gif");
    if (bronzeIcon != null) {
        JLabel e2003 = new JLabel(bronzeIcon);
        aPanel.add(e2003);
        JTextArea title = new JTextArea();
        title.setLineWrap(true);
        title.setWrapStyleWord(true);
        title.setEditable(false);
        title.setText(LanguageBundle.getString("in_abt_awards_2003_ennie"));
        aPanel.add(title);
    }
    sp.setViewportView(aPanel);
    panel.add(sp, BorderLayout.CENTER);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) JLabel(javax.swing.JLabel) Icon(javax.swing.Icon) GridBoxLayout(pcgen.gui2.util.GridBoxLayout)

Aggregations

JTextArea (javax.swing.JTextArea)182 JScrollPane (javax.swing.JScrollPane)104 JPanel (javax.swing.JPanel)79 BorderLayout (java.awt.BorderLayout)60 JButton (javax.swing.JButton)59 JLabel (javax.swing.JLabel)59 Dimension (java.awt.Dimension)36 JTextField (javax.swing.JTextField)35 JFrame (javax.swing.JFrame)33 ActionEvent (java.awt.event.ActionEvent)26 Font (java.awt.Font)24 GridBagLayout (java.awt.GridBagLayout)23 GridBagConstraints (java.awt.GridBagConstraints)22 Insets (java.awt.Insets)22 ActionListener (java.awt.event.ActionListener)21 FlowLayout (java.awt.FlowLayout)20 Color (java.awt.Color)18 JCheckBox (javax.swing.JCheckBox)18 JSplitPane (javax.swing.JSplitPane)16 EmptyBorder (javax.swing.border.EmptyBorder)16