Search in sources :

Example 11 with WindowAdapter

use of java.awt.event.WindowAdapter in project jreversepro by akkumar.

the class GUIMain method addListeners.

/**
   * Method to add property listeners to MenuItems and the MainFrame.
   */
private void addListeners() {
    mMbrGen.onFileOpen.addActionListener(this);
    mMbrGen.onFileSave.addActionListener(this);
    mMbrGen.onFileExit.addActionListener(this);
    mMbrGen.onEditCut.addActionListener(this);
    mMbrGen.onEditCopy.addActionListener(this);
    mMbrGen.onViewCPool.addActionListener(this);
    mMbrGen.onOptFont.addActionListener(this);
    mMbrGen.onHelpAbout.addActionListener(this);
    addWindowListener(new WindowAdapter() {

        /**
       * WindowClosing event handler.
       * 
       * @param aEvent
       *          Event generated.
       */
        @Override
        public void windowClosing(WindowEvent aEvent) {
            appClose();
            super.windowClosing(aEvent);
        }
    });
}
Also used : WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter)

Example 12 with WindowAdapter

use of java.awt.event.WindowAdapter in project qi4j-sdk by Qi4j.

the class Envisage method showMainFrame.

private void showMainFrame() {
    mainFrame = new EnvisageFrame(application);
    mainFrame.setLocationByPlatform(true);
    mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    mainFrame.setSize(new Dimension(1024, 768));
    mainFrame.setVisible(true);
    mainFrame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowOpened(WindowEvent evt) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    mainFrame.initQi4J();
                }
            });
        }
    });
}
Also used : WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension)

Example 13 with WindowAdapter

use of java.awt.event.WindowAdapter 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);
    }
}
Also used : JFrame(javax.swing.JFrame) JFXPanel(javafx.embed.swing.JFXPanel) FutureTask(java.util.concurrent.FutureTask) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) ExecutionException(java.util.concurrent.ExecutionException)

Example 14 with WindowAdapter

use of java.awt.event.WindowAdapter 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;
        }
    });
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) TimeSeries(org.jfree.data.time.TimeSeries) ChartPanel(org.jfree.chart.ChartPanel) GridBagLayout(java.awt.GridBagLayout) JTabbedPane(javax.swing.JTabbedPane) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) Point(java.awt.Point) TimeSeriesCollection(org.jfree.data.time.TimeSeriesCollection) WindowEvent(java.awt.event.WindowEvent)

Example 15 with WindowAdapter

use of java.awt.event.WindowAdapter in project pcgen by PCGen.

the class ConversionInputDialog method initComponents.

/**
	 * Initialises the user interface.
	 */
private void initComponents() {
    setLayout(new GridBagLayout());
    JLabel introLabel = new JLabel(introText);
    GridBagConstraints gbc = new GridBagConstraints();
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 1.0);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(10, 10, 5, 10);
    add(introLabel, gbc);
    field = new JTextField(20);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    gbc.insets = new Insets(5, 10, 5, 10);
    add(field, gbc);
    JLabel dummy = new JLabel(" ");
    Utility.buildRelativeConstraints(gbc, 1, 1, 1.0, 0.0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    add(dummy, gbc);
    JButton okButton = new JButton(LanguageBundle.getString("in_ok"));
    okButton.addActionListener(this);
    getRootPane().setDefaultButton(okButton);
    Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
    gbc.insets = new Insets(5, 5, 10, 10);
    add(okButton, gbc);
    pack();
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            result = field.getText();
            setVisible(false);
            logInput();
        }
    });
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) WindowEvent(java.awt.event.WindowEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) JTextField(javax.swing.JTextField)

Aggregations

WindowAdapter (java.awt.event.WindowAdapter)143 WindowEvent (java.awt.event.WindowEvent)140 JPanel (javax.swing.JPanel)40 JButton (javax.swing.JButton)36 JFrame (javax.swing.JFrame)34 BorderLayout (java.awt.BorderLayout)32 Dimension (java.awt.Dimension)30 JLabel (javax.swing.JLabel)26 JScrollPane (javax.swing.JScrollPane)25 ActionEvent (java.awt.event.ActionEvent)22 ActionListener (java.awt.event.ActionListener)20 FlowLayout (java.awt.FlowLayout)18 GridBagConstraints (java.awt.GridBagConstraints)18 GridBagLayout (java.awt.GridBagLayout)18 Insets (java.awt.Insets)14 Frame (java.awt.Frame)13 Container (java.awt.Container)12 JTextArea (javax.swing.JTextArea)12 JDialog (javax.swing.JDialog)11 IOException (java.io.IOException)9