Search in sources :

Example 51 with GroupLayout

use of javax.swing.GroupLayout in project zaproxy by zaproxy.

the class DialogAddDomainAlwaysInScope method getFieldsPanel.

@Override
protected JPanel getFieldsPanel() {
    JPanel fieldsPanel = new JPanel();
    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    JLabel domainLabel = new JLabel(DOMAIN_FIELD_LABEL);
    JLabel regexLabel = new JLabel(REGEX_FIELD_LABEL);
    JLabel enabledLabel = new JLabel(ENABLED_FIELD_LABEL);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(domainLabel).addComponent(enabledLabel).addComponent(regexLabel)).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(getDomainTextField()).addComponent(getEnabledCheckBox()).addComponent(getRegexCheckBox())));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(domainLabel).addComponent(getDomainTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(regexLabel).addComponent(getRegexCheckBox())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(enabledLabel).addComponent(getEnabledCheckBox())));
    return fieldsPanel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Example 52 with GroupLayout

use of javax.swing.GroupLayout in project zaproxy by zaproxy.

the class DialogAddProxyExcludedDomain method getFieldsPanel.

@Override
protected JPanel getFieldsPanel() {
    JPanel fieldsPanel = new JPanel();
    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    JLabel domainLabel = new JLabel(DOMAIN_FIELD_LABEL);
    JLabel regexLabel = new JLabel(REGEX_FIELD_LABEL);
    JLabel enabledLabel = new JLabel(ENABLED_FIELD_LABEL);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(domainLabel).addComponent(enabledLabel).addComponent(regexLabel)).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(getDomainTextField()).addComponent(getEnabledCheckBox()).addComponent(getRegexCheckBox())));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(domainLabel).addComponent(getDomainTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(regexLabel).addComponent(getRegexCheckBox())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(enabledLabel).addComponent(getEnabledCheckBox())));
    return fieldsPanel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Example 53 with GroupLayout

use of javax.swing.GroupLayout in project zaproxy by zaproxy.

the class DialogAddToken method getFieldsPanel.

@Override
protected JPanel getFieldsPanel() {
    JPanel fieldsPanel = new JPanel();
    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    JLabel nameLabel = new JLabel(NAME_FIELD_LABEL);
    JLabel enabledLabel = new JLabel(ENABLED_FIELD_LABEL);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(nameLabel).addComponent(enabledLabel)).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(getNameTextField()).addComponent(getEnabledCheckBox())));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(nameLabel).addComponent(getNameTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(enabledLabel).addComponent(getEnabledCheckBox())));
    return fieldsPanel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Example 54 with GroupLayout

use of javax.swing.GroupLayout in project JMRI by JMRI.

the class StartupActionsPreferencesPanel method initComponents.

/**
     * This method is called from within the constructor to performAction the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    actionsMenu = new JPopupMenu();
    jScrollPane1 = new JScrollPane();
    actionsTbl = new JTable() {

        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            try {
                return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
            } catch (RuntimeException e1) {
            //catch null pointer exception if mouse is over an empty line
            }
            return null;
        }
    };
    addBtn = new JButton();
    removeBtn = new JButton();
    startupLbl = new JLabel();
    upBtn = new JButton();
    downBtn = new JButton();
    moveLbl = new JLabel();
    recommendationsLbl = new JLabel();
    actionsTbl.setDefaultRenderer(StartupModel.class, new StartupModelCellRenderer());
    actionsTbl.setDefaultEditor(StartupModel.class, new StartupModelCellEditor());
    actionsTbl.setModel(new TableModel(InstanceManager.getDefault(StartupActionsManager.class)));
    actionsTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    actionsTbl.getTableHeader().setReorderingAllowed(false);
    jScrollPane1.setViewportView(actionsTbl);
    actionsTbl.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // NOI18N
    ResourceBundle bundle = ResourceBundle.getBundle("apps/startup/Bundle");
    // NOI18N
    addBtn.setText(bundle.getString("StartupActionsPreferencesPanel.addBtn.text"));
    addBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            addBtnActionPerformed(evt);
        }
    });
    // NOI18N
    removeBtn.setText(bundle.getString("StartupActionsPreferencesPanel.removeBtn.text"));
    removeBtn.setEnabled(false);
    removeBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            removeBtnActionPerformed(evt);
        }
    });
    // NOI18N
    startupLbl.setText(bundle.getString("StartupActionsPreferencesPanel.startupLbl.text"));
    // NOI18N
    upBtn.setText(bundle.getString("StartupActionsPreferencesPanel.upBtn.text"));
    upBtn.setEnabled(false);
    upBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            upBtnActionPerformed(evt);
        }
    });
    // NOI18N
    downBtn.setText(bundle.getString("StartupActionsPreferencesPanel.downBtn.text"));
    downBtn.setEnabled(false);
    downBtn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            downBtnActionPerformed(evt);
        }
    });
    // NOI18N
    moveLbl.setText(bundle.getString("StartupActionsPreferencesPanel.moveLbl.text"));
    // NOI18N
    recommendationsLbl.setText(bundle.getString("StartupActionsPreferencesPanel.recommendationsLbl.text"));
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(recommendationsLbl).addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(addBtn).addGap(18, 18, 18).addComponent(moveLbl).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(upBtn).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(downBtn).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(removeBtn)).addComponent(startupLbl)).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(startupLbl, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(recommendationsLbl, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(addBtn).addComponent(removeBtn).addComponent(upBtn).addComponent(downBtn).addComponent(moveLbl)).addContainerGap()));
}
Also used : JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JPopupMenu(javax.swing.JPopupMenu) ActionListener(java.awt.event.ActionListener) JTable(javax.swing.JTable) GroupLayout(javax.swing.GroupLayout) ResourceBundle(java.util.ResourceBundle) AbstractTableModel(javax.swing.table.AbstractTableModel)

Example 55 with GroupLayout

use of javax.swing.GroupLayout in project JMRI by JMRI.

the class WebServerPreferencesPanel method initComponents.

private void initComponents() {
    bindingGroup = new BindingGroup();
    port = new JSpinner();
    portLabel = new JLabel();
    readonlyPower = new JCheckBox();
    startup = new JCheckBox();
    port.setModel(new SpinnerNumberModel(12080, 1, 65535, 1));
    port.setEditor(new JSpinner.NumberEditor(port, "#"));
    // NOI18N
    port.setToolTipText(Bundle.getMessage("ToolTipPort"));
    Binding binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, preferences, ELProperty.create("${port}"), port, BeanProperty.create("value"));
    bindingGroup.addBinding(binding);
    // NOI18N
    portLabel.setText(Bundle.getMessage("LabelPort"));
    // NOI18N
    portLabel.setToolTipText(Bundle.getMessage("ToolTipPort"));
    // NOI18N
    readonlyPower.setText(Bundle.getMessage("LabelReadonlyPower"));
    readonlyPower.addActionListener((ActionEvent e) -> {
        readonlyPower.setToolTipText(Bundle.getMessage(readonlyPower.isSelected() ? "ToolTipReadonlyPowerTrue" : "ToolTipReadonlyPowerFalse"));
    });
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, preferences, ELProperty.create("${readonlyPower}"), readonlyPower, BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    startup.setSelected(this.isStartupAction());
    // NOI18N
    startup.setText(Bundle.getMessage("LabelStartup"));
    this.startupItemListener = (ItemEvent e) -> {
        this.startup.removeItemListener(this.startupItemListener);
        StartupActionsManager manager = InstanceManager.getDefault(StartupActionsManager.class);
        if (this.startup.isSelected()) {
            PerformActionModel model = new PerformActionModel();
            model.setClassName(WebServerAction.class.getName());
            if (this.startupActionPosition == -1 || this.startupActionPosition >= manager.getActions().length) {
                manager.addAction(model);
            } else {
                manager.setActions(this.startupActionPosition, model);
            }
        } else {
            manager.getActions(PerformActionModel.class).stream().filter((model) -> (WebServerAction.class.getName().equals(model.getClassName()))).forEach((model) -> {
                this.startupActionPosition = Arrays.asList(manager.getActions()).indexOf(model);
                manager.removeAction(model);
            });
        }
        this.startup.addItemListener(this.startupItemListener);
    };
    this.startup.addItemListener(this.startupItemListener);
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(port, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(portLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addComponent(startup, GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE).addComponent(readonlyPower, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(port, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(portLabel)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(readonlyPower).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(startup).addContainerGap(198, Short.MAX_VALUE)));
    bindingGroup.bind();
}
Also used : AutoBinding(org.jdesktop.beansbinding.AutoBinding) Binding(org.jdesktop.beansbinding.Binding) PerformActionModel(apps.PerformActionModel) JComponent(javax.swing.JComponent) ItemEvent(java.awt.event.ItemEvent) InstanceManager(jmri.InstanceManager) BeanProperty(org.jdesktop.beansbinding.BeanProperty) Arrays(java.util.Arrays) JSpinner(javax.swing.JSpinner) SpinnerNumberModel(javax.swing.SpinnerNumberModel) Bindings(org.jdesktop.beansbinding.Bindings) ItemListener(java.awt.event.ItemListener) StartupActionsManager(apps.StartupActionsManager) ActionEvent(java.awt.event.ActionEvent) AutoBinding(org.jdesktop.beansbinding.AutoBinding) LayoutStyle(javax.swing.LayoutStyle) PerformActionModel(apps.PerformActionModel) BindingGroup(org.jdesktop.beansbinding.BindingGroup) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) JCheckBox(javax.swing.JCheckBox) ELProperty(org.jdesktop.beansbinding.ELProperty) Binding(org.jdesktop.beansbinding.Binding) JPanel(javax.swing.JPanel) PreferencesPanel(jmri.swing.PreferencesPanel) ItemEvent(java.awt.event.ItemEvent) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) StartupActionsManager(apps.StartupActionsManager) JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) BindingGroup(org.jdesktop.beansbinding.BindingGroup) GroupLayout(javax.swing.GroupLayout) JSpinner(javax.swing.JSpinner)

Aggregations

GroupLayout (javax.swing.GroupLayout)61 JPanel (javax.swing.JPanel)43 JLabel (javax.swing.JLabel)36 JButton (javax.swing.JButton)17 JScrollPane (javax.swing.JScrollPane)11 ActionEvent (java.awt.event.ActionEvent)9 ActionListener (java.awt.event.ActionListener)9 JCheckBox (javax.swing.JCheckBox)9 JTextField (javax.swing.JTextField)9 AfterInjection (org.baderlab.csplugins.enrichmentmap.AfterInjection)8 JFormattedTextField (javax.swing.JFormattedTextField)6 Dimension (java.awt.Dimension)5 JTable (javax.swing.JTable)5 Color (java.awt.Color)4 JRadioButton (javax.swing.JRadioButton)4 JSpinner (javax.swing.JSpinner)4 SpinnerNumberModel (javax.swing.SpinnerNumberModel)4 MouseEvent (java.awt.event.MouseEvent)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)3 Arrays (java.util.Arrays)3