To prevent window from resizing:
frame.setResizable(false)
Manage two radio buttons so that only 1 is selectable at a time:
Use ButtonGroup ButtonGroup group = new ButtonGroup(); group.add(birdButton); group.add(catButton);
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)); OR JPanel containerPanel = new JPanel(); containerPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); containerPanel.setLayout(new BorderLayout());
Setting a background color same as container color
list.setBackground(panel.getBackground());
Anytime we modify the GUI in Swing we need to call:
frame.revalidate() frame.repaint()
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.