Search in sources :

Example 56 with JRootPane

use of javax.swing.JRootPane in project ACS by ACS-Community.

the class LogMonitorFrame method initialize.

/**
	 * Init the GUI
	 */
private void initialize() {
    setTitle("ACS logs monitor");
    JRootPane rootP = getRootPane();
    rootP.setLayout(new BorderLayout());
    // Add the tabs
    tabbedPnl = new JTabbedPane();
    totalStatsPnl = new TotalStatisticsPnl();
    tabbedPnl.add("Values", totalStatsPnl);
    trendPnl = new TrendPnl();
    tabbedPnl.add("Trend", trendPnl);
    rootP.add(tabbedPnl, BorderLayout.CENTER);
    // Add the close button at the bottom
    JPanel btnPnl = new JPanel(new FlowLayout(FlowLayout.CENTER));
    btnPnl.add(closeBtn);
    closeBtn.addActionListener(this);
    rootP.add(btnPnl, BorderLayout.SOUTH);
    pack();
    setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) JTabbedPane(javax.swing.JTabbedPane) JRootPane(javax.swing.JRootPane)

Example 57 with JRootPane

use of javax.swing.JRootPane in project ACS by ACS-Community.

the class ErrorLogDialog method initGUI.

/**
	 * Builds the content of the GUI
	 *
	 */
private void initGUI() {
    ImageIcon icon = new ImageIcon(LogTypeHelper.class.getResource("/errorLogIcon.png"));
    setIconImage(icon.getImage());
    synchronized (logTA) {
        logTA.setDocument(document);
        logTA.setEditable(false);
    }
    JScrollPane logSP = new JScrollPane(logTA);
    JRootPane mainPnl = this.getRootPane();
    mainPnl.setLayout(new BorderLayout());
    mainPnl.add(logSP, BorderLayout.CENTER);
    // Close button
    JPanel btnPnl = new JPanel(new FlowLayout());
    closeBtn = new JButton("Close");
    closeBtn.addActionListener(this);
    btnPnl.add(closeBtn);
    mainPnl.add(btnPnl, BorderLayout.SOUTH);
    // Build the toolbar
    toolBar = new JToolBar();
    JPanel toolBarPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    ImageIcon cleanIcon = new ImageIcon(ErrorLogDialog.class.getResource("/delete.png"));
    cleanAllBtn = new JButton("<HTML><Font size=\"-1\">Clean</FONT></HTML>", cleanIcon);
    cleanAllBtn.addActionListener(this);
    cleanAllBtn.setToolTipText("Delete log");
    ImageIcon saveIcon = new ImageIcon(ErrorLogDialog.class.getResource("/disk.png"));
    saveAllBtn = new JButton("<HTML><Font size=\"-1\">Save</FONT></HTML>", saveIcon);
    saveAllBtn.addActionListener(this);
    saveAllBtn.setToolTipText("Save log");
    toolBarPanel.add(cleanAllBtn);
    toolBarPanel.add(saveAllBtn);
    toolBar.add(toolBarPanel);
    mainPnl.add(toolBar, BorderLayout.PAGE_START);
    rationalizeButtons();
}
Also used : JScrollPane(javax.swing.JScrollPane) ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) JButton(javax.swing.JButton) JRootPane(javax.swing.JRootPane) JToolBar(javax.swing.JToolBar)

Example 58 with JRootPane

use of javax.swing.JRootPane in project adempiere by adempiere.

the class WindowMenu method expose.

public void expose() {
    final JDialog dialog = new JDialog();
    dialog.setSize(Toolkit.getDefaultToolkit().getScreenSize());
    dialog.setUndecorated(true);
    dialog.setModal(true);
    //add escape to close
    ActionListener actionListener = new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            dialog.setVisible(false);
        }
    };
    JRootPane jr = dialog.getRootPane();
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    jr.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
    //new Thread(new Loader(dialog)).start();
    SwingUtilities.invokeLater(new Loader(dialog));
    dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    dialog.setVisible(true);
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) JDialog(javax.swing.JDialog)

Example 59 with JRootPane

use of javax.swing.JRootPane in project jdk8u_jdk by JetBrains.

the class InsetsEncapsulation method run.

@Override
public void run() {
    runTest(new JLabel("hi"));
    runTest(new JMenu());
    runTest(new JTree());
    runTest(new JTable());
    runTest(new JMenuItem());
    runTest(new JCheckBoxMenuItem());
    runTest(new JToggleButton());
    runTest(new JSpinner());
    runTest(new JSlider());
    runTest(Box.createVerticalBox());
    runTest(Box.createHorizontalBox());
    runTest(new JTextField());
    runTest(new JTextArea());
    runTest(new JTextPane());
    runTest(new JPasswordField());
    runTest(new JFormattedTextField());
    runTest(new JEditorPane());
    runTest(new JButton());
    runTest(new JColorChooser());
    runTest(new JFileChooser());
    runTest(new JCheckBox());
    runTest(new JInternalFrame());
    runTest(new JDesktopPane());
    runTest(new JTableHeader());
    runTest(new JLayeredPane());
    runTest(new JRootPane());
    runTest(new JMenuBar());
    runTest(new JOptionPane());
    runTest(new JRadioButton());
    runTest(new JRadioButtonMenuItem());
    runTest(new JPopupMenu());
    runTest(new JScrollBar());
    runTest(new JScrollPane());
    runTest(new JViewport());
    runTest(new JSplitPane());
    runTest(new JTabbedPane());
    runTest(new JToolBar());
    runTest(new JSeparator());
    runTest(new JProgressBar());
    if (!failures.isEmpty()) {
        System.out.println("These classes failed");
        for (final Component failure : failures) {
            System.out.println(failure.getClass());
        }
        throw new RuntimeException("Test failed");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) JTextArea(javax.swing.JTextArea) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTableHeader(javax.swing.table.JTableHeader) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JScrollBar(javax.swing.JScrollBar) JTextPane(javax.swing.JTextPane) JToggleButton(javax.swing.JToggleButton) JSlider(javax.swing.JSlider) JMenuItem(javax.swing.JMenuItem) JComponent(javax.swing.JComponent) Component(java.awt.Component) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JToolBar(javax.swing.JToolBar) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JPopupMenu(javax.swing.JPopupMenu) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) JTable(javax.swing.JTable) JEditorPane(javax.swing.JEditorPane) JSpinner(javax.swing.JSpinner) JRootPane(javax.swing.JRootPane) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 60 with JRootPane

use of javax.swing.JRootPane in project JMRI by JMRI.

the class TrackSegment method editTrackSegment.

/**
     * Edit a Track Segment.
     */
protected void editTrackSegment() {
    if (editOpen) {
        editTrackSegmentFrame.setVisible(true);
        return;
    }
    // Initialize if needed
    if (editTrackSegmentFrame == null) {
        // key moved to DisplayBundle to be found by CircuitBuilder.java
        editTrackSegmentFrame = new JmriJFrame(Bundle.getMessage("EditTrackSegment"), false, true);
        editTrackSegmentFrame.addHelpMenu("package.jmri.jmrit.display.EditTrackSegment", true);
        editTrackSegmentFrame.setLocation(50, 30);
        Container contentPane = editTrackSegmentFrame.getContentPane();
        contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
        // add dashed choice
        JPanel panel31 = new JPanel();
        panel31.setLayout(new FlowLayout());
        dashedBox.removeAllItems();
        dashedBox.addItem(rb.getString("Solid"));
        solidIndex = 0;
        dashedBox.addItem(rb.getString("Dashed"));
        dashedIndex = 1;
        dashedBox.setToolTipText(rb.getString("DashedToolTip"));
        panel31.add(new JLabel(rb.getString("Style") + " : "));
        panel31.add(dashedBox);
        contentPane.add(panel31);
        // add mainline choice
        JPanel panel32 = new JPanel();
        panel32.setLayout(new FlowLayout());
        mainlineBox.removeAllItems();
        mainlineBox.addItem(rb.getString("Mainline"));
        mainlineTrackIndex = 0;
        mainlineBox.addItem(rb.getString("NotMainline"));
        sideTrackIndex = 1;
        mainlineBox.setToolTipText(rb.getString("MainlineToolTip"));
        panel32.add(mainlineBox);
        contentPane.add(panel32);
        // add hidden choice
        JPanel panel33 = new JPanel();
        panel33.setLayout(new FlowLayout());
        hiddenBox.setToolTipText(rb.getString("HiddenToolTip"));
        panel33.add(hiddenBox);
        contentPane.add(panel33);
        // setup block name
        JPanel panel2 = new JPanel();
        panel2.setLayout(new FlowLayout());
        JLabel blockNameLabel = new JLabel(rb.getString("BlockID"));
        panel2.add(blockNameLabel);
        layoutEditor.setupComboBox(blockNameComboBox, false, true);
        blockNameComboBox.setToolTipText(rb.getString("EditBlockNameHint"));
        panel2.add(blockNameComboBox);
        contentPane.add(panel2);
        if (getArc() && circle) {
            JPanel panel20 = new JPanel();
            panel20.setLayout(new FlowLayout());
            JLabel arcLabel = new JLabel("Set Arc Angle");
            panel20.add(arcLabel);
            panel20.add(arcField);
            arcField.setToolTipText("Set Arc Angle");
            contentPane.add(panel20);
            arcField.setText("" + getAngle());
        }
        // set up Edit Block, Done and Cancel buttons
        JPanel panel5 = new JPanel();
        panel5.setLayout(new FlowLayout());
        // Edit Block
        panel5.add(segmentEditBlock = new JButton(Bundle.getMessage("EditBlock", "")));
        segmentEditBlock.addActionListener((ActionEvent e) -> {
            segmentEditBlockPressed(e);
        });
        // empty value for block 1
        segmentEditBlock.setToolTipText(Bundle.getMessage("EditBlockHint", ""));
        panel5.add(segmentEditDone = new JButton(Bundle.getMessage("ButtonDone")));
        segmentEditDone.addActionListener((ActionEvent e) -> {
            segmentEditDonePressed(e);
        });
        segmentEditDone.setToolTipText(Bundle.getMessage("DoneHint", Bundle.getMessage("ButtonDone")));
        // make this button the default button (return or enter activates)
        // Note: We have to invoke this later because we don't currently have a root pane
        SwingUtilities.invokeLater(() -> {
            JRootPane rootPane = SwingUtilities.getRootPane(segmentEditDone);
            rootPane.setDefaultButton(segmentEditDone);
        });
        // Cancel
        panel5.add(segmentEditCancel = new JButton(Bundle.getMessage("ButtonCancel")));
        segmentEditCancel.addActionListener((ActionEvent e) -> {
            segmentEditCancelPressed(e);
        });
        segmentEditCancel.setToolTipText(Bundle.getMessage("CancelHint", Bundle.getMessage("ButtonCancel")));
        contentPane.add(panel5);
    }
    // Set up for Edit
    if (mainline) {
        mainlineBox.setSelectedIndex(mainlineTrackIndex);
    } else {
        mainlineBox.setSelectedIndex(sideTrackIndex);
    }
    if (dashed) {
        dashedBox.setSelectedIndex(dashedIndex);
    } else {
        dashedBox.setSelectedIndex(solidIndex);
    }
    hiddenBox.setSelected(hidden);
    blockNameComboBox.getEditor().setItem(blockName);
    editTrackSegmentFrame.addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent e) {
            segmentEditCancelPressed(null);
        }
    });
    editTrackSegmentFrame.pack();
    editTrackSegmentFrame.setVisible(true);
    editOpen = true;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Container(java.awt.Container) JmriJFrame(jmri.util.JmriJFrame) JRootPane(javax.swing.JRootPane)

Aggregations

JRootPane (javax.swing.JRootPane)89 ActionEvent (java.awt.event.ActionEvent)48 KeyStroke (javax.swing.KeyStroke)34 AbstractAction (javax.swing.AbstractAction)32 Action (javax.swing.Action)29 InputMap (javax.swing.InputMap)26 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 JButton (javax.swing.JButton)13 ActionListener (java.awt.event.ActionListener)12 JLabel (javax.swing.JLabel)12 FlowLayout (java.awt.FlowLayout)10 Container (java.awt.Container)9 Dimension (java.awt.Dimension)9 Insets (java.awt.Insets)9 BoxLayout (javax.swing.BoxLayout)9 Component (java.awt.Component)8 Frame (java.awt.Frame)7 JScrollPane (javax.swing.JScrollPane)7 GridBagConstraints (java.awt.GridBagConstraints)6