Flow Layout Problem
From: angussc2 (a_at_b.com)
Date: 06/25/04
- Next message: VisionSet: "Re: How can I resize a JTable's column width?"
- Previous message: Roedy Green: "Re: sun.io.CharToByteUTF-8 problems in old Netscape VM?"
- Next in thread: VisionSet: "Re: Flow Layout Problem"
- Reply: VisionSet: "Re: Flow Layout Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Jun 2004 17:31:03 +0100
Hi, I have what I think is a relitavely simple problem:
I have a bigger application with multiple JPanels etc but have scaled it
down for the example below...
When I resize the window so that it is too small to fit all the buttons on
screen horizontally I would like the buttons to re-organise themselves on
screen in the way they would do if they were just directly on the JFrame
rather than in a couple of JPanels.
If possible I would like a reason for this behaviour and a way to make the
buttons react like this:
http://java.sun.com/docs/books/tutorialJWS/uiswing/layout/example-1dot4/FlowLayoutDemo.jnlp
when they are underneath multiple JPanels.
Thanks
Angus
public class Application extends javax.swing.JFrame {
/** Creates new form Application */
public Application() {
initComponents();
}
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel2.setLayout(new java.awt.BorderLayout());
jButton1.setText("jButton1");
jPanel1.add(jButton1);
jButton2.setText("jButton2");
jPanel1.add(jButton2);
jButton3.setText("jButton3");
jPanel1.add(jButton3);
jButton4.setText("jButton4");
jPanel1.add(jButton4);
jButton6.setText("jButton6");
jPanel1.add(jButton6);
jButton5.setText("jButton5");
jPanel1.add(jButton5);
jButton7.setText("jButton7");
jPanel1.add(jButton7);
jButton8.setText("jButton8");
jPanel1.add(jButton8);
jButton9.setText("jButton9");
jPanel1.add(jButton9);
jPanel2.add(jPanel1, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH);
pack();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new Application().show();
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
// End of variables declaration
}
- Next message: VisionSet: "Re: How can I resize a JTable's column width?"
- Previous message: Roedy Green: "Re: sun.io.CharToByteUTF-8 problems in old Netscape VM?"
- Next in thread: VisionSet: "Re: Flow Layout Problem"
- Reply: VisionSet: "Re: Flow Layout Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]