Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6348456
Votes 0
Synopsis BasicColorChooserUI ignores JColorChooser selection model changes
Category java:classes_swing
Reported Against
Release Fixed 7(b27)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 6707406
Submit Date 10-NOV-2005
Description
FULL PRODUCT VERSION :
1.6.0-beta-b59

A DESCRIPTION OF THE PROBLEM :
If you call JColorChooser#setSelectionModel the color chooser doesn't show a preview anymore. BasicColorChooserUI registers a listener for updating the preview panel only with the initial selection model, but doesn't reregister this listener if the color chooser's selection model changes.

BasicColorChooserUI has a property change handler that should listen to the JColorChooser's property JColorChooser.SELECTION_MODEL_PROPERTY.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Construct a JColorChooser
JColorChooser colorChooser = new JColorChooser(Color.RED);

2) Change the selection model.
colorChooser.setSelectionModel(new DefaultColorSelectionModel(Color.WHITE));

3)  Display the color chooser, e.g.
JDialog dialog = JColorChooser.createDialog(null, "Choose", true, colorChooser, null, null);
dialog.show();

4) Choose a color.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
After step 3, the preview panel should display WHITE, not RED.
After step 4, the preview shall display a preview of the selected color.
ACTUAL -
After step 3, the preview panel displays RED.
When choosing a color, the preview panel displays RED.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

import java.awt.Color;

import javax.swing.JColorChooser;
import javax.swing.JDialog;
import javax.swing.colorchooser.DefaultColorSelectionModel;

public class BasicColorChooserUIBug {
    
    public static void main(String[] args) {
        JColorChooser colorChooser = new JColorChooser(Color.RED);
        colorChooser.setSelectionModel(new DefaultColorSelectionModel(Color.WHITE));
        JDialog dialog = JColorChooser.createDialog(null, "Choose", true, colorChooser, null, null);
        dialog.show();
    }

}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
1) Don't use JColorChooser#setSelectionModel. Use only JColorChooser(ColorSelectionModel)

2) Use a look&feel that fixes the bug, i.e. that listens to changes of the color selection model to reregister the preview listener.
Posted Date : 2005-11-10 10:15:54.0
Work Around
N/A
Evaluation
Contribution forum : https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=14451
Posted Date : 2006-07-26 07:10:59.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang