For Programmers: Free Programming Magazines  


Home > Archive > Java Help > March 2008 > JColorChooser default button, TableDialogEditDemo









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author JColorChooser default button, TableDialogEditDemo
John B. Matthews

2008-03-30, 10:06 pm

I'm puzzled by the behavior of TableDialogEditDemo

<http://java.sun.com/docs/books/tuto...zipfiles/compon
ents-TableDialogEditDemoProject.zip>

under Java 1.5.0_13, on Mac OS 10.4.11. The first time the JColorChooser
dialog is displayed, the OK button is the default; on subsequent
invocations, no default appears. The relevant code in CellEditor.java
instantiates JColorChooser and creates a dialog

colorChooser = new JColorChooser();
dialog = JColorChooser.createDialog(...)

The code then reveals the dialog in the actionPerformed() method, when a
table cell is clicked:

dialog.setVisible(true);

Although it's a bit slower, the problem does not occur if the dialog is
re-created each time:

newColor = JColorChooser.showDialog(null, "Choose...", currentColor);

Is this a platform anomaly? Is there a way to set the default button
before making the dialog visible?

Thanks for any insights,

John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com