ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General Discussion » OT: JCombBox "choose an Item" hidden by another c

Post new topic  Reply to topic
 OT: JCombBox "choose an Item" hidden by another c « View previous topic :: View next topic » 
Author Message
sebastianhirt
PostPosted: Mon Feb 06, 2006 7:44 am    Post subject: OT: JCombBox "choose an Item" hidden by another c Reply with quote

Yatiri

Joined: 07 Jun 2004
Posts: 620
Location: Germany

Hi friends,

here is one for the Java experts amongst you:

I am trying to program this little gui (Java 1.5.0_06 on W2k) that is having a combo box on top a button next to it and a scroll pane with a JTable in it below it.

Now.. My problem is that the "choose an Item" area of my ComboBox is partially hidden by the scroll pane container.

Is there a way to force the "choose an Item" area of my combobox to be always on top?

Here a short description on what this is supposed to do.

There is an instance of this class created by the applications main.
This guis is build,
the user is choosing a query from the combobox,
hits execute.
Then I am creating an instance of another class, that is doing some SQL queries against a Database, and giving 2 vectors to the setTable method of this class. The table is filled, added to the scroll pane.

So all in all not a big deal.

Help and/or pointers to useful information material is really appreciated.

cheers
Sebastian

Code:
package mqCreator;

import java.util.*;
//import java.sql.*;
//import javax.swing.table.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class CreatorToolsGUI extends JFrame implements ActionListener{
   
   // Declaring Stuff for Layout
   private BorderLayout    bord       = new BorderLayout();
   private GridBagLayout   grid      = new GridBagLayout();
   private JPanel          pane       = new JPanel();
   private ScrollPane       scrPane    = new ScrollPane();
   private JLabel         qType      = new JLabel("Select Query: ");
   private JComboBox      queryType   = new JComboBox();
   private JButton       execute      = new JButton("Execute");
   private Insets          whitespace    = new Insets(20, 13, 20, 13);
   
   
   public CreatorToolsGUI(){
      
      // Constructing GUI
      super("DB Tools");
      setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      setLayout(bord);
      setSize(640,480);
      
      pane.setLayout(grid);
      

      
      // set location
      Dimension screenSize =
         Toolkit.getDefaultToolkit().getScreenSize();
      setLocation(screenSize.width/2 - (getSize().width/2),
            screenSize.height/2 - (getSize().height/2));
      
      // Filling in of all possible queries
      queryType.addItem("All interfaces in RTE");
      queryType.addItem("All interfaces in PreProd");
      queryType.addItem("All interfaces in Prod");
      
      execute.addActionListener(this);
      execute.setActionCommand("Query");
      
      
      GridBagConstraints constraints = new GridBagConstraints();
      constraints.gridx = 0;
      constraints.gridy = 0;
      constraints.gridwidth = 1;
      constraints.gridheight = 1;
      constraints.weightx = 1;
      constraints.weighty = 50;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.insets = whitespace;
      grid.setConstraints(qType, constraints);
      
      constraints.gridx = 1;
      constraints.gridy = 0;
      constraints.gridwidth = 1;
      constraints.gridheight = 1;
      constraints.weightx = 150;
      constraints.weighty = 50;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.insets = whitespace;
      grid.setConstraints(queryType, constraints);
      
      constraints.gridx = 2;
      constraints.gridy = 0;
      constraints.gridwidth = 1;
      constraints.gridheight = 1;
      constraints.weightx = 10;
      constraints.weighty = 50;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.insets = whitespace;
      grid.setConstraints(execute, constraints);
      
      constraints.gridx = 0;
      constraints.gridy = 1;
      constraints.gridwidth = 5;
      constraints.gridheight = 1;
      constraints.weightx = 10;
      constraints.weighty = 1000;
      constraints.fill = GridBagConstraints.BOTH ;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      constraints.insets = whitespace;
      grid.setConstraints(scrPane, constraints);
      
      pane.add(qType);
      pane.add(queryType);
      pane.add(execute);
      pane.add(scrPane);
      add(pane,BorderLayout.CENTER);
      
      setVisible(true);
      
   }
   
   public void actionPerformed (ActionEvent event){
      if (event.getActionCommand().equals("Query")){
         DbQueries dbQ = new DbQueries(this);
         if (queryType.getSelectedItem().equals("All interfaces in RTE")){
            dbQ.qmInER();
         }
         if (queryType.getSelectedItem().equals("All interfaces in PreProd")){
            dbQ.qmInEE();
         }
         if (queryType.getSelectedItem().equals("All interfaces in Prod")){
            dbQ.qmInEP();
         }
      }
   }
   
   void setTable(Vector rowData, Vector rowTitles ){
      JTable table = new JTable(rowData, rowTitles);
      
      /*JTableHeader head = new JTableHeader();
       for (Object obj : rowTitles){
          head.add(obj.toString(),table);
       }
       */
      scrPane.add(table);
      this.repaint();
      
   }
   
   
}
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Feb 19, 2006 9:45 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Looks to me like it is a javax.swing problem. Quite common in fact.

Have you checked that the sizes you defined for all of your components fit in the size of your pane. The easiest way to make sure would be to allow dynamic resizing and make the main window a little bit bigger or a little bit less big. If everything then fits you know what you have to play with...

Might as well have to do with size of the text in the corresponding window that gives a min size to that pane?

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » OT: JCombBox "choose an Item" hidden by another c
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.