Example usage for javax.swing JDesktopPane JDesktopPane

List of usage examples for javax.swing JDesktopPane JDesktopPane

Introduction

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

Prototype

public JDesktopPane() 

Source Link

Document

Creates a new JDesktopPane.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JDesktopPane desktop = new JDesktopPane();
    JInternalFrame[] frames = desktop.getAllFrames();

    for (int i = 0; i < frames.length; i++) {
        String title = frames[i].getTitle();
        boolean isVisible = frames[i].isVisible();
        boolean isCloseable = frames[i].isClosable();
        boolean isResizeable = frames[i].isResizable();
        boolean isIconifiable = frames[i].isIconifiable();
        boolean isIcon = frames[i].isIcon();
        boolean isMaximizable = frames[i].isMaximizable();
        boolean isSelected = frames[i].isSelected();
    }//from  w  w w . ja v  a 2 s  . co m
}

From source file:Main.java

public static void main(String[] args) {
    JDesktopPane dp = new JDesktopPane();
    JInternalFrame inf = new JInternalFrame("Help", true, true, true, true);
    inf.setSize(200, 200);/*from  www  .j  av a2  s  .  c om*/
    inf.setVisible(true);
    dp.add(inf);

    JButton btn = new JButton("Click");
    btn.addActionListener(e -> JOptionPane.showInternalInputDialog(inf, "Hit me"));
    inf.add(btn);

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLayout(new BorderLayout());
    f.add(dp);
    f.setSize(400, 400);
    f.setVisible(true);
}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JDesktopPane desktop = new JDesktopPane();

    JInternalFrame palette = new JInternalFrame("Palette", true, false, true, false);
    palette.setBounds(350, 150, 100, 100);
    palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
    desktop.add(palette, JDesktopPane.PALETTE_LAYER);
    palette.setVisible(true);/*from  w w w.  j av a 2s . co  m*/

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);
    frame.setVisible(true);
}

From source file:InternalFramePaletteSample.java

public static void main(final String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JDesktopPane desktop = new JDesktopPane();

    JInternalFrame palette = new JInternalFrame("Palette", true, false, true, false);
    palette.setBounds(350, 150, 100, 100);
    palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
    desktop.add(palette, JDesktopPane.PALETTE_LAYER);
    palette.setVisible(true);/*w w  w.j  av  a  2s.com*/

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JDesktopPane desktop = new JDesktopPane();
    JInternalFrame internalFrame = new JInternalFrame("Can Do All", true, true, true, true);

    desktop.add(internalFrame);//from  www.ja v a2 s  .  c o  m

    internalFrame.setBounds(25, 25, 200, 100);

    JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER);
    internalFrame.add(label, BorderLayout.CENTER);

    internalFrame.setVisible(true);

    desktop.getDesktopManager().maximizeFrame(internalFrame);

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] a) {
    Icon blueIcon = new MyIcon(Color.BLUE);
    Object stringArray[] = { "Do It", "No Way" };
    JOptionPane.showOptionDialog(new JDesktopPane(), "Continue printing?", "Select an Option",
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, blueIcon, stringArray, stringArray[0]);

}

From source file:Main.java

public static void main(String args[]) {
    JFrame f = new JFrame("Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLayeredPane desktop = new JDesktopPane();
    desktop.setOpaque(false);/*w w w  .ja  va  2s. c  om*/
    desktop.add(new SelfInternalFrame("1"), JLayeredPane.POPUP_LAYER);
    f.add(desktop, BorderLayout.CENTER);
    f.setSize(300, 200);
    f.setVisible(true);
}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JDesktopPane desktop = new JDesktopPane();
    JInternalFrame internalFrames[] = { new JInternalFrame("Can Do All", true, true, true, true),
            new JInternalFrame("Not Resizable", false, true, true, true),
            new JInternalFrame("Not Closable", true, false, true, true),
            new JInternalFrame("Not Maximizable", true, true, false, true),
            new JInternalFrame("Not Iconifiable", true, true, true, false) };

    int pos = 0;/*from   w  w  w.  j  av  a 2s .c  o  m*/
    for (JInternalFrame internalFrame : internalFrames) {
        desktop.add(internalFrame);

        internalFrame.setBounds(pos * 25, pos * 25, 200, 100);
        pos++;

        JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER);
        internalFrame.add(label, BorderLayout.CENTER);

        internalFrame.setVisible(true);
    }

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JDesktopPane desktop = new JDesktopPane();

    JInternalFrame internalFrames[] = { new JInternalFrame("Can Do All", true, true, true, true),
            new JInternalFrame("Not Resizable", false, true, true, true),
            new JInternalFrame("Not Closable", true, false, true, true),
            new JInternalFrame("Not Maximizable", true, true, false, true),
            new JInternalFrame("Not Iconifiable", true, true, true, false) };

    int pos = 0;/*from  w  w w  .  j av a 2  s.com*/
    for (JInternalFrame internalFrame : internalFrames) {
        desktop.add(internalFrame);

        internalFrame.setBounds(pos * 25, pos * 25, 200, 100);
        pos++;

        JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER);
        internalFrame.add(label, BorderLayout.CENTER);

        internalFrame.setVisible(true);
    }
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

    JInternalFrame iFrame = desktop.getSelectedFrame();

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JDesktopPane desktop = new JDesktopPane();

    JInternalFrame internalFrames[] = { new JInternalFrame("Can Do All", true, true, true, true),
            new JInternalFrame("Not Resizable", false, true, true, true),
            new JInternalFrame("Not Closable", true, false, true, true),
            new JInternalFrame("Not Maximizable", true, true, false, true),
            new JInternalFrame("Not Iconifiable", true, true, true, false) };

    int pos = 0;//from   w  ww .  j a  va  2  s  .  c o m
    for (JInternalFrame internalFrame : internalFrames) {
        desktop.add(internalFrame);

        internalFrame.setBounds(pos * 25, pos * 25, 200, 100);
        pos++;

        JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER);
        internalFrame.add(label, BorderLayout.CENTER);

        internalFrame.setVisible(true);
    }
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

    int dragMode = desktop.getDragMode();

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);
    frame.setVisible(true);
}