use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class OptionsLocalProxyPanel method getPanelReverseProxy.
/**
* This method initializes panelLocalProxySSL
*
* @return javax.swing.JPanel
*/
private JPanel getPanelReverseProxy() {
if (panelReverseProxy == null) {
jLabel7 = new JLabel();
jLabel5 = new JLabel();
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
javax.swing.JLabel jLabel3 = new JLabel();
javax.swing.JLabel jLabel2 = new JLabel();
panelReverseProxy = new JPanel();
java.awt.GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
java.awt.GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
java.awt.GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
java.awt.GridBagConstraints gridBagConstraints101 = new GridBagConstraints();
panelReverseProxy.setLayout(new GridBagLayout());
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
panelReverseProxy.setSize(114, 132);
}
panelReverseProxy.setName(Constant.messages.getString("options.proxy.local.label.misc"));
panelReverseProxy.setBorder(javax.swing.BorderFactory.createTitledBorder(null, Constant.messages.getString("options.proxy.local.label.reverse"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black));
gridBagConstraints101.gridx = 0;
gridBagConstraints101.gridy = 0;
gridBagConstraints101.ipadx = 0;
gridBagConstraints101.ipady = 0;
gridBagConstraints101.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints101.weightx = 0.5D;
gridBagConstraints101.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints101.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.gridy = 0;
gridBagConstraints11.weightx = 0.5D;
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.ipadx = 50;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints12.gridx = 0;
gridBagConstraints12.gridy = 1;
gridBagConstraints12.ipadx = 0;
gridBagConstraints12.ipady = 0;
gridBagConstraints12.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints12.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints12.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints12.weightx = 0.5D;
gridBagConstraints13.gridx = 1;
gridBagConstraints13.gridy = 1;
gridBagConstraints13.weightx = 0.5D;
gridBagConstraints13.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints13.ipadx = 50;
gridBagConstraints13.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints13.anchor = java.awt.GridBagConstraints.WEST;
jLabel2.setText(Constant.messages.getString("options.proxy.local.label.rev.address"));
jLabel3.setText(Constant.messages.getString("options.proxy.local.label.rev.port"));
panelReverseProxy.add(jLabel2, gridBagConstraints101);
panelReverseProxy.add(getTxtReverseProxyIp(), gridBagConstraints11);
panelReverseProxy.add(getSpinnerReverseProxyHttpPort(), gridBagConstraints13);
panelReverseProxy.setVisible(true);
jLabel5.setText("HTTPS port (eg 443)");
gridBagConstraints3.weightx = 0.5D;
gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints3.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints3.gridx = 1;
gridBagConstraints3.gridy = 2;
gridBagConstraints3.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints3.ipadx = 50;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.gridx = 0;
gridBagConstraints41.gridy = 2;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.weightx = 0.5D;
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
jLabel7.setText(Constant.messages.getString("options.proxy.local.label.rev.local"));
gridBagConstraints51.gridx = 0;
gridBagConstraints51.gridy = 3;
gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints51.gridwidth = 2;
gridBagConstraints51.weightx = 1.0D;
gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints51.fill = java.awt.GridBagConstraints.BOTH;
panelReverseProxy.add(jLabel3, gridBagConstraints12);
panelReverseProxy.add(jLabel7, gridBagConstraints51);
panelReverseProxy.add(jLabel5, gridBagConstraints41);
panelReverseProxy.add(getSpinnerReverseProxyHttpsPort(), gridBagConstraints3);
}
return panelReverseProxy;
}
use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class MainFooterPanel method initialise.
public void initialise() {
setLayout(new GridBagLayout());
setPreferredSize(DisplayUtils.getScaledDimension(getMaximumSize().width, 20));
setMaximumSize(DisplayUtils.getScaledDimension(getMaximumSize().width, 20));
this.setBorder(BorderFactory.createEtchedBorder());
/*
* ###################################################################
* ### LEFT GBC ### <-- DYNAMIC LENGTH DUMMY GBC --> ### RIGHT GBC ###
* ###################################################################
*/
GridBagConstraints gbcToolbarLeft = new GridBagConstraints();
GridBagConstraints gbcToolbarRight = new GridBagConstraints();
GridBagConstraints gbcDummyToFillSpace = new GridBagConstraints();
gbcToolbarLeft.gridx = 0;
gbcToolbarLeft.gridy = 0;
gbcToolbarLeft.insets = new Insets(0, 5, 0, 0);
gbcToolbarLeft.anchor = GridBagConstraints.WEST;
gbcDummyToFillSpace.gridx = 1;
gbcDummyToFillSpace.gridy = 0;
gbcDummyToFillSpace.weightx = 1.0;
gbcDummyToFillSpace.weighty = 1.0;
gbcDummyToFillSpace.anchor = GridBagConstraints.EAST;
gbcDummyToFillSpace.fill = GridBagConstraints.HORIZONTAL;
gbcToolbarRight.gridx = 2;
gbcToolbarRight.gridy = 0;
gbcToolbarRight.insets = new Insets(0, 5, 0, 0);
gbcToolbarRight.anchor = GridBagConstraints.EAST;
JLabel dummyLabel = new JLabel();
add(getToolbarLeft(), gbcToolbarLeft);
add(dummyLabel, gbcDummyToFillSpace);
add(getToolbarRight(), gbcToolbarRight);
// Common alerts (Left)
footerToolbarLeft.add(new JLabel(Constant.messages.getString("footer.alerts.label")));
footerToolbarLeft.add(getAlertHigh());
footerToolbarLeft.add(getAlertMedium());
footerToolbarLeft.add(getAlertLow());
footerToolbarLeft.add(getAlertInfo());
// Current Scans (Right)
footerToolbarRight.add(new JLabel(Constant.messages.getString("footer.scans.label")));
}
use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class FindDialog method getJPanel.
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
java.awt.GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
java.awt.GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
java.awt.GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
javax.swing.JLabel jLabel = new JLabel();
jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
jLabel.setText(Constant.messages.getString("edit.find.label.what"));
gridBagConstraints1.gridx = 0;
gridBagConstraints1.gridy = 0;
gridBagConstraints1.insets = new java.awt.Insets(2, 10, 2, 10);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints5.weightx = 1.0;
gridBagConstraints5.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints5.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints5.gridx = 1;
gridBagConstraints5.gridy = 0;
gridBagConstraints5.insets = new java.awt.Insets(12, 2, 8, 10);
gridBagConstraints5.ipadx = 50;
gridBagConstraints5.gridwidth = 2;
gridBagConstraints6.gridwidth = 3;
gridBagConstraints6.gridx = 0;
gridBagConstraints6.gridy = 1;
gridBagConstraints6.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel.add(jLabel, gridBagConstraints1);
jPanel.add(getTxtFind(), gridBagConstraints5);
jPanel.add(getJPanel1(), gridBagConstraints6);
}
return jPanel;
}
use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class AlertViewPanel method getAlertDisplay.
private JPanel getAlertDisplay() {
if (alertDisplay == null) {
alertDisplay = new JPanel();
alertDisplay.setLayout(new GridBagLayout());
alertDisplay.setName("alertDisplay");
// Create the labels
alertEditName = new JComboBox<>();
alertEditName.setEditable(true);
nameListModel = new DefaultComboBoxModel<>();
List<String> allVulns = getAllVulnerabilityNames();
// Default to blank
nameListModel.addElement("");
for (String vuln : allVulns) {
nameListModel.addElement(vuln);
}
alertEditName.setModel(nameListModel);
alertEditName.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if ("comboBoxChanged".equals(e.getActionCommand())) {
Vulnerability v = getVulnerability((String) alertEditName.getSelectedItem());
if (v != null) {
if (v.getDescription() != null && v.getDescription().length() > 0) {
setAlertDescription(v.getDescription());
}
if (v.getSolution() != null && v.getSolution().length() > 0) {
setAlertSolution(v.getSolution());
}
if (v.getReferences() != null) {
StringBuilder sb = new StringBuilder();
for (String ref : v.getReferences()) {
sb.append(ref);
sb.append('\n');
}
setAlertReference(sb.toString());
}
alertEditWascId.setValue(v.getWascId());
}
}
}
});
alertEditRisk = new JComboBox<>(Alert.MSG_RISK);
alertEditConfidence = new JComboBox<>(Alert.MSG_CONFIDENCE);
alertEditConfidence.setSelectedItem(Alert.MSG_CONFIDENCE[Alert.CONFIDENCE_MEDIUM]);
alertEditAttack = new ZapTextField();
paramListModel = new DefaultComboBoxModel<>();
// Default is empty so user can type anything in
paramListModel.addElement("");
alertEditParam = new JComboBox<>();
alertEditParam.setModel(paramListModel);
alertEditParam.setEditable(true);
alertEditEvidence = new ZapTextField();
alertEditCweId = new ZapNumberSpinner();
if (alertEditCweId.getEditor() instanceof JSpinner.DefaultEditor) {
((JSpinner.DefaultEditor) alertEditCweId.getEditor()).getTextField().setHorizontalAlignment(JTextField.LEFT);
}
alertEditWascId = new ZapNumberSpinner();
if (alertEditWascId.getEditor() instanceof JSpinner.DefaultEditor) {
((JSpinner.DefaultEditor) alertEditWascId.getEditor()).getTextField().setHorizontalAlignment(JTextField.LEFT);
}
// Read only ones
alertName = new ZapLabel();
alertName.setFont(FontUtils.getFont(Font.BOLD));
alertRisk = new JLabel();
alertConfidence = new JLabel();
alertParam = new ZapLabel();
alertAttack = new ZapLabel();
alertEvidence = new ZapLabel();
alertCweId = new JLabel();
alertWascId = new JLabel();
alertSource = new JLabel();
alertUrl = new ZapLabel();
alertDescription = createZapTextArea();
JScrollPane descSp = createJScrollPane(Constant.messages.getString("alert.label.desc"));
descSp.setViewportView(alertDescription);
alertDescription.addKeyListener(new KeyAdapter() {
// Change tab key to transfer focus to the next element
@Override
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_TAB) {
alertDescription.transferFocus();
}
}
});
alertOtherInfo = createZapTextArea();
JScrollPane otherSp = createJScrollPane(Constant.messages.getString("alert.label.other"));
otherSp.setViewportView(alertOtherInfo);
alertOtherInfo.addKeyListener(new KeyAdapter() {
// Change tab key to transfer focus to the next element
@Override
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_TAB) {
alertOtherInfo.transferFocus();
}
}
});
alertSolution = createZapTextArea();
JScrollPane solutionSp = createJScrollPane(Constant.messages.getString("alert.label.solution"));
solutionSp.setViewportView(alertSolution);
alertSolution.addKeyListener(new KeyAdapter() {
// Change tab key to transfer focus to the next element
@Override
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_TAB) {
alertSolution.transferFocus();
}
}
});
alertReference = createZapTextArea();
JScrollPane referenceSp = createJScrollPane(Constant.messages.getString("alert.label.ref"));
referenceSp.setViewportView(alertReference);
alertReference.addKeyListener(new KeyAdapter() {
// Change tab key to transfer focus to the next element
@Override
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_TAB) {
alertReference.transferFocus();
}
}
});
int gbcRow = 0;
alertDisplay.add(editable ? alertEditName : alertName, LayoutHelper.getGBC(0, gbcRow, 2, 0, DEFAULT_INSETS));
// Show a blank label instead of the edit button if already editing
gbcRow++;
alertDisplay.add(getUrlLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(alertUrl, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(getRiskLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(editable ? alertEditRisk : alertRisk, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(getConfidenceLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(editable ? alertEditConfidence : alertConfidence, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(getParameterLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(editable ? alertEditParam : alertParam, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(getAttackLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(editable ? alertEditAttack : alertAttack, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(getEvidenceLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(editable ? alertEditEvidence : alertEvidence, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(getCweidLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(editable ? alertEditCweId : alertCweId, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(getWascidLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(editable ? alertEditWascId : alertWascId, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
if (!editable) {
alertDisplay.add(getSourceLabel(), LayoutHelper.getGBC(0, gbcRow, 1, 0, DEFAULT_INSETS));
alertDisplay.add(alertSource, LayoutHelper.getGBC(1, gbcRow, 1, 1, DEFAULT_INSETS));
gbcRow++;
}
alertDisplay.add(descSp, LayoutHelper.getGBC(0, gbcRow, 2, 1.0D, 1.0D, GridBagConstraints.BOTH, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(otherSp, LayoutHelper.getGBC(0, gbcRow, 2, 1.0D, 1.0D, GridBagConstraints.BOTH, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(solutionSp, LayoutHelper.getGBC(0, gbcRow, 2, 1.0D, 1.0D, GridBagConstraints.BOTH, DEFAULT_INSETS));
gbcRow++;
alertDisplay.add(referenceSp, LayoutHelper.getGBC(0, gbcRow, 2, 1.0D, 1.0D, GridBagConstraints.BOTH, DEFAULT_INSETS));
}
return alertDisplay;
}
use of java.awt.GridBagLayout in project zaproxy by zaproxy.
the class OptionsApiPanel method getPanelMisc.
/**
* This method initializes panelMisc
*
* @return javax.swing.JPanel
*/
private JPanel getPanelMisc() {
if (panelMisc == null) {
panelMisc = new JPanel();
panelMisc.setLayout(new GridBagLayout());
int y = 0;
panelMisc.add(getChkEnabled(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(getChkUiEnabled(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(getChkSecureOnly(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(new JLabel(Constant.messages.getString("api.options.label.apiKey")), LayoutHelper.getGBC(0, y, 1, 0.5));
panelMisc.add(getKeyField(), LayoutHelper.getGBC(1, y++, 1, 0.5));
panelMisc.add(getGenerateKeyButton(), LayoutHelper.getGBC(1, y++, 1, 0.5));
JPanel jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, Constant.messages.getString("api.options.addr.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black));
jPanel.add(getProxyPermittedAddressesPanel(), LayoutHelper.getGBC(0, 0, 1, 1.0, 1.0));
panelMisc.add(jPanel, LayoutHelper.getGBC(0, y++, 2, 1.0, 1.0));
JLabel warning = new JLabel(Constant.messages.getString("api.options.label.testingWarning"));
warning.setForeground(Color.RED);
panelMisc.add(warning, LayoutHelper.getGBC(0, y++, 2, 0.5D));
panelMisc.add(getDisableKey(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(getNoKeyForSafeOps(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(getReportPermErrors(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(getIncErrorDetails(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(getAutofillKey(), LayoutHelper.getGBC(0, y++, 1, 0.5));
panelMisc.add(getEnableJSONP(), LayoutHelper.getGBC(0, y++, 1, 0.5));
// Spacer
panelMisc.add(new JLabel(), LayoutHelper.getGBC(0, y, 1, 0.5D, 1.0D));
}
return panelMisc;
}
Aggregations