Results 1 to 1 of 1
  1. #1
    sjchase is offline Member
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

    Default Graphic settings being overridden?

    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:

    Java Code:
    	  //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!
    Attached Thumbnails Attached Thumbnails Graphic settings being overridden?-app.jpg  

Similar Threads

  1. Basic Graphic
    By jkswebsite in forum Java 2D
    Replies: 6
    Last Post: 11-26-2007, 02:19 AM
  2. JVM Heap memory settings
    By nagesh in forum New To Java
    Replies: 1
    Last Post: 08-11-2007, 10:17 PM
  3. How do insert a Graphic
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 05:30 AM
  4. Detecting Browser Settings
    By arupranjans in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-31-2007, 02:31 PM
  5. Swing Graphic interface
    By Daniel in forum AWT / Swing
    Replies: 2
    Last Post: 06-28-2007, 04:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •