Java Code Examples for javax.swing.JInternalFrame#setVisible()

The following examples show how to use javax.swing.JInternalFrame#setVisible() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test6505027.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 2
Source File: Test6505027.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public Test6505027(JFrame main) {
    Container container = main;
    if (INTERNAL) {
        JInternalFrame frame = new JInternalFrame();
        frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
        frame.setVisible(true);

        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame, new Integer(1));

        container.add(desktop);
        container = frame;
    }
    if (TERMINATE) {
        this.table.putClientProperty(KEY, Boolean.TRUE);
    }
    TableColumn column = this.table.getColumn(COLUMNS[1]);
    column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));

    container.add(BorderLayout.NORTH, new JTextField());
    container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
 
Example 3
Source File: DockIconRepaint.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void createUI() {
    frame = new JFrame();
    frame.setUndecorated(true);
    frame.setSize(300, 300);
    frame.setLocationRelativeTo(null);
    final JDesktopPane pane = new JDesktopPane();
    final JPanel panel = new JPanel() {
        @Override
        protected void paintComponent(Graphics g) {
            g.setColor(color);
            g.fillRect(0, 0, getWidth(), getHeight());
        }
    };
    jif = new JInternalFrame();
    jif.add(panel);
    jif.setVisible(true);
    jif.setSize(300, 300);
    pane.add(jif);
    frame.add(pane);
    frame.setVisible(true);
}
 
Example 4
Source File: MetalworksFrame.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void newDocument() {
    JInternalFrame doc = new MetalworksDocumentFrame();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 5
Source File: Test6325652.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static JInternalFrame create(int index) {
    String text = "test" + index; // NON-NLS: frame identification
    index = index * 3 + 1;

    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
 
Example 6
Source File: MetalworksFrame.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void openInBox() {
    JInternalFrame doc = new MetalworksInBox();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 7
Source File: MetalworksFrame.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void openHelpWindow() {
    JInternalFrame help = new MetalworksHelp();
    desktop.add(help, HELPLAYER);
    try {
        help.setVisible(true);
        help.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 8
Source File: QOptionPane.java    From pumpernickel with MIT License 5 votes vote down vote up
public JInternalFrame showDialog(JDesktopPane desktopPane) {
	String title = getDialogTitle();
	DialogFooter footer = getDialogFooter();
	boolean closeable = true;
	if (footer != null) {
		closeable = footer.containsButton(DialogFooter.CANCEL_OPTION);
	}
	JInternalFrame dialog = new JInternalFrame(title, false, closeable);
	dialog.getContentPane().add(createDebugPanel());
	dialog.pack();
	dialog.setVisible(true);
	desktopPane.add(dialog);
	return dialog;
}
 
Example 9
Source File: MetalworksFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void openHelpWindow() {
    JInternalFrame help = new MetalworksHelp();
    desktop.add(help, HELPLAYER);
    try {
        help.setVisible(true);
        help.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 10
Source File: JInternalFrameMoveOverlapping.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void prepareControls() {


    JDesktopPane desktopPane = new JDesktopPane();

    JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false);
    bottomFrame.setSize(220, 220);
    super.propagateAWTControls(bottomFrame);
    desktopPane.add(bottomFrame);
    bottomFrame.setVisible(true);

    JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false);
    topFrame.setSize(200, 200);
    topFrame.add(new JButton("LW Button") {

        {
            addMouseListener(new MouseAdapter() {

                @Override
                public void mouseClicked(MouseEvent e) {
                    lwClicked = true;
                }
            });
        }
    });
    desktopPane.add(topFrame);
    topFrame.setVisible(true);

    JFrame frame = new JFrame("Test Window");
    frame.setSize(300, 300);
    frame.setContentPane(desktopPane);
    frame.setVisible(true);

    locTopFrame = topFrame.getLocationOnScreen();
    locTarget = new Point(locTopFrame.x + bottomFrame.getWidth() / 2, locTopFrame.y + bottomFrame.getHeight()/2);
}
 
Example 11
Source File: bug8069348.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void createAndShowGUI() {

        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JDesktopPane desktopPane = new JDesktopPane();
        desktopPane.setBackground(DESKTOPPANE_COLOR);

        internalFrame = new JInternalFrame("Test") {

            @Override
            public void paint(Graphics g) {
                super.paint(g);
                g.setColor(FRAME_COLOR);
                g.fillRect(0, 0, getWidth(), getHeight());
            }
        };
        internalFrame.setSize(WIN_WIDTH / 3, WIN_HEIGHT / 3);
        internalFrame.setVisible(true);
        desktopPane.add(internalFrame);

        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        panel.add(desktopPane, BorderLayout.CENTER);
        frame.add(panel);
        frame.setSize(WIN_WIDTH, WIN_HEIGHT);
        frame.setVisible(true);
        frame.requestFocus();
    }
 
Example 12
Source File: MetalworksFrame.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void openInBox() {
    JInternalFrame doc = new MetalworksInBox();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 13
Source File: MetalworksFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void openInBox() {
    JInternalFrame doc = new MetalworksInBox();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 14
Source File: MetalworksFrame.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void openHelpWindow() {
    JInternalFrame help = new MetalworksHelp();
    desktop.add(help, HELPLAYER);
    try {
        help.setVisible(true);
        help.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 15
Source File: MetalworksFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void newDocument() {
    JInternalFrame doc = new MetalworksDocumentFrame();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 16
Source File: MetalworksFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void newDocument() {
    JInternalFrame doc = new MetalworksDocumentFrame();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 17
Source File: MarqueeBanner.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void centerLocation(JInternalFrame jif) {
	Dimension desktopSize = desktop.getSize();
	Dimension jInternalFrameSize = jif.getSize();
	int width = (desktopSize.width - jInternalFrameSize.width) / 2;
	int height = (desktopSize.height - jInternalFrameSize.height) / 2;
	jif.setLocation(width, height);
	jif.setVisible(true);
}
 
Example 18
Source File: MetalworksFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void newDocument() {
    JInternalFrame doc = new MetalworksDocumentFrame();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 19
Source File: MetalworksFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void newDocument() {
    JInternalFrame doc = new MetalworksDocumentFrame();
    desktop.add(doc, DOCLAYER);
    try {
        doc.setVisible(true);
        doc.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
 
Example 20
Source File: Canvas.java    From freecol with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Adds a component on this Canvas inside a frame.
 *
 * @param comp The component to add to the canvas.
 * @param toolBox Should be set to true if the resulting frame is
 *     used as a toolbox (that is: it should not be counted as a
 *     frame).
 * @param popupPosition A preferred {@code PopupPosition}.
 * @param resizable Whether this component can be resized.
 * @return The {@code JInternalFrame} that was created and added.
 */
private JInternalFrame addAsFrame(JComponent comp, boolean toolBox,
                                  PopupPosition popupPosition,
                                  boolean resizable) {
    final int FRAME_EMPTY_SPACE = 60;

    final JInternalFrame f = (toolBox) ? new ToolBoxFrame()
        : new JInternalFrame();
    Container con = f.getContentPane();
    if (con instanceof JComponent) {
        JComponent c = (JComponent)con;
        c.setOpaque(false);
        c.setBorder(null);
    }

    if (comp.getBorder() != null) {
        if (comp.getBorder() instanceof EmptyBorder) {
            f.setBorder(Utility.blankBorder(10, 10, 10, 10));
        } else {
            f.setBorder(comp.getBorder());
            comp.setBorder(Utility.blankBorder(5, 5, 5, 5));
        }
    } else {
        f.setBorder(null);
    }

    final FrameMotionListener fml = new FrameMotionListener(f);
    comp.addMouseMotionListener(fml);
    comp.addMouseListener(fml);
    if (f.getUI() instanceof BasicInternalFrameUI) {
        BasicInternalFrameUI biu = (BasicInternalFrameUI) f.getUI();
        biu.setNorthPane(null);
        biu.setSouthPane(null);
        biu.setWestPane(null);
        biu.setEastPane(null);
    }

    f.getContentPane().add(comp);
    f.setOpaque(false);
    f.pack();
    int width = f.getWidth();
    int height = f.getHeight();
    if (width > getWidth() - FRAME_EMPTY_SPACE) {
        width = Math.min(width, getWidth());
    }
    if (height > getHeight() - FRAME_EMPTY_SPACE) {
        height = Math.min(height, getHeight());
    }
    f.setSize(width, height);
    Point p = chooseLocation(comp, width, height, popupPosition);
    f.setLocation(p);
    this.addToCanvas(f, MODAL_LAYER);
    f.setName(comp.getClass().getSimpleName());

    f.setFrameIcon(null);
    f.setVisible(true);
    f.setResizable(resizable);
    try {
        f.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {}

    return f;
}