JDK-4148046 : JComboBox drop down arrow disappears
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.1.6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_95,windows_nt
  • CPU: x86
  • Submitted: 1998-06-11
  • Updated: 1998-06-29
  • Resolved: 1998-06-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.2.0 swing1.1Fixed
Description
Name: el35337			Date: 06/11/98


Create a new JComboBox and a button.  Give the
comboBox 3 values and setSelectedItem to one of 
the values.  Have the button change the selectedItem
of the combobox and the arrow on the combobox will
disappear.  It reappears if you click where it should
be.  Sample attached.

/*
 */
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
import com.sun.java.swing.plaf.*;
import com.sun.java.swing.text.*;

/**
 */
public class ComboBug extends JPanel implements java.awt.event.ActionListener {
    static JFrame frame;
    private JComboBox cb = null;
    private JButton button = null;


    public ComboBug() {

        cb = new JComboBox();
        cb.setEditable(true);
        cb.addItem("Value 1");
        cb.addItem("Value 2");
        cb.addItem("Value 3");
        cb.setSelectedItem("Value 2");


        button = new JButton("Chang Value");
        button.addActionListener(this);

        add(cb);
        add(button);
    }

    public static void main(String s[]) {

        ComboBug panel = new ComboBug();

        frame = new JFrame("LifePRO Prime Color Selections");
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        });
        frame.getContentPane().add("Center", panel);
        frame.pack();
        frame.setVisible(true);
    }

    public void actionPerformed(ActionEvent e) {
        try {
            cb.setSelectedItem("Value 3");
        }
        catch (Exception exc) {
            System.err.println("catch done on action performed");
        }
    }
}
(Review ID: 33506)
==================================
====================================



On Win32, creating an editable JComboBox results
a combobox with the arrow failing to paint
properly.  Redisplaying (occuding by another
window and bringing it back to the front) repaints
the window properly.

It appears that the arrow appears there very
briefly (a quick flicker) before disappearing.
It's probably getting overwritten by the
JTextField before the textfield gets resized to
make room for the error.

Here's a simple application which demonstrates
the problem:

import java.awt.*;
import com.sun.java.swing.*;

public class Test extends JFrame {
    public Test() {
	Container c = getContentPane();
	setSize(640, 480);
	c.setLayout(new FlowLayout());
	JComboBox jc;
	c.add(jc = new JComboBox());
	jc.setEditable(true);
    }

    public static void main(String args[]) {
	new Test().show();
    }
}

erik.larsen@Eng 1998-06-17

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: swing1.1 INTEGRATED IN: swing1.1
14-06-2004

WORK AROUND Name: el35337 Date: 06/11/98 n/a ======================================================================
11-06-2004

EVALUATION This bug has been fixed and integrated into Swing 1.1. tom.santos@eng 1998-06-29
29-06-1998