Example usage for javax.swing JInternalFrame isSelected

List of usage examples for javax.swing JInternalFrame isSelected

Introduction

In this page you can find the example usage for javax.swing JInternalFrame isSelected.

Prototype

boolean isSelected

To view the source code for javax.swing JInternalFrame isSelected.

Click Source Link

Document

The frame is currently selected.

Usage

From source file:SiteFrame.java

public JInternalFrame getCurrentFrame() {
    for (int i = 0; i < popups.size(); i++) {
        JInternalFrame currentFrame = (JInternalFrame) popups.elementAt(i);
        if (currentFrame.isSelected()) {
            return currentFrame;
        }/*w  w w.  j a v a 2 s  .co  m*/
    }
    return null;
}

From source file:au.org.ala.delta.editor.DeltaEditor.java

private void buildWindowMenu(JMenu mnuWindow) {
    mnuWindow.removeAll();/*  www  .j  a  va2  s.  c  o m*/

    JMenuItem mnuItCascade = new JMenuItem();
    mnuItCascade.setAction(_actionMap.get("cascadeFrames"));
    mnuWindow.add(mnuItCascade);

    JMenuItem mnuItTile = new JMenuItem();
    mnuItTile.setAction(_actionMap.get("tileFrames"));
    mnuWindow.add(mnuItTile);

    JMenuItem mnuItTileHorz = new JMenuItem();
    mnuItTileHorz.setAction(_actionMap.get("tileFramesHorizontally"));
    mnuWindow.add(mnuItTileHorz);

    JMenuItem mnuItArrangeIcons = new JMenuItem();
    mnuItArrangeIcons.setAction(_actionMap.get("arrangeIcons"));
    mnuWindow.add(mnuItArrangeIcons);

    JMenuItem mnuItCloseAll = new JMenuItem();
    mnuItCloseAll.setAction(_actionMap.get("closeAllFrames"));
    mnuWindow.add(mnuItCloseAll);

    mnuWindow.addSeparator();

    JMenuItem mnuItChooseFont = new JMenuItem();
    mnuItChooseFont.setAction(_actionMap.get("chooseFont"));
    mnuWindow.add(mnuItChooseFont);

    mnuWindow.addSeparator();

    JMenu mnuLF = new JMenu();
    mnuLF.setName("mnuLF");
    mnuLF.setText(_resourceMap.getString("mnuLF.text"));
    mnuWindow.add(mnuLF);

    JMenuItem mnuItMetalLF = new JMenuItem();
    mnuItMetalLF.setAction(_actionMap.get("metalLookAndFeel"));
    mnuLF.add(mnuItMetalLF);

    JMenuItem mnuItWindowsLF = new JMenuItem();
    mnuItWindowsLF.setAction(_actionMap.get("systemLookAndFeel"));
    mnuLF.add(mnuItWindowsLF);

    try {
        // Nimbus L&F was added in update java 6 update 10.
        Class.forName("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel").newInstance();
        JMenuItem mnuItNimbusLF = new JMenuItem();
        mnuItNimbusLF.setAction(_actionMap.get("nimbusLookAndFeel"));
        mnuLF.add(mnuItNimbusLF);
    } catch (Exception e) {
        // The Nimbus L&F is not available, no matter.
    }
    mnuWindow.addSeparator();

    int i = 1;
    for (final JInternalFrame frame : _frames) {
        JMenuItem windowItem = new JCheckBoxMenuItem();
        if (i < 10) {
            windowItem.setText(String.format("%d %s", i, frame.getTitle()));
            windowItem.setMnemonic(KeyEvent.VK_1 + (i - 1));
        } else {
            windowItem.setText(frame.getTitle());
        }
        windowItem.setSelected(frame.isSelected());
        windowItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    frame.setSelected(true);
                } catch (PropertyVetoException e1) {
                }
            }
        });
        mnuWindow.add(windowItem);
        ++i;
    }

}

From source file:org.pentaho.reporting.engine.classic.demo.ancient.demo.layouts.internalframe.InternalFrameDemoFrame.java

private JInternalFrame findSelectedFrame() {
    final JInternalFrame[] frames = desktop.getAllFrames();
    for (int i = 0; i < frames.length; i++) {
        final JInternalFrame frame = frames[i];
        if (frame.isSelected()) {
            return frame;
        }//w  ww  .  j  av a2  s .  c  om
    }
    return null;
}