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;
}
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;
}
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;
}
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()));
}
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();
}
Aggregations