Results 1 to 6 of 6

Thread: How to use RootPaneContainer interface

  1. #1
    Join Date
    Jan 2010
    Posts
    42

    How to use RootPaneContainer interface

    Hello friends,

    I have to discuss one of my confusion about the java inbuilt classes. I want to be aware about the 'RootPaneContainer interface' of java. I don't have any idea about this java interface. Evan I don't know anything about it's methods. If anyone has knowledge about the RootPaneContainer interface of java, then please let me aware about that. It will be great if you provide suitable example for RootPaneContainer interface.

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

    Re: How to use RootPaneContainer interface

    The RootPaneContainer interface is implemented by components that have a single JRootPane child: JDialog, JFrame, JWindow, JApplet, JInternalFrame. The methods in this interface are just covers for the JRootPane properties. This interface serves as a marker for Swing GUI builders that need to treat components like JFrame, that contain a single JRootPane, specially. For example in a GUI builder, dropping a component on a RootPaneContainer would be interpreted as frame.getContentPane().add(child).

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: How to use RootPaneContainer interface

    Hi,

    Following java program will demonstrate you the use of RootPaneContainer interface:
    Code:
    import javax.swing.RootPaneContainer;
    import javax.swing.SwingUtilities;
    
    public class RootPaneContainerDM
     {
    
      public static Component findComponentUnderGlassPaneAt(Point p1, Component top1) {
        Component c1 = null;
    
        if (top1.isShowing()) {
          if (top1 instanceof RootPaneContainer)
            c1 =
            ((RootPaneContainer) top1).getLayeredPane().findComponentAt(
                SwingUtilities.convertPoint(top1, p1, ((RootPaneContainer) top1).getLayeredPane()));
          else
            c1 = ((Container) top1).findComponentAt(p1);
        }
    
        return c1;
      }
    
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to use RootPaneContainer interface

    I suggest you to study following methods of RootPaneContainer interface withe their parameters:
    • setLayeredPane(JLayeredPane lyrdPn)
    • setGlassPane(Component glsPane)
    • getRootPane()
    • getLayeredPane()
    • setContentPane(Container cntPane)
    • getContentPane()

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: How to use RootPaneContainer interface

    Hi friend,

    In following java code I have used RootPaneContainer interface, review it carefully:
    Code:
    import javax.swing.RootPaneContainer;
    
    public class RootPaneContainerSD extends JFrame
    {
      public RootPaneContainerSD() 
      {
        super("Custom MDI: Part V");
        setSize(550,400);
        getContentPane().setBackground(new Color(254,222,142));
    
        setLayeredPane(new MDIPane());
       
        ImageIcon ii1 = new ImageIcon("earth.jpg");
        InnerFrame[] frames1 = new InnerFrame[5];
        for(int i1=0; i<5; i++) 
        {
          frames1[i1] = new InnerFrame("InnerFrame " + i);
          frames1[i1].setBounds(60+i1*20, 50+i*20, 300, 200);
          frames1[i1].getContentPane().add(
           new JScrollPane(new JLabel(ii1)));
          getLayeredPane().add(frames[i1]);
        }
    
        WindowListener l1 = new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }    }
        setVisible(true);
      }
      public static void main(String[] arngs) 
      {
        new RootPaneContainerSD();
      }
    }

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to use RootPaneContainer interface

    A RootPaneContainer interface of advanced java used to access the properties JRootPane. This interface implements five interfaces namely JApplet, JJInternalFrame, JWindow, Dialog, JFrame. It's getRootPane() is used for to return JRootPane child of give component. In other word RootPaneContainer interface is very important part of the Swing GUI builder. If you want to return layeredPane then you need to use getLayeredPane() of this interface.

Similar Threads

  1. Replies: 7
    Last Post: 22-10-2011, 10:35 PM
  2. what is interface in java
    By Ansari Bros in forum Software Development
    Replies: 4
    Last Post: 10-01-2011, 10:07 AM
  3. Interface in C programming
    By Quattro in forum Software Development
    Replies: 4
    Last Post: 02-03-2010, 07:08 PM
  4. How to use BoundedRangeModel interface?
    By archer in forum Software Development
    Replies: 5
    Last Post: 22-02-2010, 01:23 PM
  5. pc to rc car interface
    By agpraneet in forum Hardware Peripherals
    Replies: 6
    Last Post: 20-07-2009, 04:14 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,751,682,523.82628 seconds with 16 queries