Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Aditi Msc   on Nov 28 In Java Category.

  
Question Answered By: Rocco Anderson   on Nov 28

Try using the method setPreferredSize(Dimension) for objects you want
to control.

JPanel exitPanel = new JPanel(new FlowLayout());
exitPanel.setPreferredSize(new Dimension(200,100));
exitPanel.add(exitButton);
getContentPane().add(exitPanel, BorderLayout.SOUTH);

Placing JButtons on a panel  using FlowLayout shows the buttons in
their preferred size, rather than using the whole panel or area.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Limit size of swing frame & or components Or get search suggestion and latest updates.


Tagged: