use of org.zaproxy.zap.utils.ZapTextField in project zaproxy by zaproxy.
the class AbstractParamContainerPanel method getTxtHeadline.
/**
* Gets text field that shows the name of the selected panel.
*
* @return the text field that shows the name of the selected panel
*/
private ZapTextField getTxtHeadline() {
if (txtHeadline == null) {
txtHeadline = new ZapTextField();
txtHeadline.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
txtHeadline.setEditable(false);
txtHeadline.setEnabled(false);
txtHeadline.setBackground(java.awt.Color.white);
txtHeadline.setFont(FontUtils.getFont(Font.BOLD));
}
return txtHeadline;
}
use of org.zaproxy.zap.utils.ZapTextField in project zaproxy by zaproxy.
the class DialogAddToken method getDescTextField.
protected ZapTextField getDescTextField() {
if (descTextField == null) {
descTextField = new ZapTextField(25);
descTextField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void insertUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
@Override
public void changedUpdate(DocumentEvent e) {
checkAndEnableConfirmButton();
}
private void checkAndEnableConfirmButton() {
setConfirmButtonEnabled(getDescTextField().getDocument().getLength() > 0);
}
});
}
return descTextField;
}
use of org.zaproxy.zap.utils.ZapTextField in project zaproxy by zaproxy.
the class StandardFieldsDialog method addFileSelectField.
public void addFileSelectField(int tabIndex, final String fieldLabel, final File dir, final int mode, final FileFilter filter) {
if (!isTabbed()) {
throw new IllegalArgumentException("Not initialised as a tabbed dialog - must use method without tab parameters");
}
if (tabIndex < 0 || tabIndex >= this.tabPanels.size()) {
throw new IllegalArgumentException("Invalid tab index: " + tabIndex);
}
final ZapTextField text = new ZapTextField();
text.setEditable(false);
if (dir != null) {
text.setText(dir.getAbsolutePath());
}
final StandardFieldsDialog sfd = this;
JButton selectButton = new JButton("...");
selectButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
JFileChooser chooser = new JFileChooser(dir);
chooser.setFileSelectionMode(mode);
if (filter != null) {
chooser.setFileFilter(filter);
}
int rc = chooser.showSaveDialog(sfd);
if (rc == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
if (file == null) {
return;
}
text.setText(file.getAbsolutePath());
}
}
});
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
panel.add(text, LayoutHelper.getGBC(0, 0, 1, 1.0D, 0.0D, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4)));
panel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D, 0.0D, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4)));
this.addField(this.tabPanels.get(tabIndex), this.tabOffsets.get(tabIndex), fieldLabel, text, panel, 0.0D);
this.incTabOffset(tabIndex);
}
Aggregations