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

Exceptions thrown when mouse moved over white area in the JColorChooser Swatch t

XMLWordPrintable

    • tiger
    • x86
    • windows_2000



      Name: dk106046 Date: 07/09/2003

      java version "1.3.1_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_06-b01)
      Java HotSpot(TM) Client VM (build 1.3.1_06-b01, mixed mode)

      The problem is also observed on SUN 131, 142 and also on 150 pre beta.

      - Exact steps to reproduce :-

      1)Compile the testcase ColorChooserBug.java
        javac ColorChooserBug.java
      2)Run the testcase
        java ColorChooserBug
      3) Click "Press Here"
      4) In the Frame that is displayed, select "swatches" tab.
      5) Move the mouse over the white area in the color chooser panel.
      6) You will observe runtime errors in the command window.

      - Minimal source code that demonstrates the problem :-

      /*
       * ColorChooserBug.java
       *
       */
      import java.awt.Color;
      import javax.swing.UIManager;

      public class ColorChooserBug extends javax.swing.JFrame {
          
          /** Creates new form ColorChooserBug */
          public ColorChooserBug() {
              initComponents();
          }
          
          /** This method is called from within the constructor to
           * initialize the form.
           * WARNING: Do NOT modify this code. The content of this method is
           * always regenerated by the Form Editor.
           */
          private void initComponents() {
              jPanel1 = new javax.swing.JPanel();
              jButton1 = new javax.swing.JButton();

              getContentPane().setLayout(new java.awt.GridLayout(5, 5));

              setFont(new java.awt.Font("Perpetua", 0, 48));
              addWindowListener(new java.awt.event.WindowAdapter() {
                  public void windowClosing(java.awt.event.WindowEvent evt) {
                      exitForm(evt);
                  }
              });

              jPanel1.setFont(new java.awt.Font("Perpetua", 0, 48));
              jButton1.setFont(new java.awt.Font("Perpetua", 0, 48));
              jButton1.setText("Press Here");
              jButton1.addActionListener(new java.awt.event.ActionListener() {
                  public void actionPerformed(java.awt.event.ActionEvent evt) {
                      jButton1ActionPerformed(evt);
                  }
              });

              jPanel1.add(jButton1);

              getContentPane().add(jPanel1);

              pack();
          }

          private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
              // Add your handling code here:
              java.awt.Font f = new java.awt.Font("Perpetua", 0, 48);
              UIManager.put("Label.font", f);
              Color chosen = javax.swing.JColorChooser.showDialog(this, "Select a color", Color.lightGray);
          }
          
          /** Exit the Application */
          private void exitForm(java.awt.event.WindowEvent evt) {
              System.exit(0);
          }
          
          /**
           * @param args the command line arguments
           */
          public static void main(String args[]) {
              new ColorChooserBug().show();
          }
          
          
          // Variables declaration - do not modify
          private javax.swing.JButton jButton1;
          private javax.swing.JPanel jPanel1;
          // End of variables declaration
          
      }


      - Exact text of any error messages
      Exception occurred during event dispatching:
      java.lang.ArrayIndexOutOfBoundsException
      at javax.swing.colorchooser.SwatchPanel.getColorForCell(DefaultSwatchChooserPanel.java:208)
      at javax.swing.colorchooser.SwatchPanel.getColorForLocation(DefaultSwatchChooserPanel.java:204)
      at javax.swing.colorchooser.SwatchPanel.getToolTipText(DefaultSwatchChooserPanel.java:197)
      at javax.swing.ToolTipManager.mouseMoved(ToolTipManager.java:520)
      at java.awt.Component.processMouseMotionEvent(Component.java:3751)
      at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2294)
      at java.awt.Component.processEvent(Component.java:3543)
      at java.awt.Container.processEvent(Container.java:1159)
      at java.awt.Component.dispatchEventImpl(Component.java:2588)
      at java.awt.Container.dispatchEventImpl(Container.java:1208)
      at java.awt.Component.dispatchEvent(Component.java:2492)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2244)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
      at java.awt.Container.dispatchEventImpl(Container.java:1195)
      at java.awt.Window.dispatchEventImpl(Window.java:923)
      at java.awt.Component.dispatchEvent(Component.java:2492)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
      at java.awt.Dialog.show(Dialog.java:375)
      at javax.swing.ColorChooserDialog.show(JColorChooser.java:588)
      at javax.swing.JColorChooser.showDialog(JColorChooser.java:115)
      at ColorChooserBug.jButton1ActionPerformed(ColorChooserBug.java:59)
      at ColorChooserBug.access$100(ColorChooserBug.java:14)
      at ColorChooserBug$2.actionPerformed(ColorChooserBug.java:44)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1445)
      at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1499)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:373)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:245)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:211)
      at java.awt.Component.processMouseEvent(Component.java:3710)
      at java.awt.Component.processEvent(Component.java:3539)
      at java.awt.Container.processEvent(Container.java:1159)
      at java.awt.Component.dispatchEventImpl(Component.java:2588)
      at java.awt.Container.dispatchEventImpl(Container.java:1208)
      at java.awt.Component.dispatchEvent(Component.java:2492)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
      at java.awt.Container.dispatchEventImpl(Container.java:1195)
      at java.awt.Window.dispatchEventImpl(Window.java:923)
      at java.awt.Component.dispatchEvent(Component.java:2492)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)


      ======================================================================

            kereminsunw Konstantin Eremin (Inactive)
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: