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

pack-priv Class SwatchPanel

Located in compilation unit of javax.swing.colorchooser.DefaultSwatchChooserPanel.

extends JPanel
Class Inheritance
Known Direct Subclasses
javax.swing.colorchooser.RecentSwatchPanel, javax.swing.colorchooser.MainSwatchPanel
Annotations
@SuppressWarnings:serial

Field Summary

Modifier and TypeField and Description
protected Color[]
protected Dimension
protected Dimension
private int
private int
protected Dimension

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Color
getColorForCell(int column, int row)

public Color
getColorForLocation(int x, int y)

public Dimension
getPreferredSize()

Overrides javax.swing.JComponent.getPreferredSize.

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

public Color
public String
getToolTipText(MouseEvent e)

Overrides javax.swing.JComponent.getToolTipText.

Returns the string to be used as the tooltip for event.

protected void
protected void
public void
paintComponent(Graphics g)

Overrides javax.swing.JComponent.paintComponent.

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

public void
Inherited from javax.swing.JPanel:
getAccessibleContextgetUIgetUIClassIDparamStringsetUIupdateUI

Field Detail

colorsback to summary
protected Color[] colors
gapback to summary
protected Dimension gap
numSwatchesback to summary
protected Dimension numSwatches
selColback to summary
private int selCol
selRowback to summary
private int selRow
swatchSizeback to summary
protected Dimension swatchSize

Constructor Detail

SwatchPanelback to summary
public SwatchPanel()

Method Detail

getColorForCellback to summary
private Color getColorForCell(int column, int row)
getColorForLocationback to summary
public Color getColorForLocation(int x, int y)
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.

getSelectedColorback to summary
public Color getSelectedColor()
getToolTipTextback to summary
public String getToolTipText(MouseEvent e)

Overrides javax.swing.JComponent.getToolTipText.

Doc from javax.swing.JComponent.getToolTipText.

Returns the string to be used as the tooltip for event. By default this returns any string set using setToolTipText. If a component provides more extensive API to support differing tooltips at different locations, this method should be overridden.

initColorsback to summary
protected void initColors()
initValuesback to summary
protected void initValues()
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.

setSelectedColorFromLocationback to summary
public void setSelectedColorFromLocation(int x, int y)