-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
5.0
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux dhola.pna.cwi.nl 2.6.13-1.1526_FC4 #1 Wed Sep 28 19:15:10 EDT 2005 i686 athlon i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
When a JComboBox is placed in a modal JDialog, it may not be possible to select an item with the mouse (it is possible to do it with the keyboard arrows).
This will happen if the item-list does not fit in the dialog frame. It only occurs under Linux.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
very simple. see source code.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ComboBug extends JFrame
{
public ComboBug()
{
super("ComboBug");
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
Container cpane = getContentPane();
cpane.setLayout( new BorderLayout() );
cpane.add( new ComboPanel() );
pack();
setLocationRelativeTo(null);
setVisible(true);
}
public static void main( String[] args )
{
ComboBug mf = new ComboBug();
}
}
class ComboPanel extends JPanel implements ActionListener
{
ComboPanel()
{
JButton demo = new JButton("show bug ( if Linux )");
demo.addActionListener(this);
add( demo );
}
public void actionPerformed( ActionEvent e )
{
ComboDialog dial = new ComboDialog();
dial.activate();
}
}
class ComboDialog extends JDialog
implements ActionListener
{
JComboBox combo;
ComboDialog()
{
super( (JFrame)null, true );
Container cpane = getContentPane();
combo = new JComboBox
( new String[] { "one", "two", "exit" } );
combo.addActionListener(this);
cpane.setLayout( new BorderLayout() );
cpane.add( combo, BorderLayout.CENTER );
cpane.add(
new JLabel
(" can't select item from this JComboBox with mouse "),
BorderLayout.WEST );
pack();
}
void activate()
{
setLocationRelativeTo(null);
combo.setSelectedIndex(0);
setVisible(true);
}
public void actionPerformed( ActionEvent e)
{
System.err.println("selected index: " + combo.getSelectedIndex() );
if ( combo.getSelectedIndex() == 2 ) setVisible(false);
}
}
---------- END SOURCE ----------
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux dhola.pna.cwi.nl 2.6.13-1.1526_FC4 #1 Wed Sep 28 19:15:10 EDT 2005 i686 athlon i386 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
When a JComboBox is placed in a modal JDialog, it may not be possible to select an item with the mouse (it is possible to do it with the keyboard arrows).
This will happen if the item-list does not fit in the dialog frame. It only occurs under Linux.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
very simple. see source code.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ComboBug extends JFrame
{
public ComboBug()
{
super("ComboBug");
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
Container cpane = getContentPane();
cpane.setLayout( new BorderLayout() );
cpane.add( new ComboPanel() );
pack();
setLocationRelativeTo(null);
setVisible(true);
}
public static void main( String[] args )
{
ComboBug mf = new ComboBug();
}
}
class ComboPanel extends JPanel implements ActionListener
{
ComboPanel()
{
JButton demo = new JButton("show bug ( if Linux )");
demo.addActionListener(this);
add( demo );
}
public void actionPerformed( ActionEvent e )
{
ComboDialog dial = new ComboDialog();
dial.activate();
}
}
class ComboDialog extends JDialog
implements ActionListener
{
JComboBox combo;
ComboDialog()
{
super( (JFrame)null, true );
Container cpane = getContentPane();
combo = new JComboBox
( new String[] { "one", "two", "exit" } );
combo.addActionListener(this);
cpane.setLayout( new BorderLayout() );
cpane.add( combo, BorderLayout.CENTER );
cpane.add(
new JLabel
(" can't select item from this JComboBox with mouse "),
BorderLayout.WEST );
pack();
}
void activate()
{
setLocationRelativeTo(null);
combo.setSelectedIndex(0);
setVisible(true);
}
public void actionPerformed( ActionEvent e)
{
System.err.println("selected index: " + combo.getSelectedIndex() );
if ( combo.getSelectedIndex() == 2 ) setVisible(false);
}
}
---------- END SOURCE ----------
- relates to
-
JDK-6434227 Popup menus when rendered on X Client can't be selected w/ mouse
- Closed