Question

what are the techniques for displaying the JInternalFrame?

Follow f = new Follow();

Follow is my JInternalFrame and i want to print that on JFrame. In JFramethere is already one JInternalFrame is running. and i want to print this JInternalFrame over that like ConfirmDialog.

Was it helpful?

Solution

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/** Simple example illustrating the use of internal frames.
 * 
 */

public class JInternalFrames extends JFrame {
  public static void main(String[] args) {
    new JInternalFrames();
  }

  public JInternalFrames() {
    super("Multiple Document Interface");
    WindowUtilities.setNativeLookAndFeel();
    addWindowListener(new ExitListener());
    Container content = getContentPane();
    content.setBackground(Color.white);
    JDesktopPane desktop = new JDesktopPane();
    desktop.setBackground(Color.white);
    content.add(desktop, BorderLayout.CENTER);
    setSize(450, 400);
    for(int i=0; i<5; i++) {
      JInternalFrame frame
        = new JInternalFrame(("Internal Frame " + i),
                             true, true, true, true);
      frame.setLocation(i*50+10, i*50+10);
      frame.setSize(200, 150);
      frame.setBackground(Color.white);
      desktop.add(frame);
      frame.moveToFront();
    }
    setVisible(true);
  }
}

enter image description here

One more tutorial is on Java Tutorials Code Sample – InternalFrameDemo.java

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top