I wanted to put my toolbar in a GridBagLayout for I can put a ComboBox that
doesn't stretch to the end of the program.
This is what I have:
JLabel eventsLabel = new JLabel("Events:", SwingConstants.LEFT);
comboEvents = new JComboBox();
GridBagLayout eventLayout = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
constraints.weightx = 0;
constraints.weighty = 0;
constraints.gridx = 0;
constraints.gridy = 0;
constraints.gridwidth = 0;
constraints.gridheight = 0;
JLabel groupsLabel = new JLabel("Groups:", SwingConstants.LEFT);
comboGroups = new JComboBox();
I added the ComboBox to the toolbar twice, that seemed to put it to the far
right of the buttons instead of it being underneath the last ones.
Right now with this code it puts all items in the toolbar in the center;
I would like to have it to the east.
I'm probably just going at this the wrong way.
Also is there a way to get which control (combo box, etc) has focus?
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL