Search in sources :

Example 1 with JCheckBox

use of javax.swing.JCheckBox in project buck by facebook.

the class BuckSettingsUI method init.

private void init() {
    setLayout(new BorderLayout());
    JPanel container = this;
    buckPathField = new TextFieldWithBrowseButton();
    FileChooserDescriptor buckFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
    buckPathField.addBrowseFolderListener("", "Buck Executable Path", null, buckFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
    adbPathField = new TextFieldWithBrowseButton();
    FileChooserDescriptor adbFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
    adbPathField.addBrowseFolderListener("", "Adb Executable Path", null, adbFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
    customizedInstallSettingField = new JBTextField();
    customizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_FLAGS_HINT);
    customizedInstallSettingField.setEnabled(false);
    showDebug = new JCheckBox("Show debug in tool window");
    enableAutoDeps = new JCheckBox("Enable auto dependencies");
    runAfterInstall = new JCheckBox("Run after install (-r)");
    multiInstallMode = new JCheckBox("Multi-install mode (-x)");
    uninstallBeforeInstall = new JCheckBox("Uninstall before installing (-u)");
    customizedInstallSetting = new JCheckBox("Use customized install setting:  ");
    initCustomizedInstallCommandListener();
    JPanel buckSettings = new JPanel(new GridBagLayout());
    buckSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Settings", true));
    container.add(container = new JPanel(new BorderLayout()), BorderLayout.NORTH);
    container.add(buckSettings, BorderLayout.NORTH);
    final GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    buckSettings.add(new JLabel("Buck Executable Path:"), constraints);
    constraints.gridx = 1;
    constraints.weightx = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    buckSettings.add(buckPathField, constraints);
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.weightx = 1;
    buckSettings.add(new JLabel("Adb Executable Path:"), constraints);
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.weightx = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    buckSettings.add(adbPathField, constraints);
    constraints.gridx = 0;
    constraints.gridy = 2;
    buckSettings.add(showDebug, constraints);
    constraints.gridx = 0;
    constraints.gridy = 3;
    buckSettings.add(enableAutoDeps, constraints);
    JPanel installSettings = new JPanel(new BorderLayout());
    installSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Install Settings", true));
    container.add(container = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    container.add(installSettings, BorderLayout.NORTH);
    installSettings.add(runAfterInstall, BorderLayout.NORTH);
    installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    installSettings.add(multiInstallMode, BorderLayout.NORTH);
    installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    installSettings.add(uninstallBeforeInstall, BorderLayout.NORTH);
    installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    final GridBagConstraints customConstraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    JPanel customizedInstallSetting = new JPanel(new GridBagLayout());
    customizedInstallSetting.add(this.customizedInstallSetting, customConstraints);
    customConstraints.gridx = 1;
    customConstraints.weightx = 1;
    customConstraints.fill = GridBagConstraints.HORIZONTAL;
    customizedInstallSetting.add(customizedInstallSettingField, customConstraints);
    installSettings.add(customizedInstallSetting, BorderLayout.NORTH);
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) JLabel(javax.swing.JLabel) JBTextField(com.intellij.ui.components.JBTextField)

Example 2 with JCheckBox

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

the class PCGenFrame method maybeShowWarningConfirm.

@Override
public Boolean maybeShowWarningConfirm(String title, String message, String checkBoxText, final PropertyContext context, final String contextProp) {
    if (!context.getBoolean(contextProp, true)) {
        return null;
    }
    final JCheckBox checkBox = new JCheckBox(checkBoxText, true);
    checkBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            context.setBoolean(contextProp, checkBox.isSelected());
        }
    });
    JPanel panel = buildMessageLabelPanel(message, checkBox);
    int ret = JOptionPane.showConfirmDialog(this, panel, title, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
    return ret == JOptionPane.YES_OPTION;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 3 with JCheckBox

use of javax.swing.JCheckBox 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)

Example 4 with JCheckBox

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

the class PCGenFrame method showLicenseDialog.

private void showLicenseDialog(String title, String htmlString) {
    if (htmlString == null) {
        //$NON-NLS-1$
        htmlString = LanguageBundle.getString("in_licNoInfo");
    }
    final PropertyContext context = PCGenSettings.OPTIONS_CONTEXT;
    final JDialog aFrame = new JDialog(this, title, true);
    //$NON-NLS-1$
    final JButton jClose = new JButton(LanguageBundle.getString("in_close"));
    //$NON-NLS-1$
    jClose.setMnemonic(LanguageBundle.getMnemonic("in_mn_close"));
    final JPanel jPanel = new JPanel();
    //$NON-NLS-1$
    final JCheckBox jCheckBox = new JCheckBox(LanguageBundle.getString("in_licShowOnLoad"));
    jPanel.add(jCheckBox);
    jCheckBox.setSelected(context.getBoolean(PCGenSettings.OPTION_SHOW_LICENSE));
    jCheckBox.addItemListener(evt -> context.setBoolean(PCGenSettings.OPTION_SHOW_LICENSE, jCheckBox.isSelected()));
    jPanel.add(jClose);
    jClose.addActionListener(evt -> aFrame.dispose());
    HtmlPanel htmlPanel = new HtmlPanel();
    HtmlRendererContext theRendererContext = new SimpleHtmlRendererContext(htmlPanel, new SimpleUserAgentContext());
    htmlPanel.setHtml(htmlString, "", theRendererContext);
    aFrame.getContentPane().setLayout(new BorderLayout());
    aFrame.getContentPane().add(htmlPanel, BorderLayout.CENTER);
    aFrame.getContentPane().add(jPanel, BorderLayout.SOUTH);
    aFrame.setSize(new Dimension(700, 500));
    aFrame.setLocationRelativeTo(this);
    Utility.setComponentRelativeLocation(this, aFrame);
    aFrame.getRootPane().setDefaultButton(jClose);
    Utility.installEscapeCloseOperation(aFrame);
    aFrame.setVisible(true);
}
Also used : JCheckBox(javax.swing.JCheckBox) SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) HtmlRendererContext(org.lobobrowser.html.HtmlRendererContext) SimpleHtmlRendererContext(org.lobobrowser.html.test.SimpleHtmlRendererContext) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) PropertyContext(pcgen.system.PropertyContext) HtmlPanel(org.lobobrowser.html.gui.HtmlPanel) JButton(javax.swing.JButton) SimpleUserAgentContext(org.lobobrowser.html.test.SimpleUserAgentContext) Dimension(java.awt.Dimension) JDialog(javax.swing.JDialog)

Example 5 with JCheckBox

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

the class DisplayOptionsPanel method addDisplayOption.

private int addDisplayOption(final int line, final GridBagConstraints constraints, final GridBagLayout gridbag, final JPanel panel, final String labelText, final JComponent c) {
    if (c instanceof JCheckBox) {
        final JCheckBox checkbox = (JCheckBox) c;
        checkbox.setText(labelText);
        Utility.buildConstraints(constraints, 0, line, GridBagConstraints.REMAINDER, 1, 0, 0);
    } else {
        final JLabel label = new JLabel(labelText);
        Utility.buildConstraints(constraints, 0, line, 1, 1, 0, 0);
        panel.add(label, constraints);
        Utility.buildConstraints(constraints, 1, line, GridBagConstraints.REMAINDER, 1, 0, 0);
    }
    panel.add(c, constraints);
    return line + 1;
}
Also used : JCheckBox(javax.swing.JCheckBox) JLabel(javax.swing.JLabel)

Aggregations

JCheckBox (javax.swing.JCheckBox)909 JPanel (javax.swing.JPanel)406 JLabel (javax.swing.JLabel)341 ActionEvent (java.awt.event.ActionEvent)233 JButton (javax.swing.JButton)225 ActionListener (java.awt.event.ActionListener)215 JTextField (javax.swing.JTextField)201 GridBagConstraints (java.awt.GridBagConstraints)194 GridBagLayout (java.awt.GridBagLayout)183 Insets (java.awt.Insets)139 Dimension (java.awt.Dimension)125 BorderLayout (java.awt.BorderLayout)124 JComboBox (javax.swing.JComboBox)115 BoxLayout (javax.swing.BoxLayout)87 JScrollPane (javax.swing.JScrollPane)86 ItemEvent (java.awt.event.ItemEvent)71 ItemListener (java.awt.event.ItemListener)67 FlowLayout (java.awt.FlowLayout)63 JRadioButton (javax.swing.JRadioButton)56 ChangeEvent (javax.swing.event.ChangeEvent)54