use of javax.swing.ImageIcon 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.ImageIcon in project zaproxy by zaproxy.
the class ExtensionAutoUpdate method getOutOfDateButton.
private JButton getOutOfDateButton() {
if (outOfDateButton == null) {
outOfDateButton = new JButton(Constant.messages.getString("cfu.label.outofdateaddons"));
outOfDateButton.setIcon(new ImageIcon(// Alert triangle
ExtensionAutoUpdate.class.getResource("/resource/icon/16/050.png")));
outOfDateButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
alertIfOutOfDate(true);
}
});
}
return outOfDateButton;
}
use of javax.swing.ImageIcon in project zaproxy by zaproxy.
the class ExtensionAutoUpdate method alertIfOutOfDate.
private void alertIfOutOfDate(boolean alwaysPrompt) {
final OptionsParamCheckForUpdates options = getModel().getOptionsParam().getCheckForUpdatesParam();
Date today = new Date();
Date releaseCreated = Constant.getReleaseCreateDate();
Date lastInstallWarning = options.getDayLastInstallWarned();
int result = -1;
logger.debug("Install created " + releaseCreated);
if (releaseCreated != null) {
// Should only be null for dev builds
int daysOld = dayDiff(today, releaseCreated);
logger.debug("Install is " + daysOld + " days old");
if (daysOld > 365) {
// Oh no, its more than a year old!
boolean setCfuOnStart = false;
if (alwaysPrompt || lastInstallWarning == null || dayDiff(today, lastInstallWarning) > 30) {
JCheckBox cfuOnStart = new JCheckBox(Constant.messages.getString("cfu.label.cfuonstart"));
cfuOnStart.setSelected(true);
String msg = Constant.messages.getString("cfu.label.oldzap");
result = View.getSingleton().showYesNoDialog(View.getSingleton().getMainFrame(), new Object[] { msg, cfuOnStart });
setCfuOnStart = cfuOnStart.isSelected();
}
options.setDayLastInstallWarned();
if (result == JOptionPane.OK_OPTION) {
if (setCfuOnStart) {
options.setCheckOnStart(true);
}
getAddOnsDialog().setVisible(true);
getAddOnsDialog().checkForUpdates();
} else if (!oldZapAlertAdded) {
JButton button = new JButton(Constant.messages.getString("cfu.label.outofdatezap"));
button.setIcon(new ImageIcon(// Alert triangle
ExtensionAutoUpdate.class.getResource("/resource/icon/16/050.png")));
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
alertIfOutOfDate(true);
}
});
View.getSingleton().getMainFrame().getMainFooterPanel().addFooterToolbarLeftComponent(button);
oldZapAlertAdded = true;
}
return;
}
}
Date lastChecked = options.getDayLastChecked();
Date lastUpdateWarning = options.getDayLastUpdateWarned();
Date installDate = Constant.getInstallDate();
if (installDate == null || dayDiff(today, installDate) < 90) {
// Dont warn if installed in the last 3 months
} else if (lastChecked == null || dayDiff(today, lastChecked) > 90) {
// Not checked for updates in 3 months :(
boolean setCfuOnStart = false;
if (alwaysPrompt || lastUpdateWarning == null || dayDiff(today, lastUpdateWarning) > 30) {
JCheckBox cfuOnStart = new JCheckBox(Constant.messages.getString("cfu.label.cfuonstart"));
cfuOnStart.setSelected(true);
String msg = Constant.messages.getString("cfu.label.norecentcfu");
result = View.getSingleton().showYesNoDialog(View.getSingleton().getMainFrame(), new Object[] { msg, cfuOnStart });
setCfuOnStart = cfuOnStart.isSelected();
}
options.setDayLastUpdateWarned();
if (result == JOptionPane.OK_OPTION) {
if (setCfuOnStart) {
options.setCheckOnStart(true);
}
getAddOnsDialog().setVisible(true);
getAddOnsDialog().checkForUpdates();
if (noCfuAlertAdded) {
View.getSingleton().getMainFrame().getMainFooterPanel().removeFooterToolbarLeftComponent(getOutOfDateButton());
}
} else if (!noCfuAlertAdded) {
View.getSingleton().getMainFrame().getMainFooterPanel().addFooterToolbarLeftComponent(getOutOfDateButton());
noCfuAlertAdded = true;
}
}
}
use of javax.swing.ImageIcon in project zaproxy by zaproxy.
the class BreakPanelToolbarFactory method getBtnBreakResponse.
public JToggleButton getBtnBreakResponse() {
ZapToggleButton btnBreakResponse;
btnBreakResponse = new ZapToggleButton(breakResponsesButtonAction);
btnBreakResponse.setSelectedIcon(new ImageIcon(BreakPanelToolbarFactory.class.getResource("/resource/icon/16/106r.png")));
btnBreakResponse.setSelectedToolTipText(Constant.messages.getString("brk.toolbar.button.response.unset"));
return btnBreakResponse;
}
use of javax.swing.ImageIcon in project zaproxy by zaproxy.
the class BreakPanelToolbarFactory method getBtnBreakAll.
public JToggleButton getBtnBreakAll() {
ZapToggleButton btnBreakAll;
btnBreakAll = new ZapToggleButton(breakAllButtonAction);
btnBreakAll.setSelectedIcon(new ImageIcon(BreakPanelToolbarFactory.class.getResource("/resource/icon/16/151.png")));
btnBreakAll.setSelectedToolTipText(Constant.messages.getString("brk.toolbar.button.all.unset"));
return btnBreakAll;
}
Aggregations