Here is the code
public class TestTab extends JPanel{
public TestTab() {
//{{INIT_CONTROLS
setLayout(new BorderLayout());
Insets ins = getInsets();
setSize(800, 550);
//}}
JPanel searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
// today string
SimpleDateFormat fmt = new SimpleDateFormat("MM/dd/yy");
String todayStr = fmt.format(new Date());
// from date
searchPanel.add(new JLabel("From : "));
_fromDateField = new JTextField(new DocumentFilter(8), todayStr, 8);
_fromDateField.setBounds(40, 5, 40,20);
_fromDateField.setPreferredSize(new Dimension(10, 20));
searchPanel.add(_fromDateField);
// end date
searchPanel.add(new JLabel("To : "));
_toDateField = new JTextField(new DocumentFilter(8), todayStr, 8);
_toDateField.setPreferredSize(new Dimension(10, 20));
searchPanel.add(_toDateField);
// cusip
searchPanel.add(new JLabel("CUSIP : "));
_cusipField = new JTextField(new DocumentFilter(8), null, 8);
_cusipField.setPreferredSize(new Dimension(10, 20));
searchPanel.add(_cusipField);
searchPanel.add(new JLabel("PARTNER : "));
_partnerCB = new JComboBox();
searchPanel.add(_partnerCB);
// search button
_searchButton = new JButton("Search");
_searchButton.setBackground(new java.awt.Color(51, 51, 102));
_searchButton.setForeground(new java.awt.Color(204, 204, 153));
searchPanel.add(_searchButton);
Panel panel1 = new Panel(new BorderLayout());
panel1.add(searchPanel, BorderLayout.NORTH);
// cusip detail label
_cusipDetailLabel = new JLabel();
Panel cusipDetailPanel = new Panel(new BorderLayout());
cusipDetailPanel.add(_cusipDetailLabel, BorderLayout.NORTH);
panel1.add(cusipDetailPanel, BorderLayout.CENTER);
_tab1 = new TableTab1();
Panel resultPanel = new Panel(new BorderLayout());
resultPanel.add(_tab1, BorderLayout.NORTH);
Panel panel2 = new Panel(new BorderLayout());
panel2.add(_tab1, BorderLayout.CENTER);
Panel mainPanel = new Panel(new BorderLayout());
mainPanel.add(panel1, BorderLayout.NORTH);
mainPanel.add(panel2, BorderLayout.CENTER);
add(mainPanel, BorderLayout.CENTER);
_searchButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
Object object = event.getSource();
if (object == _searchButton) {
searchButtonActionPerformed();
}
}
}
);
initialize();
}
private void initialize(){
try{
String sql = "Select '--All Partners--' partner_id, 'All' name FROM dual Union ";
sql += UserTab2.PARTNER_TABLE_SELECT;
VBComboBoxModel partnerModel = new VBComboBoxModel(sql);
_partnerCB.setModel(partnerModel);
_partnerCB.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent me){
System.out.println("***** partnerCB Mouse Clicked ");
}
});
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(this,"Exception while getting partner list - "+e.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);
}
}
}