com.imagero.gui.swing
Class ComponentRenderer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.imagero.gui.swing.ComponentRenderer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
ButtonRenderer

public class ComponentRenderer
extends javax.swing.JComponent

ComponentRenderer can rotate (90, 180, 270) any JComponent (except those which are using CellRenderer to paint itself)

See Also:
Serialized Form

Nested Class Summary
protected  class ComponentRenderer.MouseHandler
           
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected ComponentRenderer()
           
  ComponentRenderer(javax.swing.JComponent c)
           
  ComponentRenderer(javax.swing.JComponent c, javax.swing.CellRendererPane crp)
           
 
Method Summary
 boolean contains(int x, int y)
          Gives the UI delegate an opportunity to define the precise shape of this component for the sake of mouse processing.
protected  javax.swing.CellRendererPane createRendererPane()
           
protected  void dispatchToRenderer(javax.swing.JComponent c, java.awt.AWTEvent e)
           
 float getAlpha()
           
 int getAxis()
           
 javax.swing.JComponent getComponent()
           
protected  java.awt.AlphaComposite getComposite()
           
 java.awt.Dimension getMaximumSize()
          If the maximum size has been set to a non-null value just returns it.
 java.awt.Dimension getMinimumSize()
          If the minimum size has been set to a non-null value just returns it.
protected  ComponentRenderer.MouseHandler getMouseHandler()
           
 java.awt.Dimension getPreferredSize()
          If the preferredSize has been set to a non-null value just returns it.
 java.lang.String getToolTipText()
          Returns the tooltip string that has been set with setToolTipText.
 boolean isBorderPainted()
           
 boolean isClockwise()
           
 boolean isContentPainted()
           
 boolean isIgnoreMouse()
           
 boolean isUseAlpha()
           
static void main(java.lang.String[] args)
           
protected  void paintBorder(java.awt.Graphics g)
          Paints the component's border.
 void paintComponent(java.awt.Graphics g)
          Calls the UI delegate's paint method, if the UI delegate is non-null.
protected  void registerComponent()
           
 void setAlpha(float alpha)
           
 void setAxis(int axis)
           
 void setBorderPainted(boolean borderPainted)
           
protected  void setCellRendererPane(javax.swing.CellRendererPane crp)
           
 void setClockwise(boolean clockwise)
           
 void setComposite(java.awt.AlphaComposite composite)
           
 void setContentPainted(boolean contentPainted)
           
 void setIgnoreMouse(boolean ignoreMouse)
           
protected  void setRenderer(javax.swing.JComponent c)
           
 void setUseAlpha(boolean useAlpha)
           
 void showToolTip(boolean show)
           
protected  void unregisterComponent()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, list, list, paintComponents, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getSize, getToolkit, getTreeLock, hasFocus, imageUpdate, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, list, list, list, paintAll, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentRenderer

protected ComponentRenderer()

ComponentRenderer

public ComponentRenderer(javax.swing.JComponent c)

ComponentRenderer

public ComponentRenderer(javax.swing.JComponent c,
                         javax.swing.CellRendererPane crp)
Method Detail

contains

public boolean contains(int x,
                        int y)
Description copied from class: javax.swing.JComponent
Gives the UI delegate an opportunity to define the precise shape of this component for the sake of mouse processing.

Returns:
true if this component logically contains x,y
See Also:
Component.contains(int, int), ComponentUI

createRendererPane

protected javax.swing.CellRendererPane createRendererPane()

dispatchToRenderer

protected void dispatchToRenderer(javax.swing.JComponent c,
                                  java.awt.AWTEvent e)

getAlpha

public float getAlpha()

getAxis

public int getAxis()

getComponent

public javax.swing.JComponent getComponent()

getComposite

protected java.awt.AlphaComposite getComposite()

getMaximumSize

public java.awt.Dimension getMaximumSize()
Description copied from class: javax.swing.JComponent
If the maximum size has been set to a non-null value just returns it. If the UI delegate's getMaximumSize method returns a non-null value then return that; otherwise defer to the component's layout manager.

Returns:
the value of the maximumSize property
See Also:
JComponent.setMaximumSize(java.awt.Dimension), ComponentUI

getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from class: javax.swing.JComponent
If the minimum size has been set to a non-null value just returns it. If the UI delegate's getMinimumSize method returns a non-null value then return that; otherwise defer to the component's layout manager.

Returns:
the value of the minimumSize property
See Also:
JComponent.setMinimumSize(java.awt.Dimension), ComponentUI

getMouseHandler

protected ComponentRenderer.MouseHandler getMouseHandler()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: javax.swing.JComponent
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.

Returns:
the value of the preferredSize property
See Also:
JComponent.setPreferredSize(java.awt.Dimension), ComponentUI

getToolTipText

public java.lang.String getToolTipText()
Description copied from class: javax.swing.JComponent
Returns the tooltip string that has been set with setToolTipText.

Returns:
the text of the tool tip
See Also:
JComponent.TOOL_TIP_TEXT_KEY

isBorderPainted

public boolean isBorderPainted()

isClockwise

public boolean isClockwise()

isContentPainted

public boolean isContentPainted()

isIgnoreMouse

public boolean isIgnoreMouse()

isUseAlpha

public boolean isUseAlpha()

main

public static void main(java.lang.String[] args)

paintBorder

protected void paintBorder(java.awt.Graphics g)
Description copied from class: javax.swing.JComponent
Paints the component's border.

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.

Parameters:
g - the Graphics context in which to paint
See Also:
JComponent.paint(java.awt.Graphics), JComponent.setBorder(javax.swing.border.Border)

paintComponent

public void paintComponent(java.awt.Graphics g)
Description copied from class: javax.swing.JComponent
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 invoker super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in a non-opaque color. If you do not honor the opaque property you will likely see visual artifacts.

Parameters:
g - the Graphics object to protect
See Also:
JComponent.paint(java.awt.Graphics), ComponentUI

registerComponent

protected void registerComponent()

setAlpha

public void setAlpha(float alpha)

setAxis

public void setAxis(int axis)

setBorderPainted

public void setBorderPainted(boolean borderPainted)

setCellRendererPane

protected void setCellRendererPane(javax.swing.CellRendererPane crp)

setClockwise

public void setClockwise(boolean clockwise)

setComposite

public void setComposite(java.awt.AlphaComposite composite)

setContentPainted

public void setContentPainted(boolean contentPainted)

setIgnoreMouse

public void setIgnoreMouse(boolean ignoreMouse)

setRenderer

protected void setRenderer(javax.swing.JComponent c)

setUseAlpha

public void setUseAlpha(boolean useAlpha)

showToolTip

public void showToolTip(boolean show)

unregisterComponent

protected void unregisterComponent()