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 / January 2004

Tip: Looking for answers? Try searching our database.

JColorChooser question

Thread view: 
dev null - 04 Jan 2004 14:50 GMT
Can anyone suggest a way that I can have JColorChooser's
showDialog appear initially in its RGB tab?  (ie index 2)  

For example, when the program below runs, it initially
displays the "Swatches" tab (ie index 0), but there doesn't
seem to be a way to get access to the underlying JTabbedPane
to call its setIndex method.

I tried looking at Sun's source to see if I could create
a subclass of JColorChooser, but I got lost in its
javax.swing.colorchooser package and never did figure out
where to get a ref to the JTabbedPane used by showDialog.
Is there a UI attribute that I can use to set the tab
index initially displayed?  TIA,

import javax.swing.*;

class cc extends JFrame
  {
  public cc () throws Exception
     {
     Color c = JColorChooser.showDialog (this, ", null);
     if (c != null)
    {
        System.out.println ("Red:   " + c.getRed ());
        System.out.println ("Green: " + c.getGreen ());
        System.out.println ("Blue:  " + c.getBlue ());
    }
     else
    System.out.println ("you didn't pick a color!");
     System.exit (0);
     }

  public static void main (String args[]) throws Exception
     {
     new cc ();
     }
  }
Tom Cole - 05 Jan 2004 02:30 GMT
Have you looked into:

getChooserPanels();
setChooserPanels(AbstractChooserPanels[]);
and
removeChooserPanel();

> Can anyone suggest a way that I can have JColorChooser's
> showDialog appear initially in its RGB tab?  (ie index 2)
[quoted text clipped - 34 lines]
>       }
>    }


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.