Reputation: 3247
i am new to java swing component. please tell me how to create multiple frames. My requirement is ,base frame should contain 2 radio buttons and if i click anyone radio button it should go to other frame and it should display 4 check boxes.
Please advice
Upvotes: 0
Views: 2397
Reputation: 366
check out how CardLayout works
https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
if you only want to switch between the windows:
Add Action Listener to the radio button, example
private void jButtonActionPerformed(java.awt.event.ActionEvent e) {
jPanelMain.removeAll();
jPanelMain.repaint();
jPanelMain.revalidate();
jPanelMain.add(jPanel1);
jPanelMain.repaint();
jPanelMain.revalidate();
}
Upvotes: 1
Reputation: 17359
Why don't you read the docs and tutorial? http://download.oracle.com/docs/cd/E17409_01/javase/tutorial/uiswing/components/frame.html
Upvotes: 1