Name: gm110360 Date: 07/26/2004
FULL PRODUCT VERSION :
FULL OS VERSION :
Windows XP Professional
A DESCRIPTION OF THE PROBLEM :
A JTable contain a JComboBox cell editor. When i select an item from combo box the table has lost its focus.
This is i found in jre 1.4.
ABOVE PROBLEM IS NOT FOUND IN JRE 1.3.
I used Jdeveloper 10g to develop this form. When runnig from this IDE above problem is coming.
When running from JDeveloper 9i this problem is not coming, ie. it is working fine.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Step 1)
Run this code using Jdeveloper 10g
//******** Start of code****************
import javax.swing.JFrame;
import java.awt.Dimension;
import oracle.jbo.uicli.controls.dataPanel;
import java.awt.Rectangle;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import javax.swing.border.EtchedBorder;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.JComboBox;
import javax.swing.DefaultCellEditor;
import java.util.*;
import java.awt.*;
import javax.swing.JButton;
public class MainFrame extends JFrame
{
private JScrollPane jScrollPane1 = new JScrollPane();
private JTable jTable1 = new JTable();
private BorderLayout borderLayout1 = new BorderLayout();
private JPanel jPanel1 = new JPanel();
private JButton jButton1 = new JButton();
public MainFrame()
{
try
{
jbInit();
jTable1.setModel(createData());
JComboBox cboItemName = new JComboBox();
cboItemName.setEditable(true);
cboItemName.addItem("1");
cboItemName.addItem("1");
cboItemName.addItem("1");
cboItemName.addItem("1");
cboItemName.addItem("1");
TableColumn tableColumn = jTable1.getColumnModel().getColumn(0);
tableColumn.setCellEditor(new DefaultCellEditor(cboItemName ));
}
catch(Exception e)
{
e.printStackTrace();
}
}
private TableModel createData()
{
Object[] columnNames = new String[] { "Column1", "Column2" };
DefaultTableModel result = new DefaultTableModel(columnNames, 1);
result.setValueAt("Hello", 0, 0);
result.setValueAt("World!", 0, 1);
return result;
}
public static void main(String args[])
{
MainFrame f = new MainFrame();
f.setVisible(true);
}
private void jbInit() throws Exception
{
jScrollPane1.getViewport().add(jTable1, null);
this.setSize(new Dimension(543, 474));
this.getContentPane().setLayout(borderLayout1);
jButton1.setText("jButton1");
this.getContentPane().add(jScrollPane1, BorderLayout.NORTH);
jPanel1.add(jButton1, null);
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
}
}
//*********end of code**************
Step 2)
Select an item from combo in the table, the table has lost focus and the focus is on Button.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Table has lost focus and now Button has focus.
ACTUAL -
Table should have focus instead button
REPRODUCIBILITY :
This bug can be reproduced always.
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 280214)
======================================================================