use of javax.swing.JLabel 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 javax.swing.JLabel 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 javax.swing.JLabel 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;
}
use of javax.swing.JLabel in project zaproxy by zaproxy.
the class DynamicSSLWelcomeDialog method initLayout.
private void initLayout() {
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(480, 300);
}
this.setPreferredSize(new Dimension(480, 300));
JTextArea txtSslWontWork = new JTextArea();
txtSslWontWork.setEditable(false);
// XXX: this doesn't work like expected, it should be the same color as the control's background :-/
txtSslWontWork.setBackground(SystemColor.control);
txtSslWontWork.setTabSize(4);
txtSslWontWork.setWrapStyleWord(true);
txtSslWontWork.setLineWrap(true);
txtSslWontWork.setForeground(Color.BLACK);
txtSslWontWork.setText(Constant.messages.getString("dynssl.text.sslwontwork"));
getContentPane().setLayout(new BorderLayout());
final JPanel contentPanel = new JPanel();
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BorderLayout(0, 0));
final JPanel contentIconPane = new JPanel();
contentPanel.add(contentIconPane, BorderLayout.WEST);
final JLabel lblCertificateIcon = new JLabel("");
lblCertificateIcon.setIcon(new ImageIcon(DynamicSSLWelcomeDialog.class.getResource("/resource/certificate48x54.png")));
contentIconPane.add(lblCertificateIcon);
final JPanel contentTextPane = new JPanel();
contentTextPane.setBorder(new EmptyBorder(0, 10, 5, 5));
contentPanel.add(contentTextPane, BorderLayout.CENTER);
contentTextPane.setLayout(new BorderLayout(5, 5));
JPanel panelTitle = new JPanel();
panelTitle.setBorder(new MatteBorder(0, 0, 1, 0, UIManager.getColor("InternalFrame.borderShadow")));
contentTextPane.add(panelTitle, BorderLayout.NORTH);
{
JLabel lblTitle = new JLabel("SSL " + Constant.messages.getString("dynssl.label.rootca"));
panelTitle.add(lblTitle);
lblTitle.setFont(FontUtils.getFont(Font.BOLD));
}
contentTextPane.add(txtSslWontWork);
final JPanel panelButtons = new JPanel();
contentTextPane.add(panelButtons, BorderLayout.SOUTH);
GridBagLayout gbl_panelButtons = new GridBagLayout();
gbl_panelButtons.columnWidths = new int[] { 25, 0, 0 };
gbl_panelButtons.rowHeights = new int[] { 23, 23, 0 };
gbl_panelButtons.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
gbl_panelButtons.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
panelButtons.setLayout(gbl_panelButtons);
GridBagConstraints gbc_btnCreate = new GridBagConstraints();
gbc_btnCreate.anchor = GridBagConstraints.WEST;
gbc_btnCreate.fill = GridBagConstraints.HORIZONTAL;
gbc_btnCreate.insets = new Insets(0, 0, 5, 5);
gbc_btnCreate.gridx = 0;
gbc_btnCreate.gridy = 0;
panelButtons.add(btnCreate, gbc_btnCreate);
GridBagConstraints gbc_lblCreateCertificateNow = new GridBagConstraints();
gbc_lblCreateCertificateNow.anchor = GridBagConstraints.WEST;
gbc_lblCreateCertificateNow.fill = GridBagConstraints.HORIZONTAL;
gbc_lblCreateCertificateNow.insets = new Insets(0, 0, 5, 0);
gbc_lblCreateCertificateNow.gridx = 1;
gbc_lblCreateCertificateNow.gridy = 0;
final JLabel lblCreateCertificateNow = new JLabel(Constant.messages.getString("dynssl.text.createnow"));
panelButtons.add(lblCreateCertificateNow, gbc_lblCreateCertificateNow);
GridBagConstraints gbc_btnLater = new GridBagConstraints();
gbc_btnLater.anchor = GridBagConstraints.WEST;
gbc_btnLater.fill = GridBagConstraints.HORIZONTAL;
gbc_btnLater.insets = new Insets(0, 0, 0, 5);
gbc_btnLater.gridx = 0;
gbc_btnLater.gridy = 1;
panelButtons.add(btnLater, gbc_btnLater);
GridBagConstraints gbc_lblNotNowBut = new GridBagConstraints();
gbc_lblNotNowBut.anchor = GridBagConstraints.WEST;
gbc_lblNotNowBut.fill = GridBagConstraints.HORIZONTAL;
gbc_lblNotNowBut.gridx = 1;
gbc_lblNotNowBut.gridy = 1;
final JLabel lblNotNowBut = new JLabel(Constant.messages.getString("dynssl.text.notnow"));
panelButtons.add(lblNotNowBut, gbc_lblNotNowBut);
}
use of javax.swing.JLabel in project zaproxy by zaproxy.
the class ManageAddOnsDialog method createFilterPanel.
private static JPanel createFilterPanel(final JXTable table) {
JPanel filterPanel = new JPanel();
filterPanel.setLayout(new GridBagLayout());
JLabel filterLabel = new JLabel(Constant.messages.getString("cfu.label.addons.filter"));
final JTextField filterTextField = new JTextField();
filterLabel.setLabelFor(filterTextField);
filterPanel.add(filterLabel, LayoutHelper.getGBC(0, 0, 1, 0.0D));
filterPanel.add(filterTextField, LayoutHelper.getGBC(1, 0, 1, 1.0D));
String tooltipText = Constant.messages.getString("cfu.label.addons.filter.tooltip");
filterLabel.setToolTipText(tooltipText);
filterTextField.setToolTipText(tooltipText);
// Set filter listener
filterTextField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
updateFilter();
}
@Override
public void removeUpdate(DocumentEvent e) {
updateFilter();
}
@Override
public void changedUpdate(DocumentEvent e) {
updateFilter();
}
public void updateFilter() {
String filterText = filterTextField.getText();
if (filterText.isEmpty()) {
table.setRowFilter(null);
filterTextField.setForeground(UIManager.getColor("TextField.foreground"));
} else {
try {
table.setRowFilter(RowFilter.regexFilter("(?i)" + filterText));
filterTextField.setForeground(UIManager.getColor("TextField.foreground"));
} catch (PatternSyntaxException e) {
filterTextField.setForeground(Color.RED);
}
}
}
});
return filterPanel;
}
Aggregations