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:Figure3.java

private void addFrame(int number) {
    JInternalFrame f = new JInternalFrame("Frame " + number, true, true, true, true);
    f.setBounds(number * 10 - 5, number * 10 - 5, 250, 150);
    desk.add(f, 1);/* w w  w .  jav a  2 s .  co m*/
    f.setVisible(true);
}

From source file:Main.java

private JInternalFrame createFrame(final Image image) {
    frames++;/*  w  w w  .  j av  a2 s  .  c  om*/
    final JInternalFrame frame = new JInternalFrame("Picture " + frames);
    frame.add(BorderLayout.CENTER, new JLabel(new ImageIcon(image)));
    frame.pack();
    frame.setVisible(true);
    frame.setLocation(40 * frames, 40 * frames);
    return frame;
}

From source file:ScrollDesktop.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JDesktopPane desk = new ScrollDesktop();
    desk.setPreferredSize(new Dimension(1000, 1000));
    getContentPane().add(new JScrollPane(desk), "Center");
    JInternalFrame f1 = new JInternalFrame("Frame 1");
    f1.getContentPane().add(new JLabel("This is frame f1"));
    f1.setResizable(true);//from ww w.  ja  v  a2  s .c o  m
    f1.pack();
    f1.setVisible(true);
    desk.add(f1, new Integer(10));

    JInternalFrame f2 = new JInternalFrame("Frame 2");
    f2.getContentPane().add(new JLabel("Content for f2"));
    f2.setResizable(true);
    f2.pack();
    f2.setVisible(true);
    desk.add(f2, new Integer(20));

    JInternalFrame f3 = new JInternalFrame("Frame 3");
    f3.getContentPane().add(new JLabel("Content for f3"));
    f3.setResizable(true);
    f3.pack();
    f3.setVisible(true);
    desk.add(f3, new Integer(20));

    f3.toFront();
    try {
        f3.setSelected(true);
    } catch (java.beans.PropertyVetoException ignored) {
    }

    pack();
    setSize(300, 300);
    setVisible(true);
}

From source file:org.jfree.chart.demo.InternalFrameDemo.java

/**
 * Creates a new instance of the demo./*from   w  w  w  . j  a va  2s .  c om*/
 * 
 * @param title  the title.
 */
public InternalFrameDemo(final String title) {
    super(title);
    final JDesktopPane desktopPane = new JDesktopPane();
    desktopPane.setPreferredSize(new Dimension(600, 400));
    final JInternalFrame frame1 = createFrame1();
    desktopPane.add(frame1);
    frame1.pack();
    frame1.setVisible(true);
    final JInternalFrame frame2 = createFrame2();
    desktopPane.add(frame2);
    frame2.pack();
    frame2.setLocation(100, 200);
    frame2.setVisible(true);
    getContentPane().add(desktopPane);
}

From source file:OptPaneComparison.java

public OptPaneComparison(final String message) {
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    final int msgType = JOptionPane.QUESTION_MESSAGE;
    final int optType = JOptionPane.OK_CANCEL_OPTION;
    final String title = message;

    setSize(350, 200);/*  w  w w.j  a  v a2  s  .c om*/

    // Create a desktop for internal frames
    final JDesktopPane desk = new JDesktopPane();
    setContentPane(desk);

    // Add a simple menu bar
    JMenuBar mb = new JMenuBar();
    setJMenuBar(mb);

    JMenu menu = new JMenu("Dialog");
    JMenu imenu = new JMenu("Internal");
    mb.add(menu);
    mb.add(imenu);
    final JMenuItem construct = new JMenuItem("Constructor");
    final JMenuItem stat = new JMenuItem("Static Method");
    final JMenuItem iconstruct = new JMenuItem("Constructor");
    final JMenuItem istat = new JMenuItem("Static Method");
    menu.add(construct);
    menu.add(stat);
    imenu.add(iconstruct);
    imenu.add(istat);

    // Create our JOptionPane. We're asking for input, so we call
    // setWantsInput.
    // Note that we cannot specify this via constructor parameters.
    optPane = new JOptionPane(message, msgType, optType);
    optPane.setWantsInput(true);

    // Add a listener for each menu item that will display the appropriate
    // dialog/internal frame
    construct.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {

            // Create and display the dialog
            JDialog d = optPane.createDialog(desk, title);
            d.setVisible(true);

            respond(getOptionPaneValue());
        }
    });

    stat.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            String s = JOptionPane.showInputDialog(desk, message, title, msgType);
            respond(s);
        }
    });

    iconstruct.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {

            // Create and display the dialog
            JInternalFrame f = optPane.createInternalFrame(desk, title);
            f.setVisible(true);

            // Listen for the frame to close before getting the value from
            // it.
            f.addPropertyChangeListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent ev) {
                    if ((ev.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY))
                            && (ev.getNewValue() == Boolean.TRUE)) {
                        respond(getOptionPaneValue());
                    }
                }
            });
        }
    });

    istat.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            String s = JOptionPane.showInternalInputDialog(desk, message, title, msgType);
            respond(s);
        }
    });
}

From source file:Main.java

public Main() {
    JInternalFrame frame1 = new JInternalFrame("Frame 1", true, true, true, true);

    JInternalFrame frame2 = new JInternalFrame("Frame 2", true, true, true, true);

    frame1.getContentPane().add(new JLabel("Frame 1  contents..."));
    frame1.pack();/* w  w  w  .  j a  v  a 2s .c  o  m*/
    frame1.setVisible(true);

    frame2.getContentPane().add(new JLabel("Frame 2  contents..."));
    frame2.pack();
    frame2.setVisible(true);

    int x2 = frame1.getX() + frame1.getWidth() + 10;
    int y2 = frame1.getY();
    frame2.setLocation(x2, y2);

    desktopPane.add(frame1);
    desktopPane.add(frame2);

    this.add(desktopPane, BorderLayout.CENTER);

    this.setMinimumSize(new Dimension(300, 300));
}

From source file:fr.crnan.videso3d.ihm.PLNSPanel.java

private void addChart(JFreeChart chart) {
    ChartPanel panel = new ChartPanel(chart);
    chartPanels.add(panel);//  ww  w  .  ja v a  2 s . c o  m
    JInternalFrame frame = new JInternalFrame(chart.getTitle().getText(), true, false, true, true);
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);
    desktop.add(frame);
    desktop.tile(true);
    if (chartMouseListener != null) {
        panel.addChartMouseListener(chartMouseListener);
    }
}

From source file:flow.visibility.pcap.FlowProcess.java

/** function to create internal frame contain flow details */

public static JInternalFrame FlowInspection() {

    final StringBuilder errbuf = new StringBuilder(); // For any error msgs  
    final String file = "tmp-capture-file.pcap";

    //System.out.printf("Opening file for reading: %s%n", file);  

    /*************************************************************************** 
     * Second we open up the selected file using openOffline call 
     **************************************************************************/
    Pcap pcap = Pcap.openOffline(file, errbuf);

    if (pcap == null) {
        System.err.printf("Error while opening device for capture: " + errbuf.toString());
    }/*w  ww. j a  v  a2s .co m*/

    /** create blank internal frame */

    JInternalFrame FlowInspection = new JInternalFrame("Flow Inspection", true, true, true, true);
    FlowInspection.setBounds(601, 0, 600, 660);
    JTextArea textArea2 = new JTextArea(50, 10);
    PrintStream printStream2 = new PrintStream(new CustomOutputStream(textArea2));
    System.setOut(printStream2);
    System.setErr(printStream2);
    JScrollPane scrollPane2 = new JScrollPane(textArea2);
    FlowInspection.add(scrollPane2);

    JPacketHandler<String> jpacketHandler = new JPacketHandler<String>() {

        public void nextPacket(JPacket packet, String user) {
            final JCaptureHeader header = packet.getCaptureHeader();
            System.out.printf("========================= Next Packet ===============================\n");
            System.out.printf("Packet caplen=%d wirelen=%d\n", header.caplen(), header.wirelen());
            System.out.println(packet.toString());

        }
    };

    Pcap pcap3 = Pcap.openOffline(file, errbuf);

    /** Redirect Output into the Frame Text Area */

    FlowInspection.setVisible(true);
    pcap3.loop(Pcap.LOOP_INFINITE, jpacketHandler, null);
    FlowInspection.revalidate();
    pcap3.close();

    return FlowInspection;

}

From source file:Vista.Main.java

private void itemGraficoTemperaturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemGraficoTemperaturaActionPerformed
    // TODO add your handling code here:
    controladorLecturas = new ControladorLecturas(dcInicio.getCurrent().getTime(),
            dcFinal.getCurrent().getTime());
    JInternalFrame jInternalFrame = controladorLecturas.graficoTemperatura();
    desktopPane.add(jInternalFrame);/* www.  j  a  va2  s  . c  o  m*/
    jInternalFrame.setVisible(true);
}

From source file:Vista.Main.java

private void itemGraficoHumedadSueloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemGraficoHumedadSueloActionPerformed
    // TODO add your handling code here:
    controladorLecturas = new ControladorLecturas(dcInicio.getCurrent().getTime(),
            dcFinal.getCurrent().getTime());
    JInternalFrame jInternalFrame = controladorLecturas.graficoHumedadSuelo();
    desktopPane.add(jInternalFrame);/* ww  w .j  av  a2 s  .  c om*/
    jInternalFrame.setVisible(true);
}