Example usage for javax.swing JInternalFrame setVisible

List of usage examples for javax.swing JInternalFrame setVisible

Introduction

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

Prototype

@BeanProperty(hidden = true, visualUpdate = true)
public void setVisible(boolean aFlag) 

Source Link

Document

Makes the component visible or invisible.

Usage

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);//  w w  w  . ja  v  a 2s. com
    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:Main.java

public static void main(String[] argv) throws Exception {
    boolean resizable = true;
    boolean closeable = true;
    boolean maximizable = true;
    boolean iconifiable = true;
    String title = "Frame Title";
    JInternalFrame iframe = new JInternalFrame(title, resizable, closeable, maximizable, iconifiable);

    iframe.setSize(300, 300);//from w w  w .  j av  a  2  s. c om
    iframe.setVisible(true);
    iframe.getContentPane().add(new JTextArea());
    JDesktopPane desktop = new JDesktopPane();
    desktop.add(iframe);

    JFrame frame = new JFrame();
    frame.getContentPane().add(desktop, BorderLayout.CENTER);
    frame.setSize(300, 300);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JPanel gui = new JPanel(new BorderLayout());
    gui.setPreferredSize(new Dimension(400, 100));

    JDesktopPane dtp = new JDesktopPane();
    gui.add(dtp, BorderLayout.CENTER);

    JButton newFrame = new JButton("Add Frame");

    ActionListener listener = new ActionListener() {
        private int disp = 10;

        @Override/*  ww w . ja v  a  2 s  .c  o m*/
        public void actionPerformed(ActionEvent e) {
            JInternalFrame jif = new JInternalFrame();
            dtp.add(jif);
            jif.setLocation(disp, disp);
            jif.setSize(100, 100);
            disp += 10;
            jif.setVisible(true);
        }
    };
    newFrame.addActionListener(listener);

    gui.add(newFrame, BorderLayout.PAGE_START);

    JFrame f = new JFrame();
    f.add(gui);
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.setLocationByPlatform(true);

    f.pack();
    f.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);

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);/*from w  ww  . j  av a2 s  .  com*/
    frame.setVisible(true);
}

From source file:VetoableChangeListenerDemo.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, true, true, true);

    palette.addVetoableChangeListener(new IconPolice());

    palette.setBounds(350, 150, 100, 100);
    desktop.add(palette, JDesktopPane.PALETTE_LAYER);
    palette.setVisible(true);

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);/*from  w w w.  j ava2s. co  m*/
    frame.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);

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);/*from  w w w .  j  ava  2  s. co  m*/
    frame.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, true, true, true);
    palette.addPropertyChangeListener(new InternalFramePropertyChangeHandler());
    palette.setBounds(350, 150, 100, 100);
    desktop.add(palette, JDesktopPane.PALETTE_LAYER);
    palette.setVisible(true);

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);/*w  w w .  java2 s  . c om*/
    frame.setVisible(true);
}

From source file:AddingInternalFramestoaJDesktopPane.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  w  ww .  j av 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);

    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);// w  w w .j a  v a  2s .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: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   w w  w  .  ja va  2  s . com*/

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

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

    internalFrame.setVisible(true);

    DesktopManager desktopManager = desktop.getDesktopManager();
    desktopManager.deactivateFrame(internalFrame);

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