Converting a program from Swing to ULC, I notice a change of behavior, which I hope you can give me some advise on.

I have included below a class that demonstrates the problem, followed by a Swing class that is working as expected. Basically, the combobox in the toolbar is being extended to the end. This happens by default in Swing, but there a simple setMaximumSize of the preferred size sets the width to a reasonable size. In ULC, this isn't working as it does in Swing. Can you look at this, please, and offer any suggestions on how I might rework this to get it working like Swing?

Thanks!
-Stuart Booth (Abacus Research)

public class BugsFrameApp extends AbstractApplication {

   public void start() {
       new BugsFrame().setVisible(true);
   }

   public static void main(String[] args) {

       DevelopmentRunner.setApplicationClass(BugsFrameApp.class);
       DevelopmentRunner.run();
   }

   class BugsFrame extends ULCFrame {

       public BugsFrame() {
           super("Bugs");
           setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
           setSize(800, 900);
           addComponents();
       }

       private void addComponents() {
           ULCToolBar toolbar = new ULCToolBar();
           toolbar.add(new ULCButton("A"));
           toolbar.add(new ULCButton("B"));
           toolbar.addSeparator();
ULCComboBox combo = new ULCComboBox(new String[]{"Red", "Green", "Blue"});
           toolbar.add(combo);
           combo.setMaximumSize(combo.getPreferredSize());

           add(toolbar, ULCBorderLayoutPane.NORTH);
       }
   }
}

This is the Swing class that works perfectly:

public class BugsFrameApp extends JFrame {

   public static void main(String[] args) {
       new BugsFrameApp().setVisible(true);
   }

   public BugsFrameApp() {
       super("Bugs");
       setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
       setSize(800, 900);
       addComponents();
   }

   private void addComponents() {
       JToolBar toolbar = new JToolBar();
       toolbar.add(new JButton("A"));
       toolbar.add(new JButton("B"));
       toolbar.addSeparator();
JComboBox combo = new JComboBox(new String[]{"Red", "Green", "Blue"});
       toolbar.add(combo);
       combo.setMaximumSize(combo.getPreferredSize());

       add(toolbar, BorderLayout.NORTH);
   }
}

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to