Closed Thread
Results 1 to 5 of 5

Thread: JFrame

  1. #1
    R3.RyozKidz Guest

    JFrame

    i want to ask about when i have added all the components i needed , then i will add into the JFrame ...~ i want to use getContentPane or setContentPane ...?

  2. CODECALL Circuit advertisement

     
  3. #2
    SterAllures's Avatar
    SterAllures is offline Programming Professional
    Join Date
    Mar 2009
    Location
    Netherlands
    Posts
    203
    Rep Power
    12

    Re: JFrame

    Not really sure what you mean but I think.

    Create a container

    like this:

    Code:
    Container c getContentPane(); 

    than add things like this:

    Code:
    c.add(); 

    and You've already called the JFrame at your class name.

    Code:
    public class MyFrame extends JFrame 
    4d 65 6c 76 69 6e 0d 0a
    "If happiness was the national currency, what kind of work would make you rich?"

  4. #3
    R3.RyozKidz Guest

    Re: JFrame

    this is what i normally do
    Code:
    public class XXX extends JPanel
    {
        ....
        JFrame frame = new JFrame();
        super(new layout());
        JButton jjj = new JButton();
        
        this.add(jjj); // adding JComponent into the light weight container JPanel
        frame.setContentPane(this);
        
        ...
    }
    Is it the same if i invoke the method of JFrame class setContentPane?

  5. #4
    R3.RyozKidz Guest

    Re: JFrame

    Or can i do it like this ?
    Code:
    public class XXX extends JFrame
    {
        ...
        JPanel panel = new JPanel(new Layout());
        super();
        Container c = new Container();
        
        //adding JComponent into the panel
        panel.add(JComponent);
        
        c = getContentPane();
        c.add(panel);
        
        ...
    }

  6. #5
    GMVResources's Avatar
    GMVResources is offline Learning Programmer
    Join Date
    Jun 2010
    Posts
    72
    Rep Power
    0

    Re: JFrame

    I think it is get.ContentPane

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How Can I Make My JFileChooser Look Like My JFrame ?
    By xxxxjayxxx in forum Java Help
    Replies: 1
    Last Post: 05-04-2011, 11:45 AM
  2. Need help with extended JFrame
    By TheCompBoy in forum Java Help
    Replies: 11
    Last Post: 04-10-2011, 01:55 AM
  3. new JFrame position
    By alix in forum Java Help
    Replies: 3
    Last Post: 01-06-2011, 02:23 PM
  4. JFrame help
    By agnl666 in forum Java Help
    Replies: 4
    Last Post: 03-29-2010, 07:20 PM
  5. Topless JFrame
    By ld_pvl in forum Java Help
    Replies: 9
    Last Post: 07-19-2009, 03:46 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