in case 50 does not meet the requierement
Main Topics
Browse All Topicsin the following code :
import java.awt.* ;
import java.awt.event.* ;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.util.*;
public class CallTiketPnl extends JPanel {
/** Creates a new instance of CallTiketPnl */
public CallTiketPnl() {
super();
jTblRes.setModel(new javax.swing.table.DefaultT
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
// These to lines corect the problem but the hightlighting is not corect.
//jCmbBxIn.setLightWeightP
jCmbBxIn.setBackground(Col
jCmbBxIn.setModel(new javax.swing.DefaultComboBo
//jCmbBxIn.setDoubleBuffer
setLayout(new GridBagLayout());
setBackground(Color.WHITE)
gbc.gridx = gbc.gridy = 0;
add(jLblSearch, gbc);
gbc.gridx++;
gbc.fill = GridBagConstraints.HORIZON
gbc.weightx = 1.0;
add(jTxtFldSearch, gbc);
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 0;
gbc.gridx++;
add(jLblIn, gbc);
gbc.gridx++;
add(jCmbBxIn, gbc);
gbc.gridx++;
jBtnSearch.setBackground(C
add(jBtnSearch, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 5;
gbc.fill = java.awt.GridBagConstraint
gbc.weightx = gbc.weighty = 1.0;
add(jTblRes, gbc);
jBtnPrint.setBackground(Co
gbc.gridwidth = 0;
gbc.fill = java.awt.GridBagConstraint
gbc.weightx = gbc.weighty = 0;
gbc.gridx = 4;
gbc.gridy++;
add(jBtnPrint, gbc);
}
public static void main(String[]args)
{
JFrame tstf =new JFrame("test");
tstf.getRootPane().setLayo
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx= gbc.gridy = 0;
gbc.fill = java.awt.GridBagConstraint
gbc.fill=gbc.BOTH;
gbc.weightx=gbc.weighty=1;
tstf.getRootPane().add(new
tstf.pack();
tstf.show();
tstf.setDefaultCloseOperat
}
GridBagConstraints gbc= new GridBagConstraints();
JLabel jLblSearch = new JLabel("Search");
JTextField jTxtFldSearch = new JTextField();
JLabel jLblIn = new JLabel(" in ");
JComboBox jCmbBxIn = new JComboBox();
JTable jTblRes = new JTable();
JButton jBtnSearch = new JButton("Go");
JButton jBtnPrint = new JButton("Print");
}
the combo box did not open the popup until the fram is resised to be small.
please help;-)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I feel the problem is with the gridbag constraints weight or something..
Pls try if this piece of code works
public class JFrame extends javax.swing.JFrame {
/** Creates new form JFrame */
public JFrame() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
java.awt.GridBagConstraint
jComboBox1 = new javax.swing.JComboBox();
jTable1 = new javax.swing.JTable();
getContentPane().setLayout
addWindowListener(new java.awt.event.WindowAdapt
public void windowClosing(java.awt.eve
exitForm(evt);
}
});
jComboBox1.setModel(new javax.swing.DefaultComboBo
getContentPane().add(jComb
jTable1.setModel(new javax.swing.table.DefaultT
new Object [][] {
{"sdfs", "dfsdf", "sdfsd", "fsd"},
{"fsd", "dfdsfsd", "fsdfs", "fsdfs"},
{null, "fsd", "fsd", "dfs"},
{"fsdfsd", "fsd", "dfsdfsd", "dfs"}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
gridBagConstraints = new java.awt.GridBagConstraint
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraint
gridBagConstraints.weightx
gridBagConstraints.weighty
getContentPane().add(jTabl
pack();
}
/** Exit the Application */
private void exitForm(java.awt.event.Wi
System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new JFrame().show();
}
// Variables declaration - do not modify
private javax.swing.JTable jTable1;
private javax.swing.JComboBox jComboBox1;
// End of variables declaration
}
Hello,
In your code the problem is not the panel, but the way you add it to the frame.
So, in the main function, instead of getRootPane(), use getContentPane().
See below:
public static void main(String[]args)
{
JFrame tstf =new JFrame("test");
tstf.getContentPane().setL
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx= gbc.gridy = 0;
gbc.fill = java.awt.GridBagConstraint
gbc.fill=gbc.BOTH;
gbc.weightx=gbc.weighty=1;
tstf.getContentPane().add(
tstf.pack();
tstf.show();
tstf.setDefaultCloseOperat
}
Best Regards,
sey.
Business Accounts
Answer for Membership
by: farajPosted on 2002-08-16 at 03:00:04ID: 7224490
I forgot to tell the version of the jdk use :
sun JDK1.4.0-1 windows