I'm trying to update my application's toolbar so that it will automatically wrap to 
use multiple rows for the buttons if the width of the application session window 
becomes too narrow to show them all in a single row. The following testcase represents 
what I'm trying to do. Can anyone get this changed so the height of the toolbar area 
increases once the FlowLayout manager wraps to use multiple rows? I can see that the 
wrapping is occuring, but the toolbar height doesn't change to accomodate the change 
in the number of rows used by the toolbar's FlowLayout manager.

Thanks,

John  (using 1.3.1)

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class toolbar_test extends JFrame {
   public static void main (String args[]) {
      new toolbar_test();
   }
   public toolbar_test() {
      super("Wrapping Toolbar Test");
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {System.exit(0);}
      });

      Container c = getContentPane();
      c.setLayout(new BorderLayout());

      JToolBar tbar = new JToolBar();
      tbar.setFloatable(false);
      tbar.setLayout(new FlowLayout(FlowLayout.LEFT));
      for (int i=1; i <= 15; i++) {
         tbar.add(new JButton("Btn"+i));
      }
      c.add(tbar, BorderLayout.NORTH);
      String s = "<html>This is the main<br>" +
        "content area of the <br>" +
        "application";
      c.add(new JLabel(s), BorderLayout.CENTER);

      pack();
      setVisible(true);
   }
}
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to