hello friends,
I want to know what do you mean by the component called color choosers in Java ? and how do I use this component in my program ? Can anyone provide the information regarding this.....
hello friends,
I want to know what do you mean by the component called color choosers in Java ? and how do I use this component in my program ? Can anyone provide the information regarding this.....
A color chooser is a component that you can place anywhere within your program GUI. The color chooser consists of everything within the box labeled Choose Text Color.
This is how a standard color chooser looks like in Java.
It contains two parts - (i) a tabbed pane and (ii) a preview panel.
(i) In the tabbed pane, the three tabs select chooser panels.
(ii) The preview panel below the tabbed pane displays the currently selected color.
Use the JColorChooser class to provide users with a palette of colors to choose from. The JColorChooser API also makes it easy to bring up a dialog (modal or not) that contains a color chooser.
An example code that creates a JColorChooser instance and adds it to a container:
public class ColorChooserDemo extends JPanel ... {
public ColorChooserDemo()
{
super(new BorderLayout());
banner = new JLabel("Welcome to the Tutorial Zone!",
JLabel.CENTER);
banner.setForeground(Color.yellow);
. . .
tcc = new JColorChooser(banner.getForeground());
. . .
add(tcc, BorderLayout.PAGE_END);
}
For the detailed code - click here
Bookmarks