Search in sources :

Example 6 with Container

use of java.awt.Container in project jodd by oblac.

the class SwingSpy method initSpyDialog.

/**
	 * Initializes Spy dialog.
	 */
protected void initSpyDialog(Component rootComponent, Component component) {
    if (rootComponent instanceof Dialog) {
        spyDialog = new CaddyDialog((Dialog) rootComponent) {

            @Override
            protected JRootPane createRootPane() {
                return createSpyRootPane();
            }
        };
    } else if (rootComponent instanceof Frame) {
        spyDialog = new CaddyDialog((Frame) rootComponent) {

            @Override
            protected JRootPane createRootPane() {
                return createSpyRootPane();
            }
        };
    } else {
        spyDialog = new JDialog() {

            @Override
            protected JRootPane createRootPane() {
                return createSpyRootPane();
            }
        };
    }
    spyDialog.setName("SwingSpy");
    spyDialog.setTitle("SwingSpy");
    spyDialog.setModal(false);
    spyDialog.setAlwaysOnTop(true);
    Container contentPane = spyDialog.getContentPane();
    contentPane.setLayout(new BorderLayout());
    spyPanel = new SwingSpyPanel();
    spyPanel.reload(rootComponent, component);
    contentPane.add(spyPanel);
    spyDialog.pack();
    spyDialog.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            super.windowClosed(e);
            spyGlass.setVisible(false);
            spyDialog = null;
        }
    });
    spyDialog.setLocationRelativeTo(null);
    spyDialog.setVisible(true);
}
Also used : Frame(java.awt.Frame) RootPaneContainer(javax.swing.RootPaneContainer) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JDialog(javax.swing.JDialog) Dialog(java.awt.Dialog) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) JRootPane(javax.swing.JRootPane) JDialog(javax.swing.JDialog)

Example 7 with Container

use of java.awt.Container in project lombok by rzwitserloot.

the class InstallerGUI method doUninstall.

private void doUninstall() {
    JPanel spinner = new JPanel();
    spinner.setOpaque(true);
    spinner.setLayout(new FlowLayout());
    spinner.add(new JLabel(new ImageIcon(Installer.class.getResource("/lombok/installer/loading.gif"))));
    final Container originalContentPane = appWindow.getContentPane();
    appWindow.setContentPane(spinner);
    final AtomicInteger successes = new AtomicInteger();
    new Thread(new Runnable() {

        @Override
        public void run() {
            for (IdeLocation loc : toUninstall) {
                try {
                    loc.uninstall();
                    successes.incrementAndGet();
                } catch (final UninstallException e) {
                    if (e.isWarning()) {
                        try {
                            SwingUtilities.invokeAndWait(new Runnable() {

                                @Override
                                public void run() {
                                    JOptionPane.showMessageDialog(appWindow, e.getMessage(), "Uninstall Problem", JOptionPane.WARNING_MESSAGE);
                                }
                            });
                        } catch (Exception e2) {
                            e2.printStackTrace();
                            //Shouldn't happen.
                            throw new RuntimeException(e2);
                        }
                    } else {
                        try {
                            SwingUtilities.invokeAndWait(new Runnable() {

                                @Override
                                public void run() {
                                    JOptionPane.showMessageDialog(appWindow, e.getMessage(), "Uninstall Problem", JOptionPane.ERROR_MESSAGE);
                                }
                            });
                        } catch (Exception e2) {
                            e2.printStackTrace();
                            //Shouldn't happen.
                            throw new RuntimeException(e2);
                        }
                    }
                }
            }
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    if (successes.get() > 0) {
                        JOptionPane.showMessageDialog(appWindow, "Lombok has been removed from the selected IDE installations.", "Uninstall successful", JOptionPane.INFORMATION_MESSAGE);
                        appWindow.setVisible(false);
                        System.exit(0);
                        return;
                    }
                    appWindow.setContentPane(originalContentPane);
                }
            });
        }
    }).start();
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) FlowLayout(java.awt.FlowLayout) JLabel(javax.swing.JLabel) Container(java.awt.Container) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

Example 8 with Container

use of java.awt.Container in project scriptographer by scriptographer.

the class Image method waitForImage.

public static java.awt.Image waitForImage(java.awt.Image image) {
    MediaTracker mediaTracker = new MediaTracker(new Container());
    mediaTracker.addImage(image, 0);
    try {
        mediaTracker.waitForID(0);
        if (image.getWidth(null) == -1 || image.getHeight(null) == -1)
            image = null;
    } catch (InterruptedException e) {
        image = null;
    }
    return image;
}
Also used : MediaTracker(java.awt.MediaTracker) Container(java.awt.Container)

Example 9 with Container

use of java.awt.Container in project jadx by skylot.

the class LogViewer method initUI.

public final void initUI() {
    textPane = new RSyntaxTextArea();
    textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
    JPanel controlPane = new JPanel();
    controlPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    @SuppressWarnings("unchecked") final JComboBox cb = new JComboBox(LEVEL_ITEMS);
    cb.setSelectedItem(level);
    cb.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int i = cb.getSelectedIndex();
            level = LEVEL_ITEMS[i];
            registerLogListener();
        }
    });
    JLabel levelLabel = new JLabel(NLS.str("log.level"));
    levelLabel.setLabelFor(cb);
    controlPane.add(levelLabel);
    controlPane.add(cb);
    JScrollPane scrollPane = new JScrollPane(textPane);
    JButton close = new JButton(NLS.str("tabs.close"));
    close.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            close();
        }
    });
    close.setAlignmentX(0.5f);
    Container contentPane = getContentPane();
    contentPane.add(controlPane, BorderLayout.PAGE_START);
    contentPane.add(scrollPane, BorderLayout.CENTER);
    contentPane.add(close, BorderLayout.PAGE_END);
    setTitle("Log Viewer");
    pack();
    setSize(800, 600);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.MODELESS);
    setLocationRelativeTo(null);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) Container(java.awt.Container) RSyntaxTextArea(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea) JComboBox(javax.swing.JComboBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel)

Example 10 with Container

use of java.awt.Container in project jadx by skylot.

the class SearchDialog method initUI.

private void initUI() {
    JLabel findLabel = new JLabel(NLS.str("search_dialog.open_by_name"));
    searchField = new JTextField();
    searchField.setAlignmentX(LEFT_ALIGNMENT);
    searchField.getDocument().addDocumentListener(new SearchFieldListener());
    new TextStandardActions(searchField);
    JCheckBox clsChBox = makeOptionsCheckBox(NLS.str("search_dialog.class"), SearchOptions.CLASS);
    JCheckBox mthChBox = makeOptionsCheckBox(NLS.str("search_dialog.method"), SearchOptions.METHOD);
    JCheckBox fldChBox = makeOptionsCheckBox(NLS.str("search_dialog.field"), SearchOptions.FIELD);
    JCheckBox codeChBox = makeOptionsCheckBox(NLS.str("search_dialog.code"), SearchOptions.CODE);
    JPanel searchOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
    searchOptions.setBorder(BorderFactory.createTitledBorder(NLS.str("search_dialog.search_in")));
    searchOptions.add(clsChBox);
    searchOptions.add(mthChBox);
    searchOptions.add(fldChBox);
    searchOptions.add(codeChBox);
    searchOptions.setAlignmentX(LEFT_ALIGNMENT);
    JPanel searchPane = new JPanel();
    searchPane.setLayout(new BoxLayout(searchPane, BoxLayout.PAGE_AXIS));
    findLabel.setLabelFor(searchField);
    searchPane.add(findLabel);
    searchPane.add(Box.createRigidArea(new Dimension(0, 5)));
    searchPane.add(searchField);
    searchPane.add(Box.createRigidArea(new Dimension(0, 5)));
    searchPane.add(searchOptions);
    searchPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    initCommon();
    JPanel resultsPanel = initResultsTable();
    JPanel buttonPane = initButtonsPanel();
    Container contentPane = getContentPane();
    contentPane.add(searchPane, BorderLayout.PAGE_START);
    contentPane.add(resultsPanel, BorderLayout.CENTER);
    contentPane.add(buttonPane, BorderLayout.PAGE_END);
    searchField.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                if (resultsModel.getRowCount() != 0) {
                    resultsTable.setRowSelectionInterval(0, 0);
                }
                resultsTable.requestFocus();
            }
        }
    });
    setTitle(NLS.str("menu.text_search"));
    pack();
    setSize(800, 500);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.MODELESS);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BoxLayout(javax.swing.BoxLayout) KeyAdapter(java.awt.event.KeyAdapter) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) TextStandardActions(jadx.gui.utils.TextStandardActions) JCheckBox(javax.swing.JCheckBox) KeyEvent(java.awt.event.KeyEvent) Container(java.awt.Container)

Aggregations

Container (java.awt.Container)206 JPanel (javax.swing.JPanel)63 JLabel (javax.swing.JLabel)61 JButton (javax.swing.JButton)53 JScrollPane (javax.swing.JScrollPane)51 BoxLayout (javax.swing.BoxLayout)47 FlowLayout (java.awt.FlowLayout)45 ActionEvent (java.awt.event.ActionEvent)38 BorderLayout (java.awt.BorderLayout)36 Dimension (java.awt.Dimension)33 ActionListener (java.awt.event.ActionListener)26 Component (java.awt.Component)25 JmriJFrame (jmri.util.JmriJFrame)20 JFrame (javax.swing.JFrame)18 Border (javax.swing.border.Border)18 JTextArea (javax.swing.JTextArea)17 JTable (javax.swing.JTable)15 JTextField (javax.swing.JTextField)15 Color (java.awt.Color)13 Point (java.awt.Point)13