Results 1 to 9 of 9
  1. #1
    shruti is offline Member
    Join Date
    Jul 2009
    Posts
    7
    Rep Power
    0

    Default the component does not show

    i need to see two components at the same time and embed one on other.the size of the to be placed component has been reduced so that it fits in the centre of other component.But eaxh time i try doing it i do not see the placed component.please help me.is there a problem with the layout managers?

    Java Code:
    JPanel mainpanel=new JPanel();
    	final JPanel main = new JPanel(new BorderLayout());
            final JPanel optionsPanel = new JPanel();
     	cirarc12 c2=new cirarc12();
    	c2.setPreferredSize(new java.awt.Dimension(100,100));
    	optionsPanel.add(c2,BorderLayout.CENTER);
    	main.add(chartPanel, BorderLayout.NORTH);
            //main.add(c2,BorderLayout.CENTER);
         	mainpanel.add(main,BorderLayout.CENTER);
    	mainpanel.add(optionsPanel,BorderLayout.CENTER);
    	myframe.add(mainpanel);
    	myframe.pack();
    Last edited by shruti; 07-08-2009 at 08:40 AM.

  2. #2
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    6

    Default

    You probably missed the setVisible method

    Java Code:
    JPanel mainpanel=new JPanel();
    	final JPanel main = new JPanel(new BorderLayout());
            final JPanel optionsPanel = new JPanel();
     	cirarc12 c2=new cirarc12();
    	c2.setPreferredSize(new java.awt.Dimension(100,100));
    	optionsPanel.add(c2,BorderLayout.CENTER);
    	main.add(chartPanel, BorderLayout.NORTH);
            //main.add(c2,BorderLayout.CENTER);
         	mainpanel.add(main,BorderLayout.CENTER);
    	mainpanel.add(optionsPanel,BorderLayout.CENTER);
    	myframe.add(mainpanel);
    	myframe.pack();
            //following line missing in your code
            myframe.setVisible(true);

  3. #3
    shruti is offline Member
    Join Date
    Jul 2009
    Posts
    7
    Rep Power
    0

    Default

    NO,that is not the problem.It still doesn't show

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  5. #5
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    6

    Default

    can you paste the complete code?

  6. #6
    shruti is offline Member
    Join Date
    Jul 2009
    Posts
    7
    Rep Power
    0

    Default

    it is a huge code.it has a lot of file handling elements in it as it takes input from two files.this is the major problem i'm facing that the cirarc12 component does not appear in the middle of the chart.

    what might be the problem?
    Last edited by shruti; 07-08-2009 at 10:12 AM.

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Interesting, since you write such a long code, didn't notice that error? Seems to me this is not yours' code.

  8. #8
    shruti is offline Member
    Join Date
    Jul 2009
    Posts
    7
    Rep Power
    0

    Default

    no,that was enitrely written by me.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by shruti View Post
    no,that was enitrely written by me.

    hmmm, anyway, can you post the code segment that the panel initiate and added the component into it. Without knowing what you exactly do, really difficult to comment.

Similar Threads

  1. Jbutton do not show up
    By javaTech in forum AWT / Swing
    Replies: 15
    Last Post: 05-12-2009, 01:22 PM
  2. Replies: 6
    Last Post: 04-07-2008, 04:57 AM
  3. How to Show Calendar
    By praveen.kb in forum AWT / Swing
    Replies: 2
    Last Post: 02-09-2008, 09:23 AM
  4. netbeans 6.0 not show commpunent or show blank page
    By fahimaamir in forum NetBeans
    Replies: 1
    Last Post: 01-26-2008, 07:20 AM
  5. show a RTF FORMAT
    By Jack in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 04:37 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
  •