use of java.awt.event.WindowEvent in project gitblit by gitblit.
the class GitblitManager method initialize.
private void initialize() {
setContentPane(getCenterPanel());
setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());
setTitle("Gitblit Manager v" + Constants.getVersion() + " (" + Constants.getBuildDate() + ")");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent event) {
saveSizeAndPosition();
}
@Override
public void windowOpened(WindowEvent event) {
manageRegistrations();
}
});
setSizeAndPosition();
loadRegistrations();
rebuildRecentMenu();
}
use of java.awt.event.WindowEvent in project zaproxy by zaproxy.
the class ManageAddOnsDialog method initialize.
/**
* This method initializes this
*
*/
private void initialize() {
this.setTitle(Constant.messages.getString("cfu.manage.title"));
//this.setContentPane(getJTabbed());
this.setContentPane(getTopPanel());
this.pack();
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(700, 500);
}
state = State.IDLE;
// Handle escape key to close the dialog
KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
AbstractAction escapeAction = new AbstractAction() {
private static final long serialVersionUID = 3516424501887406165L;
@Override
public void actionPerformed(ActionEvent e) {
dispatchEvent(new WindowEvent(ManageAddOnsDialog.this, WindowEvent.WINDOW_CLOSING));
}
};
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE");
getRootPane().getActionMap().put("ESCAPE", escapeAction);
}
use of java.awt.event.WindowEvent in project zaproxy by zaproxy.
the class ScanProgressDialog method initialize.
private void initialize() {
this.setSize(new Dimension(580, 504));
JTabbedPane tabbedPane = new JTabbedPane();
JPanel tab1 = new JPanel();
tab1.setLayout(new GridBagLayout());
JPanel hostPanel = new JPanel();
hostPanel.setLayout(new GridBagLayout());
hostPanel.add(new JLabel(Constant.messages.getString("ascan.progress.label.host")), LayoutHelper.getGBC(0, 0, 1, 0.4D));
hostPanel.add(getHostSelect(), LayoutHelper.getGBC(1, 0, 1, 0.6D));
tab1.add(hostPanel, LayoutHelper.getGBC(0, 0, 3, 1.0D, 0.0D));
tab1.add(getJScrollPane(), LayoutHelper.getGBC(0, 1, 3, 1.0D, 1.0D));
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
buttonsPanel.add(getCopyToClipboardButton());
buttonsPanel.add(getCloseButton());
tab1.add(buttonsPanel, LayoutHelper.getGBC(0, 2, 3, 1.0D));
tabbedPane.insertTab(Constant.messages.getString("ascan.progress.tab.progress"), null, tab1, null, 0);
this.add(tabbedPane);
int mins = extension.getScannerParam().getMaxChartTimeInMins();
if (mins > 0) {
// Treat zero mins as disabled
JPanel tab2 = new JPanel();
tab2.setLayout(new GridBagLayout());
// Name not shown, so no need to i18n
this.seriesTotal = new TimeSeries("TotalResponses");
final TimeSeriesCollection dataset = new TimeSeriesCollection(this.seriesTotal);
this.series100 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.1xx"));
this.series200 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.2xx"));
this.series300 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.3xx"));
this.series400 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.4xx"));
this.series500 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.5xx"));
long maxAge = mins * 60;
this.seriesTotal.setMaximumItemAge(maxAge);
this.series100.setMaximumItemAge(maxAge);
this.series200.setMaximumItemAge(maxAge);
this.series300.setMaximumItemAge(maxAge);
this.series400.setMaximumItemAge(maxAge);
this.series500.setMaximumItemAge(maxAge);
dataset.addSeries(series100);
dataset.addSeries(series200);
dataset.addSeries(series300);
dataset.addSeries(series400);
dataset.addSeries(series500);
chart = createChart(dataset);
// Set up some vaguesly sensible colours
// Totals
chart.getXYPlot().getRenderer(0).setSeriesPaint(0, Color.BLACK);
// 100: Info
chart.getXYPlot().getRenderer(0).setSeriesPaint(1, Color.GRAY);
// 200: OK
chart.getXYPlot().getRenderer(0).setSeriesPaint(2, Color.GREEN);
// 300: Info
chart.getXYPlot().getRenderer(0).setSeriesPaint(3, Color.BLUE);
// 400: Bad req
chart.getXYPlot().getRenderer(0).setSeriesPaint(4, Color.MAGENTA);
// 500: Internal error
chart.getXYPlot().getRenderer(0).setSeriesPaint(5, Color.RED);
final ChartPanel chartPanel = new ChartPanel(chart);
tab2.add(chartPanel, LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D));
tabbedPane.insertTab(Constant.messages.getString("ascan.progress.tab.chart"), null, tab2, null, 1);
}
// Stop the updating thread when the window is closed
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
stopThread = true;
}
});
}
use of java.awt.event.WindowEvent in project zaproxy by zaproxy.
the class AbstractDialog method initialize.
/**
* This method initializes this
*/
private void initialize() {
this.setVisible(false);
this.setIconImages(DisplayUtils.getZapIconImages());
this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(300, 200);
}
this.setTitle(Constant.PROGRAM_NAME);
// Handle escape key to close the dialog
KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
AbstractAction escapeAction = new AbstractAction() {
private static final long serialVersionUID = 3516424501887406165L;
@Override
public void actionPerformed(ActionEvent e) {
dispatchEvent(new WindowEvent(AbstractDialog.this, WindowEvent.WINDOW_CLOSING));
}
};
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE");
getRootPane().getActionMap().put("ESCAPE", escapeAction);
}
use of java.awt.event.WindowEvent in project L42 by ElvisResearchGroup.
the class Frame method createNew.
private static Frame createNew(String wName, String html, int x, int y) {
FutureTask<Frame> future = new FutureTask<>(() -> {
final Frame frame = new Frame(Frame.extractTitle(html));
JFXPanel jfxPanel = new JFXPanel();
frame.createHtmlContent(jfxPanel, html);
frame.getContentPane().add(jfxPanel);
frame.setMinimumSize(new Dimension(x, y));
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
Frame.close(wName);
}
});
frame.setVisible(true);
return frame;
});
SwingUtilities.invokeLater(future);
try {
return future.get();
} catch (ExecutionException e) {
throw propagateException(e.getCause());
} catch (InterruptedException e) {
throw propagateException(e);
}
}
Aggregations