Hi. When I add a JComponent to my JFrame, it isn't the size of the remaining space in the frame. I want it to work in a way so that when i add a JComponent, it (and it's contents) stretches to fill the remaining space in the screen... Is there anyway to do that?
llemes4011
31
Posting Whiz in Training
Recommended Answers
Jump to PostHi. When I add a JComponent to my JFrame, it isn't the size of the remaining space in the frame. I want it to work in a way so that when i add a JComponent, it (and it's contents) stretches to fill the remaining space in the screen... Is there …
Jump to PostVernonDozier>What LayoutManager are you using?
llemes4011>I'm not... But I found a way that works.
Can I see the way you have used?
Do you know BorderLayout, GridBagLayout & GridBagConstraints?
Jump to PostUse BorderLayout and add a component with CENTER position. Do not forget to issue validate() method of container after component has been added to that container.
Jump to PostIf you want to change the size of any control use setPreferredSize() method.
All 16 Replies
VernonDozier
2,218
Posting Expert
Featured Poster
llemes4011
31
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
llemes4011
31
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
llemes4011
31
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
llemes4011
31
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
llemes4011
31
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
llemes4011
31
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
llemes4011
31
Posting Whiz in Training
kvprajapati
1,826
Posting Genius
Team Colleague
llemes4011
commented:
Thanks for helping me out! That had been driving me crazy!!!
+1
llemes4011
31
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.