Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Rep Power

    Default JFrame and JPanel -Error

    I have Array of JFrame and I have Jpanel
    i am using netbeans IDE to work.

    my code is

    Java Code:
    JFrame frame[]=new JFrame[10];
     Jpanel panel;
      for(int i=0;i<10;i++)
             panel==new JPanel();
    i get the Error i run in the Debug mode.
    i found the errror int this line

    was there any thing wrong in my code

    need immediately.
    :) javadeveloper

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Rep Power


    What are you trying to achieve with that code?
    Open the API specs for the setContentpane and see what it does.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    i get the Error i run in the Debug mode.
    What error message?

    I see many typos and basic mistakes in your code. For instance:
    Java Code:
        Jpanel panel;  // it's JPanel not Jpanel
         for(int i=0;i<10;i++)
                panel==new JPanel(); // use one = here to assign, not two ==
                panel.setvisible(true);  // it's setVisible not setvisible
               frame[i].setContentpane().add(panel); // you either add to the content pane or set a content pane you don't do both
    Please post a small bit of compilable code that demonstrates the error and please describe in greater detail just what the error is.

    From the code posted I'd suggest that you go through the Sun Swing tutorial before trying to go further with Swing.

Similar Threads

  1. How to add JFrame inside JPanel
    By niteshwar.bhardwaj in forum Java 2D
    Replies: 8
    Last Post: 12-13-2009, 09:41 PM
  2. JFrame and two JPanel Classes
    By YellowPainting in forum AWT / Swing
    Replies: 9
    Last Post: 08-25-2009, 01:49 PM
  3. Multiple Panels in JFrame or JPanel
    By DavidG24 in forum AWT / Swing
    Replies: 5
    Last Post: 05-16-2009, 01:47 PM
  4. problems with JPanel and JFrame
    By v1nsai in forum New To Java
    Replies: 13
    Last Post: 04-08-2009, 08:49 PM
  5. scroll a Jpanel in a JFrame
    By nidhirastogi in forum SWT / JFace
    Replies: 1
    Last Post: 09-07-2008, 04:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts