APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.colorchooser

pack-priv Class DefaultPreviewPanel

extends JPanel
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
javax.swing.*, javax.swing.border.*, javax.swing.event.*, javax.swing.text.*, java.awt.*, java.awt.image.*, java.awt.event.*, java.beans.PropertyChangeEvent, .PropertyChangeListener, java.io.Serializable, sun.swing.SwingUtilities2

The standard preview panel for the color chooser.

Warning

Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Author
Steve Wilson
See Also
JColorChooser

Field Summary

Modifier and TypeField and Description
private Font
private int
private Color
private String
private int
private int
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private JColorChooser
public Dimension
getPreferredSize()

Overrides javax.swing.JComponent.getPreferredSize.

If the preferredSize has been set to a non-null value just returns it.

private String
public void
paintComponent(Graphics g)

Overrides javax.swing.JComponent.paintComponent.

Calls the UI delegate's paint method, if the UI delegate is non-null.

private int
paintSquares(Graphics g, int offsetX)

private int
paintSwatch(Graphics g, int offsetX)

private int
paintText(Graphics g, int offsetX)

Inherited from javax.swing.JPanel:
getAccessibleContextgetUIgetUIClassIDparamStringsetUIupdateUI

Field Detail

fontback to summary
private Font font

Hides java.awt.Component.font.

innerGapback to summary
private int innerGap
oldColorback to summary
private Color oldColor
sampleTextback to summary
private String sampleText
squareGapback to summary
private int squareGap
squareSizeback to summary
private int squareSize
swatchWidthback to summary
private int swatchWidth
textGapback to summary
private int textGap

Constructor Detail

DefaultPreviewPanelback to summary
pack-priv DefaultPreviewPanel()

Method Detail

getColorChooserback to summary
private JColorChooser getColorChooser()
getPreferredSizeback to summary
public Dimension getPreferredSize()

Overrides javax.swing.JComponent.getPreferredSize.

Doc from javax.swing.JComponent.getPreferredSize.

If the preferredSize has been set to a non-null value just returns it. If the UI delegate's getPreferredSize method returns a non null value then return that; otherwise defer to the component's layout manager.

getSampleTextback to summary
private String getSampleText()
paintComponentback to summary
public void paintComponent(Graphics g)

Overrides javax.swing.JComponent.paintComponent.

Doc from javax.swing.JComponent.paintComponent.

Calls the UI delegate's paint method, if the UI delegate is non-null. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate).

If you override this in a subclass you should not make permanent changes to the passed in Graphics. For example, you should not alter the clip Rectangle or modify the transform. If you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. Further, if you do not invoke super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in an opaque color. If you do not honor the opaque property you will likely see visual artifacts.

The passed in Graphics object might have a transform other than the identify transform installed on it. In this case, you might get unexpected results if you cumulatively apply another transform.

paintSquaresback to summary
private int paintSquares(Graphics g, int offsetX)
paintSwatchback to summary
private int paintSwatch(Graphics g, int offsetX)
paintTextback to summary
private int paintText(Graphics g, int offsetX)