A quick setting up an Internal Frame in an application : InternalFrame « Swing JFC « Java






A quick setting up an Internal Frame in an application

A quick setting up an Internal Frame in an application
  
//A quick demonstration of setting up an Internal Frame in an application.

import java.awt.BorderLayout;
import java.awt.Frame;

import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;

public class SimpleInternalFrame extends Frame {
  JLayeredPane desktop;
  JInternalFrame internalFrame;
  public SimpleInternalFrame() {
    super("");
    setSize(500, 400);

    desktop = new JDesktopPane();
    desktop.setOpaque(true);
    add(desktop, BorderLayout.CENTER);

    internalFrame = new JInternalFrame("Meow", true, true, true, true);
    internalFrame.setBounds(50, 50, 200, 100);
    internalFrame.getContentPane().add(new JLabel(new ImageIcon("1.jpg")));
    internalFrame.setVisible(true);

    desktop.add(internalFrame, new Integer(1));
  }

  public static void main(String args[]) {
    SimpleInternalFrame sif = new SimpleInternalFrame();
    sif.setVisible(true);
  }
}



           
         
    
  








Related examples in the same category

1.A quick demonstration of setting up an internal frame in an applicationA quick demonstration of setting up an internal frame in an application
2.A simple extension of the JInternalFrame class that contains a list
3.JDesktopPane demoJDesktopPane demo
4.Working with Internal Frames within a Desktop
5.Internal Frames DemoInternal Frames Demo
6.JDesktopPane Cascade DemoJDesktopPane Cascade Demo
7.Java X WindowsJava X Windows
8.Desktop Manager DemoDesktop Manager Demo
9.Internal Frame Listener Demo Internal Frame Listener Demo
10.Layered Pane DemoLayered Pane Demo
11.LayeredPane Demo 2: Custom MDILayeredPane Demo 2: Custom MDI
12.LayeredPane Demo 3: Custom MDILayeredPane Demo 3: Custom MDI
13.LayeredPane Demo 4: Custom MDILayeredPane Demo 4: Custom MDI
14.Implements InternalFrameListenerImplements InternalFrameListener
15.InternalFrame demoInternalFrame demo
16.InternalFrameEvent DemoInternalFrameEvent Demo
17.A few interesting things using JInternalFrames, JDesktopPane, and DesktopManagerA few interesting things using JInternalFrames, JDesktopPane, and DesktopManager
18.Interesting things using JInternalFrames, JDesktopPane, and DesktopManager 2Interesting things using JInternalFrames, JDesktopPane, and DesktopManager 2
19.Make a JInternalFrame a tool window
20.Move JInternalFrame To Front
21.This program demonstrates the use of internal framesThis program demonstrates the use of internal frames