Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2004

Tip: Looking for answers? Try searching our database.

Recent color on JColorChooser

Thread view: 
James Gralton - 13 Apr 2004 17:00 GMT
Hi,

I have the following snippet of code in my application:

Color bgColor = this.jColorChooser.showDialog(this, "Choose Background
Colour",c);

this.jColorChooser is a class variable and the chooser is initiated and
used a number of times in the application. I use the color chooser as a
class variable as i want it to remember in the recently selected colors
in the 'Recent' part of the dialog. It isn't however doing this and each
time it is initiated there are no colors in the recent section.

Can anyone tell me anything i am doing wrong.

Thank you

James Gralton
Steve W. Jackson - 13 Apr 2004 23:03 GMT
>:Hi,
>:
[quoted text clipped - 14 lines]
>:
>:James Gralton

Three tries, huh?  :-)

Without more detail, as in code, this is just speculation.  But I expect
that the use of the showDialog() method is the source of your problem.  
Here's how we've done it in our app.

We have a JColorChooser instance variable in a class.  We populate it
via a constructor the first time we use it, then call the createDialog
method.  This requires that we specify the component that will own the
new dialog it returns, a dialog title, a boolean indicating whether to
make it modal, the JColorChooser variable (which serves as the chooser's
pane), and action listeners for the OK and Cancel buttons.  We've set
the latter null, since we discard the Cancel action, and only provide
one for when the user chooses a color so that we can take appropriate
measures.

HTH.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.