Results 1 to 5 of 5

Thread: Creating an Internal Frame in java

  1. #1
    Join Date
    Nov 2009
    Posts
    678

    Creating an Internal Frame in java

    Hello, I am working on the java programming language. And while working on it I am not able to get the solution for the creating an frame inside the another frame. I have tried to get solution for it on internet, but I am not able to get the solution for it. One of my friend told me that I need to use the Internal Frame for it, but I don't know how to use it. So, if anyone knows how to use the Internal frame in java, then please help me to achieve it.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Creating an Internal Frame in java

    With the JInternalFrame class you can display a JFrame-like window within another window. Usually, you add internal frames to a desktop pane. The desktop pane, in turn, might be used as the content pane of a JFrame. The desktop pane is an instance of JDesktopPane, which is a subclass of JLayerdPane that has added API for managing multiple overlapping internal frames.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Creating an Internal Frame in java

    You need to make use of the JInternalFrame for this purpose. You can simply use the Contstructors and methods below for this purpose. JInternalFrame provide you following facility of constructor:

    • JInternalFrame()
    • JInternalFrame(String)
    • JInternalFrame(String, boolean)
    • JInternalFrame(String, boolean, boolean)
    • JInternalFrame(String, boolean, boolean, boolean)
    • JInternalFrame(String, boolean, boolean, boolean, boolean)
    • static int showInternalConfirmDialog(Component, Object)
    • static String showInternalInputDialog(Component, Object)
    • static Object showInternalMessageDialog(Component, Object)
    • static int showInternalOptionDialog(Component, Object, String, int, int, Icon, Object[], Object)

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Creating an Internal Frame in java

    Hello, the code below will simply solve your problem by making use of the program below. So, just make use of it and get your problem solved:
    Code:
    import java.awt.*;
    import javax.swing.*;
    public class IFrame
    {
       public static void main(String[] a) 
    {
          JFrame frame = new JFrame("Internal Frames");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(300,300);
          JDesktopPane desktop = new JDesktopPane();
          frame.setContentPane(desktop);
          JInternalFrame f = createFrame("FirstFrame");
          f.setLocation(10,10);
          desktop.add(f);
          f = createFrame("SecondFrame");
          f.setLocation(60,60);
          desktop.add(f);
          frame.setVisible(true);
       }
       private static JInternalFrame createFrame(String t) 
    {
          JInternalFrame Iframe = new JInternalFrame(t);
          f.setResizable(true);
          Iframe.setClosable(true);
          Iframe.setMaximizable(true);
          Iframe.setIconifiable(true);
          Iframe.setSize(200,200);
          Iframe.setVisible(true);
          return Iframe;
       }
    }

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Creating an Internal Frame in java

    For creating Internal Frame in java you first need to set the variables below:
    Code:
    boolean resizable = true;
    boolean closeable = true;
    boolean maximizable = true;
    boolean iconifiable = true;
    After that you can simply provide the size of the frame as below:
    Code:
    int wdth = 120;
    int hgt = 20;
    Then for creating the internal frame you need to use the code below:
    Code:
    JInternalFrame jinternalframe = new JInternalFrame("", resizable, closeable, maximizable, iconifiable);
    jinternalframe.setSize(wdth, hgt);
    JDesktopPane desktoppane = new JDesktopPane();
    desktoppane.add(jinternalframe);

Similar Threads

  1. What is the use of Frame class in java?
    By Truster in forum Software Development
    Replies: 5
    Last Post: 25-02-2010, 11:16 AM
  2. How to write an Internal Frame Listener in Java?
    By Soumen in forum Software Development
    Replies: 5
    Last Post: 13-02-2010, 12:27 AM
  3. Frame constructor in java
    By HardWeaR in forum Software Development
    Replies: 3
    Last Post: 08-12-2009, 02:46 PM
  4. Remove Title Bar of a Frame in Java
    By rashmi_ay in forum Software Development
    Replies: 4
    Last Post: 30-11-2009, 12:57 PM
  5. How to create button on frame in java?
    By JagdishP in forum Software Development
    Replies: 4
    Last Post: 10-08-2009, 06:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,585,883.67235 seconds with 17 queries