This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SmallPanel on a Bigpanel  RSS feed

 
siddhu Math
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i am new to java swings and currently i am stuck with a problem where in i need to display a small panel on to a big panel, i mean to say that it looks like a sticker pasted on a notebook.currently i am using borderlayout kindly help me in getting out ...............
 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll suggest you to use GridbagLayout because this lets you to fix the componets as you want on the panel.
GridBagConstraints gbc = new GridBagConstraints();
int anchor = GridBagConstraints.FIRST_LINE_START;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.anchor = a;
panel.add(component, gbc);


you can also add panel to panel like other component.

for detail visit this:-
http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!