Java Swing Musings

To prevent window from resizing:



Manage two radio buttons so that only 1 is selectable at a time:

Use ButtonGroup
ButtonGroup group = new ButtonGroup();


In my application I have move the user from one screen to next on button click. I am wondering how to do it in Swing. There are couple of good posts I have come across for this Post1, Post2.



Adding Border around a container: Set an EmptyBorder around your JPanel.

JPanel p =new JPanel();
p.setBorder(new EmptyBorder(10, 10, 10, 10));


JPanel containerPanel = new JPanel();
containerPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
containerPanel.setLayout(new BorderLayout());


Setting a background color same as container color



Anytime we modify the GUI in Swing we need to call:


Why use of multiple JFrames in a Swing Application is a bad practice: Post


Right now I am searching how to update a JList with some contents, I wud be fetching from remote server.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s