JFrame and JWindow Example
This JFrame and JWindow example displays a JFrame and a JWindow.The JWindow does not have the title bar, window-management buttons, or other trimmings associated with the JFrame but it can be displayed anywhere on the user's desktop.
// JFrame JWindow Example
import java.awt.*;
import javax.swing.*;
class JFrameJWindowExample {
public static void main(String[] args) {
JFrame jframe = new JFrame("Frame Title");
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jframe.setSize(100, 200);
jframe.setLocation(10, 0);
JWindow jwindow = new JWindow();
jwindow.setSize(100, 200);
jwindow.setLocation(10, 220);
Container fcp = jframe.getContentPane();
Container wcp = jwindow.getContentPane();
fcp.setBackground(Color.cyan);
wcp.setBackground(Color.magenta);
fcp.add(new JLabel("This is a JFrame",JLabel.CENTER));
wcp.add(new JLabel("This is a Window",JLabel.CENTER));
jframe.setVisible(true);
jwindow.setVisible(true);
}
}
