Question

Here is my current settings:

    private JComponent upperContent = new GeneralContent();
    private JComponent lowerContent = new GeneralContent();
    // GeneralContent extends JComponent

   jframe.setLayout(new GridLayout(2, 0));
   upperContent.setLayout(null);
   lowerContent.setLayout(new GridBagLayout());
   jframe.add(upperContent);
   jframe.add(lowerContent)

lowerContent's all component are displayed as expected while upperContent didn't display the component that i was added to it by using the following code:

JLabel label=new JLabel();
upperContent.add(label);
label.setLocation(15,15);

i also used label.repaint(); & upperContent.revalidate() neither worked

Was it helpful?

Solution

You get absolute positioning with a null layout. The bad news is that everything is totally up to you from then on.

http://docs.oracle.com/javase/tutorial/uiswing/layout/none.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top