Results 1 to 6 of 6

Thread: Confused about JRootPane class of java

  1. #1
    Join Date
    Dec 2009
    Posts
    37

    Confused about JRootPane class of java

    Hello Friend,

    I need you help to solve one of my confusion which is related to the java classes. I want to e aware about the JRootPane class of java programming. According to my knowledge it most important class of the java. I don't know anything about this JRootPane class. I wonder if you are able to let me know something about JRootPane class of java along with suitable example. I am waiting for your reply.

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

    Re: Confused about JRootPane class of java

    A JRootPane is a lightweight container used behind the scenes by JFrame, JDialog, JWindow, JApplet, and JInternalFrame. If you replace the LayoutManager of the JRootPane, you are responsible for managing all of these views. So ordinarily you will want to be sure that you change the layout manager for the contentPane rather than for the JRootPane itself. The painting architecture of Swing requires an opaque JComponent to exist in the containment hieararchy above all other components.

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

    Re: Confused about JRootPane class of java

    Please study following simple example of JRootPane class of java:
    Code:
    import javax.swing.JRootPane;
    import javax.swing.JFrame;
    
    public class JRootPaneDemo
     {
    
      public static void main(final String args[]) {
        JFrame JN = new JFrame("Adornment Example");
        JN.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JN.setUndecorated(true);
        JN.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
        JN.setSize(200, 100);
        JN.setVisible(true);
    
      }
    }

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

    Re: Confused about JRootPane class of java

    Hi friend,

    Please refer following some mostly used methods of JRootPane class:
    • setWindowDecorationStyle(int StylewindowDecoration)
    • setUI(RootPaneUI rui)
    • setMenuBar(JMenuBar jmenu)
    • setLayeredPane(JLayeredPane jlyrdpane)
    • setJMenuBar(JMenuBar jmenu)
    • setGlassPane(Component gls)

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

    Re: Confused about JRootPane class of java

    Hi,

    The following example of JRootPane class shows the implementation of addAncestorListener():
    Code:
    javax.swing.JRootPane
    public class JRootDMN {
      public static void main (String args[]) {
        JFrame FE = new JFrame("Ancestor Sampler");
        FE.setDeFEaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        AncestorListener ancestorListener1 = new AncestorListener() {
          public void ancestorAdded(AncestorEvent ancestorEvent) {
            System.out.println ("Added");
          }
          public void ancestorMoved(AncestorEvent ancestorEvent) {
            System.out.println ("Moved");
          }
          public void ancestorRemoved(AncestorEvent ancestorEvent) {
            System.out.println ("Removed");
          }
        };
        FE.getRootPane().addAncestorListener(ancestorListener);
        FE.getRootPane().setVisible(FEalse);
        FE.getRootPane().setVisible(true);
        FE.setSize (400, 200);
        FE.setVisible (true);
      }

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

    Re: Confused about JRootPane class of java

    A JRootPane class of java support various nested classes, see below:
    1. JRootPane.AccessibleJRootPane
    2. Component.BaselineResizeBehavior
    3. JRootPane.RootLayout
    4. JComponent.AccessibleJComponent
    5. Container.AccessibleAWTContainer
    6. Component.FlipBufferStrategy

Similar Threads

  1. Converting java class to java bean class
    By Ucchal in forum Software Development
    Replies: 6
    Last Post: 09-08-2010, 10:24 AM
  2. Confused with GraphicsDevice class of java
    By Gokul20 in forum Software Development
    Replies: 5
    Last Post: 27-02-2010, 08:09 AM
  3. Confused with JComponent class
    By Owen Fernandes in forum Software Development
    Replies: 5
    Last Post: 18-02-2010, 09:27 AM
  4. Confused about JMenuItem class of java
    By Sarfaraj Khan in forum Software Development
    Replies: 5
    Last Post: 16-02-2010, 12:23 PM
  5. Confused about PrintWriter class of Java
    By ScarFace 01 in forum Software Development
    Replies: 5
    Last Post: 21-01-2010, 09:09 AM

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,714,165,304.51414 seconds with 17 queries