I'm designing an app that lets the user select items from one list that can be moved to another list with add/remove buttons. That functionality works correctly, but when I try to set the size of the components or the panes they are in, the settings appear to be ignored. To group the components I have used nesting panes added to a tabbed panel. I've tried a few things so far, commented out in the code snippet. Being new to Java and Layout Managers in general, I'm hoping I missed something obvious. My questions are:
-how can I force the list boxes to be no bigger than a certain *maximum* size?
-why do none of the graphic overrides work, for the panes or for the components? (see attached screenshot)
The code that sets the graphical arrangement is as follows:
//add elements to respective panels
//Dimension myMax=new Dimension(200,200);//doesn't work
testPanel=new Panel();
agentPanel=new Panel();
runPanel=new Panel();
setupPanel=new Panel();
resultsPanel=new Panel();
configPanel=new Panel();
testPanel.setSize(300, 300);
agentPanel.setSize(30,30);//doesn't do anything!
GridBagLayout standardGrid=new GridBagLayout();
GridBagConstraints lpanelC=new GridBagConstraints();//left panel
lpanelC.fill=GridBagConstraints.BOTH;
lpanelC.weightx=0.5;
lpanelC.weighty=1.0;
lpanelC.gridx=0;
lpanelC.gridy=0;
GridBagConstraints rpanelC=new GridBagConstraints();//right panel
rpanelC.fill=GridBagConstraints.BOTH;
rpanelC.weightx=0.5;
rpanelC.weighty=1.0;
rpanelC.gridx=2;
rpanelC.gridy=0;
GridBagConstraints cboxC=new GridBagConstraints();//checkbox
cboxC.weightx=0;
cboxC.weighty=0;
cboxC.gridx=1;
cboxC.gridy=2;
GridBagConstraints addBC=new GridBagConstraints();//add button
addBC.weightx=0.5;
addBC.weighty=1;
addBC.gridx=1;
addBC.gridy=0;
addBC.insets = new Insets(0,10,0,10);
GridBagConstraints removeBC=new GridBagConstraints();//remove button
removeBC.weightx=0.5;
removeBC.weighty=1;
removeBC.gridx=1;
removeBC.gridy=1;
removeBC.insets = new Insets(0,10,0,10);
testPanel.setLayout(standardGrid);
testPanel.add(allTests,lpanelC);
testPanel.add(addTests,addBC);
testPanel.add(checkAllTests,cboxC);
testPanel.add(myTests,rpanelC);
testPanel.add(removeTests,removeBC);
agentPanel.setLayout(standardGrid);
agentPanel.add(allAgents,lpanelC);
agentPanel.add(addAgents,addBC);
agentPanel.add(checkAllAgents,cboxC);
agentPanel.add(myAgents,rpanelC);
agentPanel.add(removeAgents,removeBC);
runPanel.setLayout(new FlowLayout());
runPanel.add(runButton);
//Run Tests tab
//allAgents.setMaximumSize(myMax);//this doesn't work
//myAgents.setMaximumSize(myMax);
frame.setSize(800, 800);
setupPanel.setSize(800,800);
setupPanel.add(testPanel);
setupPanel.add(runPanel);
setupPanel.add(agentPanel);
//Config tab
testFileLoc=new JTextField(testData);
agentFileLoc=new JTextField(agentData);
resultLoc=new JTextField(testLoc);;
appInstructions=new JTextArea(blah);
configPanel.add(testFileLoc);
configPanel.add(agentFileLoc);
configPanel.add(resultLoc);
configPanel.add(appInstructions);
configPanel.add(configButton);
//Results tab
frame.add(setupTab);
setupTab.add(setupPanel,"Test Run Setup");
setupTab.add(configPanel,"Config");
setupTab.add(resultsPanel,"Results");
setupTab.setSize(800,800);
frame.setVisible(true);
frame.setResizable(true);
Thanks in advance!