Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4137675

JComboBox does not get focus events when using Metal L&F

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.0, 1.2.2
    • client-libs
    • beta
    • generic, x86
    • generic, windows_nt



      Name: rk38400 Date: 05/12/98


      JComboBox does not get focus events when using Metal L&F -- It seems to work fine ith other Lokk and Feels.

      Here's a sample:

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

      public class Main extends JFrame {
      public Main() {
      JComboBox comboBox = new JComboBox();
      comboBox.addItem("One");
      JTextField textField = new JTextField(20);

      getContentPane().setLayout(new FlowLayout());
      getContentPane().add(comboBox);
      getContentPane().add(textField);

      comboBox.addFocusListener(new FocusListener() {
      public void focusLost(FocusEvent fe) {
      System.out.println("focus LOST");
      }
      public void focusGained(FocusEvent fe) {
      System.out.println("focus GAINED");
      }
      });
      }
      public static void main(String[] args) {
      try{
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel");
      }
      catch (Exception e) {
      System.exit(0);
      }

      JFrame frame = new Main();
      frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent we) {
      System.exit(0);
      }
      });
      frame.pack();
      frame.setVisible(true);
      }
      }
      (Review ID: 30190)
      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            rkarsunw Ralph Kar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: