use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class AlertAddDialog method getJPanel.
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
java.awt.GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
javax.swing.JLabel jLabel2 = new JLabel();
java.awt.GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
java.awt.GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
jPanel.setPreferredSize(new java.awt.Dimension(450, 650));
jPanel.setMinimumSize(new java.awt.Dimension(450, 650));
gridBagConstraints2.gridx = 1;
gridBagConstraints2.gridy = 5;
gridBagConstraints2.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints3.gridx = 2;
gridBagConstraints3.gridy = 5;
gridBagConstraints3.insets = new java.awt.Insets(2, 2, 2, 10);
gridBagConstraints3.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints13.gridx = 0;
gridBagConstraints13.gridy = 5;
gridBagConstraints13.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints13.weightx = 1.0D;
gridBagConstraints13.insets = new java.awt.Insets(2, 10, 2, 5);
gridBagConstraints15.weightx = 1.0D;
gridBagConstraints15.weighty = 1.0D;
gridBagConstraints15.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints15.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints15.gridwidth = 3;
gridBagConstraints15.gridx = 0;
gridBagConstraints15.gridy = 2;
gridBagConstraints15.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints15.ipadx = 0;
gridBagConstraints15.ipady = 10;
jPanel.add(getJScrollPane(), gridBagConstraints15);
jPanel.add(jLabel2, gridBagConstraints13);
jPanel.add(getBtnCancel(), gridBagConstraints2);
jPanel.add(getBtnOk(), gridBagConstraints3);
}
return jPanel;
}
use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class OptionsHttpSessionsPanel method initialize.
/**
* This method initializes this panel.
*/
private void initialize() {
this.setName(Constant.messages.getString("httpsessions.options.title"));
this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.fill = GridBagConstraints.BOTH;
JLabel tokenNamesLabel = new JLabel();
tokenNamesLabel.setText(Constant.messages.getString("httpsessions.options.label.tokens"));
this.add(tokenNamesLabel, gbc);
tokensOptionsPanel = new HttpSessionTokensMultipleOptionsPanel(getDefaultTokensModel());
gbc.weighty = 1.0;
this.add(tokensOptionsPanel, gbc);
gbc.weighty = 0.0;
gbc.insets = new Insets(10, 2, 2, 2);
this.add(getChkProxyOnly(), gbc);
}
use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class OptionsSpiderPanel method getPanelSpider.
/**
* This method initializes the main panel containing all option controls.
*
* @return the panel for the spider options.
*/
private JPanel getPanelSpider() {
if (panelSpider == null) {
// Initialize the panel
panelSpider = new JPanel(new BorderLayout());
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
panelSpider.setSize(114, 150);
}
panelSpider.setName("");
// Prepare the necessary labels
JLabel domainsLabel = new JLabel();
JLabel noThreadsLabel = new JLabel();
JLabel maxDuration = new JLabel();
JLabel maxDepthLabel = new JLabel();
JLabel handleParametersLabel = new JLabel();
maxDepthLabel.setText(Constant.messages.getString("spider.options.label.depth"));
noThreadsLabel.setText(Constant.messages.getString("spider.options.label.threads"));
maxDuration.setText(Constant.messages.getString("spider.options.label.duration"));
domainsLabel.setText(Constant.messages.getString("spider.options.label.domains"));
handleParametersLabel.setText(Constant.messages.getString("spider.options.label.handleparameters"));
JPanel innerPanel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.weightx = 1.0D;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.NORTHWEST;
Insets insets = new Insets(2, 2, 2, 2);
gbc.insets = insets;
// Add the components on the panel
innerPanel.add(maxDepthLabel, gbc);
innerPanel.add(getSliderMaxDepth(), gbc);
innerPanel.add(noThreadsLabel, gbc);
innerPanel.add(getSliderThreads(), gbc);
JPanel inlineOptionsPanel = new JPanel(new GridBagLayout());
inlineOptionsPanel.add(maxDuration, LayoutHelper.getGBC(0, 0, 1, 1.0D));
inlineOptionsPanel.add(getDurationNumberSpinner(), LayoutHelper.getGBC(1, 0, 1, 1.0D));
inlineOptionsPanel.add(new JLabel(Constant.messages.getString("spider.options.label.maxChildren")), LayoutHelper.getGBC(0, 1, 1, 1.0D));
inlineOptionsPanel.add(getMaxChildrenNumberSpinner(), LayoutHelper.getGBC(1, 1, 1, 1.0D));
innerPanel.add(inlineOptionsPanel, gbc);
innerPanel.add(domainsLabel, gbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.weighty = 1.0D;
innerPanel.add(getDomainsAlwaysInScopePanel(), gbc);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weighty = 0;
innerPanel.add(getChkSendRefererHeader(), gbc);
innerPanel.add(handleParametersLabel, gbc);
innerPanel.add(getComboHandleParameters(), gbc);
innerPanel.add(getChkProcessForm(), gbc);
insets.left = 15;
innerPanel.add(getChkPostForm(), gbc);
insets.left = 2;
innerPanel.add(getChkParseComments(), gbc);
innerPanel.add(getChkParseRobotsTxt(), gbc);
innerPanel.add(getChkParseSitemapXml(), gbc);
innerPanel.add(getChkParseSVNEntries(), gbc);
innerPanel.add(getChkParseGit(), gbc);
innerPanel.add(getHandleODataSpecificParameters(), gbc);
JScrollPane scrollPane = new JScrollPane(innerPanel);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
panelSpider.add(scrollPane, BorderLayout.CENTER);
}
return panelSpider;
}
use of java.awt.GridBagLayout in project ACS by ACS-Community.
the class ScriptConfigGui method initComponents.
private void initComponents() {
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(5, 5, 5, 5);
c.anchor = GridBagConstraints.WEST;
c.weighty = 0;
c.weightx = 0;
c.gridwidth = 1;
// First Row
c.gridy = 0;
c.gridx = 0;
c.anchor = GridBagConstraints.EAST;
this.add(getLocationLabel(), c);
c.gridx = 1;
c.gridwidth = 2;
c.anchor = GridBagConstraints.WEST;
c.ipadx = 170;
this.add(getLocationField(), c);
c.gridwidth = 1;
c.ipadx = 0;
c.gridx = 3;
this.add(getBrowseButton(), c);
// Second Row
c.gridy = 1;
c.gridx = 0;
c.anchor = GridBagConstraints.EAST;
this.add(getArgsLabel(), c);
c.gridx = 1;
c.gridwidth = 2;
c.anchor = GridBagConstraints.WEST;
c.ipadx = 170;
this.add(getArgsField(), c);
c.ipadx = 0;
c.gridwidth = 1;
// Third Row
c.gridy = 2;
c.gridx = 0;
c.anchor = GridBagConstraints.WEST;
this.add(getAcceptButton(), c);
c.gridx = 3;
c.anchor = GridBagConstraints.EAST;
this.add(getCancelButton(), c);
this.pack();
this.setVisible(true);
}
use of java.awt.GridBagLayout in project ACS by ACS-Community.
the class QueryDlg method initGUI.
/**
* Build the GUI
*
*/
private void initGUI() {
// The actual time/date used to fill the time fields
Calendar calendar = Calendar.getInstance();
guiSwitches = new LoadSwitchesPanel(loggingClient);
JRootPane mainPnl = this.getRootPane();
mainPnl.setLayout(new BorderLayout());
// The panel with the option of the query
JPanel optionsPnl = new JPanel();
GridBagLayout prefsLayout = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
optionsPnl.setLayout(prefsLayout);
// Add all the labels
JLabel maxLogs = new JLabel("Max num of logs to load:");
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(10, 5, 5, 5);
optionsPnl.add(maxLogs, c);
JLabel fromLbl = new JLabel("From:");
c.gridx = 0;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(fromLbl, c);
JLabel toLbl = new JLabel("To:");
c.gridx = 0;
c.gridy = 2;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(toLbl, c);
JLabel routinNameLbl = new JLabel("Routine name:");
c.gridx = 0;
c.gridy = 3;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(routinNameLbl, c);
JLabel procNameLbl = new JLabel("Process name:");
c.gridx = 0;
c.gridy = 4;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(procNameLbl, c);
JLabel srcNameLbl = new JLabel("Source object:");
c.gridx = 0;
c.gridy = 5;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(srcNameLbl, c);
JLabel minLogType = new JLabel("From type:");
c.gridx = 0;
c.gridy = 6;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(minLogType, c);
JLabel maxLogType = new JLabel("To type:");
c.gridx = 0;
c.gridy = 7;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 10, 5);
optionsPnl.add(maxLogType, c);
// Add the input widgets
fromYY = new JTextField(Integer.toString(calendar.get(Calendar.YEAR)), 4);
fromYY.setName(fromLbl.getText());
c.gridx = 1;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 0);
fromYY.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(fromYY, c);
JLabel separatorF1 = new JLabel("-");
c.gridx = 2;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 0, 5, 0);
optionsPnl.add(separatorF1, c);
fromMM = new JTextField(Integer.toString(calendar.get(Calendar.MONTH) + 1), 2);
fromMM.setName(fromLbl.getText());
c.gridx = 3;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
fromMM.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(fromMM, c);
JLabel separatorF2 = new JLabel("-");
c.gridx = 4;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(separatorF2, c);
fromDD = new JTextField(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)), 2);
fromDD.setName(fromLbl.getText());
c.gridx = 5;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
fromDD.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(fromDD, c);
JLabel tlbl = new JLabel("T");
c.gridx = 6;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(tlbl, c);
fromHr = new JTextField(Integer.toString(calendar.get(Calendar.HOUR_OF_DAY)), 2);
fromHr.setName(fromLbl.getText());
c.gridx = 7;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
fromHr.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(fromHr, c);
JLabel comaF1Lbl = new JLabel(":");
c.gridx = 8;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(comaF1Lbl, c);
fromMin = new JTextField(Integer.toString(calendar.get(Calendar.MINUTE)), 2);
fromMin.setName(fromLbl.getText());
c.gridx = 9;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
fromMin.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(fromMin, c);
JLabel comaF2Lbl = new JLabel(":");
c.gridx = 10;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(comaF2Lbl, c);
fromSec = new JTextField(Integer.toString(calendar.get(Calendar.SECOND)), 2);
fromSec.setName(fromLbl.getText());
c.gridx = 11;
c.gridy = 1;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.gridwidth = GridBagConstraints.REMAINDER;
fromSec.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(fromSec, c);
toYY = new JTextField(Integer.toString(calendar.get(Calendar.YEAR)), 4);
toYY.setName(toLbl.getText());
c.gridx = 1;
c.gridy = 2;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 5, 5, 0);
toYY.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(toYY, c);
JLabel separatorTo1 = new JLabel("-");
c.gridx = 2;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.insets = new Insets(5, 0, 5, 0);
optionsPnl.add(separatorTo1, c);
toMM = new JTextField(Integer.toString(calendar.get(Calendar.MONTH) + 1), 2);
toMM.setName(toLbl.getText());
c.gridx = 3;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
toMM.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(toMM, c);
JLabel separatorTo2 = new JLabel("-");
c.gridx = 4;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(separatorTo2, c);
toDD = new JTextField(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)), 2);
toDD.setName(toLbl.getText());
c.gridx = 5;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
toDD.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(toDD, c);
JLabel t2lbl = new JLabel("T");
c.gridx = 6;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(t2lbl, c);
toHr = new JTextField(Integer.toString(calendar.get(Calendar.HOUR_OF_DAY)), 2);
toHr.setName(toLbl.getText());
c.gridx = 7;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
toHr.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(toHr, c);
JLabel comaTo1Lbl = new JLabel(":");
c.gridx = 8;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(comaTo1Lbl, c);
toMin = new JTextField(Integer.toString(calendar.get(Calendar.MINUTE)), 2);
toMin.setName(toLbl.getText());
c.gridx = 9;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
toMin.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(toMin, c);
JLabel comaTo2Lbl = new JLabel(":");
c.gridx = 10;
c.gridy = 2;
c.gridwidth = GridBagConstraints.RELATIVE;
c.anchor = GridBagConstraints.LAST_LINE_START;
optionsPnl.add(comaTo2Lbl, c);
toSec = new JTextField(Integer.toString(calendar.get(Calendar.SECOND)), 2);
toSec.setName(toLbl.getText());
c.gridx = 11;
c.gridy = 2;
c.anchor = GridBagConstraints.LAST_LINE_START;
c.gridwidth = GridBagConstraints.REMAINDER;
toSec.getDocument().addDocumentListener(new IntegerDocumentListener());
optionsPnl.add(toSec, c);
rowLimit = new JTextField("10000", 20);
rowLimit.setName(maxLogs.getText());
rowLimit.setToolTipText("Valid range is [0, " + (Integer.MAX_VALUE - 1) + "]");
rowLimit.getDocument().addDocumentListener(new IntegerDocumentListener());
c.gridx = 1;
c.gridy = 0;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(10, 5, 5, 5);
optionsPnl.add(rowLimit, c);
routineName = new JTextField("*", 20);
c.gridx = 1;
c.gridy = 3;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(routineName, c);
procName = new JTextField("*", 20);
c.gridx = 1;
c.gridy = 4;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(procName, c);
sourceName = new JTextField("*", 20);
c.gridx = 1;
c.gridy = 5;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(sourceName, c);
minLogLevelCB = setupTypeCB(minLogLevelCB);
minLogLevelCB.setSelectedIndex(LogTypeHelper.INFO.ordinal());
c.gridx = 1;
c.gridy = 6;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(5, 5, 5, 5);
optionsPnl.add(minLogLevelCB, c);
maxLogLevelCB = setupTypeCB(maxLogLevelCB);
maxLogLevelCB.setSelectedIndex(LogTypeHelper.EMERGENCY.ordinal());
c.gridx = 1;
c.gridy = 7;
c.gridwidth = GridBagConstraints.REMAINDER;
c.insets = new Insets(5, 5, 10, 5);
optionsPnl.add(maxLogLevelCB, c);
// Add the OK, CANCEL buttons
JPanel bottomPanel = new JPanel(new BorderLayout());
JPanel btnPnl = new JPanel();
btnPnl.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
BoxLayout boxLayout = new BoxLayout(btnPnl, BoxLayout.LINE_AXIS);
btnPnl.setLayout(boxLayout);
btnPnl.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
submitBtn = new JButton("Submit");
submitBtn.addActionListener(this);
submitBtn.setEnabled(archive.getDBStatus() == DBState.DATABASE_OK);
doneBtn = new JButton("Cancel");
doneBtn.addActionListener(this);
btnPnl.add(submitBtn, BorderLayout.WEST);
btnPnl.add(Box.createRigidArea(new Dimension(10, 0)));
btnPnl.add(doneBtn, BorderLayout.EAST);
btnPnl.add(Box.createRigidArea(new Dimension(10, 0)));
// Set the border and a smaller font for the label
statusLbl.setBorder(BorderFactory.createLoweredBevelBorder());
Font fnt = statusLbl.getFont();
Font newFont = fnt.deriveFont(fnt.getSize() * 2 / 3);
statusLbl.setFont(newFont);
bottomPanel.add(btnPnl, BorderLayout.EAST);
bottomPanel.add(statusLbl, BorderLayout.CENTER);
// Add the subpanels
mainPnl.add(guiSwitches, BorderLayout.NORTH);
mainPnl.add(optionsPnl, BorderLayout.CENTER);
mainPnl.add(bottomPanel, BorderLayout.SOUTH);
}
Aggregations