Search in sources :

Example 26 with JPanel

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

the class PortraitInfoPane method initComponents.

private void initComponents() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildConstraints(gbc, 0, 0, 2, 1, 0, 0);
    panel.add(new JLabel(LanguageBundle.getString("in_largePortrait")), gbc);
    Utility.buildConstraints(gbc, 0, 1, 2, 1, 0, 0);
    panel.add(portraitPane, gbc);
    Utility.buildConstraints(gbc, 0, 2, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
    panel.add(loadButton, gbc);
    Utility.buildConstraints(gbc, 1, 2, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
    panel.add(clearButton, gbc);
    Utility.buildConstraints(gbc, 2, 1, 1, 1, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
    zoomSlider.setInverted(true);
    zoomSlider.setPreferredSize(new Dimension(20, 10));
    panel.add(zoomSlider, gbc);
    Utility.buildConstraints(gbc, 3, 0, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    panel.add(new JLabel(LanguageBundle.getString("in_thumbnailPortrait")), gbc);
    Utility.buildConstraints(gbc, 3, 1, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTH);
    panel.add(tnPane, gbc);
    this.setViewportView(panel);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 27 with JPanel

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

the class CompanionInfoTab method initComponents.

private void initComponents() {
    {
        DefaultTableColumnModel model = new DefaultTableColumnModel();
        TableColumn column = new TableColumn(0);
        column.setResizable(true);
        model.addColumn(column);
        column = new TableColumn(1, 120, new ButtonCellRenderer(), null);
        column.setMaxWidth(120);
        column.setResizable(false);
        model.addColumn(column);
        companionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        companionsTable.getTableHeader().setResizingAllowed(false);
        companionsTable.setAutoCreateColumnsFromModel(false);
        companionsTable.setColumnModel(model);
    }
    companionsTable.setIntercellSpacing(new Dimension(0, 0));
    companionsTable.setFocusable(false);
    companionsTable.setRowHeight(23);
    companionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    setLeftComponent(new JScrollPane(companionsTable));
    JPanel rightPane = new JPanel(new BorderLayout());
    infoPane.setOpaque(false);
    infoPane.setEditable(false);
    infoPane.setFocusable(true);
    //$NON-NLS-1$
    infoPane.setContentType("text/html");
    rightPane.add(new JScrollPane(infoPane), BorderLayout.CENTER);
    JPanel buttonPane = new JPanel(new FlowLayout());
    buttonPane.add(loadButton);
    rightPane.add(buttonPane, BorderLayout.SOUTH);
    setRightComponent(rightPane);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) DefaultTableColumnModel(javax.swing.table.DefaultTableColumnModel) BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn)

Example 28 with JPanel

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

the class SplashScreen method initComponents.

private void initComponents() {
    JComponent pane = new JPanel(new BorderLayout());
    pane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));
    Component splashLabel = new JLabel(Icons.SplashPcgen_Ennie.getImageIcon());
    pane.add(splashLabel, BorderLayout.NORTH);
    loadingLabel.setBorder(BorderFactory.createEmptyBorder(10, 7, 10, 10));
    pane.add(loadingLabel, BorderLayout.CENTER);
    loadProgress.setStringPainted(true);
    pane.add(loadProgress, BorderLayout.SOUTH);
    Container cont = getContentPane();
    cont.setLayout(new GridLayout(1, 1));
    cont.add(pane);
    pack();
    setLocationRelativeTo(null);
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 29 with JPanel

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

the class PCGenFrame method buildMessageLabelPanel.

//TODO: This should be in a utility class.
/**
	 * Builds a JPanel containing the supplied message, split at each new
	 * line and an optional checkbox, suitable for use in a showMessageDialog
	 * call. This is generally useful for showing messges which can turned
	 * off either in preferences or when they are displayed.
	 *
	 * @param message The message to be displayed.
	 * @param checkbox The optional checkbox to be added - may be null.
	 * @return JPanel A panel containing the message and the checkbox.
	 */
public static JPanel buildMessageLabelPanel(String message, JCheckBox checkbox) {
    JPanel panel = new JPanel();
    JLabel label;
    String part;
    panel.setLayout(new GridBagLayout());
    GridBagConstraints cons = new GridBagConstraints();
    cons.gridx = cons.gridy = 0;
    cons.gridwidth = GridBagConstraints.REMAINDER;
    cons.gridheight = 1;
    cons.anchor = GridBagConstraints.WEST;
    cons.insets = new Insets(0, 0, 3, 0);
    cons.weightx = 1;
    cons.weighty = 0;
    cons.fill = GridBagConstraints.NONE;
    int start = 0;
    int sepPos = -1;
    do {
        //$NON-NLS-1$
        sepPos = message.indexOf("\n", start);
        if (sepPos >= 0) {
            part = message.substring(start, sepPos);
            start = sepPos + 1;
        } else {
            part = message.substring(start);
            start = -1;
        }
        label = new JLabel(part, SwingConstants.LEADING);
        panel.add(label, cons);
        cons.gridy++;
    } while (start >= 0);
    if (checkbox != null) {
        //$NON-NLS-1$
        label = new JLabel("", SwingConstants.LEADING);
        panel.add(label, cons);
        cons.gridy++;
        panel.add(checkbox, cons);
        cons.gridy++;
    }
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel)

Example 30 with JPanel

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

the class PCGenFrame method showMatureDialog.

private void showMatureDialog(String text) {
    Logging.errorPrint("Warning: The following datasets contains mature themes. User discretion is advised.");
    Logging.errorPrint(text);
    final JDialog aFrame = new JDialog(this, LanguageBundle.getString("in_matureTitle"), true);
    final JPanel jPanel1 = new JPanel();
    final JPanel jPanel3 = new JPanel();
    final JLabel jLabel1 = new //$NON-NLS-1$
    JLabel(//$NON-NLS-1$
    LanguageBundle.getString("in_matureWarningLine1"), SwingConstants.CENTER);
    final JLabel jLabel2 = new //$NON-NLS-1$
    JLabel(//$NON-NLS-1$
    LanguageBundle.getString("in_matureWarningLine2"), SwingConstants.CENTER);
    //$NON-NLS-1$
    final JCheckBox jCheckBox1 = new JCheckBox(LanguageBundle.getString("in_licShowOnLoad"));
    //$NON-NLS-1$
    final JButton jClose = new JButton(LanguageBundle.getString("in_close"));
    //$NON-NLS-1$
    jClose.setMnemonic(LanguageBundle.getMnemonic("in_mn_close"));
    jPanel1.setLayout(new BorderLayout());
    jPanel1.add(jLabel1, BorderLayout.NORTH);
    jPanel1.add(jLabel2, BorderLayout.SOUTH);
    HtmlPanel htmlPanel = new HtmlPanel();
    HtmlRendererContext theRendererContext = new SimpleHtmlRendererContext(htmlPanel, new SimpleUserAgentContext());
    htmlPanel.setHtml(text, "", theRendererContext);
    jPanel3.add(jCheckBox1);
    jPanel3.add(jClose);
    final PropertyContext context = PCGenSettings.OPTIONS_CONTEXT;
    jCheckBox1.setSelected(context.getBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD));
    jClose.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            aFrame.dispose();
        }
    });
    jCheckBox1.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            context.setBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD, jCheckBox1.isSelected());
        }
    });
    aFrame.getContentPane().setLayout(new BorderLayout());
    aFrame.getContentPane().add(jPanel1, BorderLayout.NORTH);
    aFrame.getContentPane().add(htmlPanel, BorderLayout.CENTER);
    aFrame.getContentPane().add(jPanel3, BorderLayout.SOUTH);
    aFrame.setSize(new Dimension(456, 176));
    Utility.setComponentRelativeLocation(this, aFrame);
    aFrame.setVisible(true);
}
Also used : SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) HtmlRendererContext(org.lobobrowser.html.HtmlRendererContext) SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) SimpleUserAgentContext(org.lobobrowser.html.test.SimpleUserAgentContext) Dimension(java.awt.Dimension) JCheckBox(javax.swing.JCheckBox) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) HtmlPanel(org.lobobrowser.html.gui.HtmlPanel) PropertyContext(pcgen.system.PropertyContext) ItemListener(java.awt.event.ItemListener) JDialog(javax.swing.JDialog)

Aggregations

JPanel (javax.swing.JPanel)4464 JLabel (javax.swing.JLabel)1842 BorderLayout (java.awt.BorderLayout)1454 JButton (javax.swing.JButton)1174 Dimension (java.awt.Dimension)1097 GridBagLayout (java.awt.GridBagLayout)1071 ActionEvent (java.awt.event.ActionEvent)1013 GridBagConstraints (java.awt.GridBagConstraints)954 JScrollPane (javax.swing.JScrollPane)901 ActionListener (java.awt.event.ActionListener)865 BoxLayout (javax.swing.BoxLayout)792 Insets (java.awt.Insets)724 FlowLayout (java.awt.FlowLayout)667 JTextField (javax.swing.JTextField)532 JCheckBox (javax.swing.JCheckBox)456 GridLayout (java.awt.GridLayout)375 JComboBox (javax.swing.JComboBox)268 EmptyBorder (javax.swing.border.EmptyBorder)252 JTable (javax.swing.JTable)224 Color (java.awt.Color)210