|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.formaria.swing.Panel
org.formaria.swing.CaptionedImage
public class CaptionedImage
An extension of the Image component that adds a caption to the image and an optional border
Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.
$Revision: 1.21 $
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected int |
borders
|
protected Label |
caption
|
protected ClickListener |
clickListener
|
protected Project |
currentProject
The owner project and the context in which this object operates. |
protected Image |
image
|
protected java.lang.String |
imgName
|
protected java.util.ArrayList |
listeners
|
protected int |
maxHeight
|
protected int |
maxWidth
|
protected int |
minHeight
|
protected int |
minWidth
|
protected int |
padding
|
protected int |
prefHeight
|
protected int |
prefWidth
|
protected boolean |
shadow
|
| Fields inherited from class org.formaria.swing.Panel |
|---|
arc, BORDER_BEVEL, BORDER_FLAT, BORDER_NONE, drawBorder, translucent, usesLaf |
| 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 | |
|---|---|
CaptionedImage()
Creates a new instance of CaptionedImage |
|
| Method Summary | |
|---|---|
void |
add(java.lang.Object c,
java.lang.Object constraint)
Add a child component |
void |
addCaptionListener(java.awt.event.MouseListener l)
Adds a mouse listener to this component to listen for mouse events. |
int |
findCurrentResponse(int x,
int y)
Find the response corresponding to the current point |
protected void |
fireActionPerformed(java.awt.event.MouseEvent event)
Notifies all mouse listeners that have registered interest for notification on mouse event types. |
int |
getAlignment()
Get the alignment style constant |
int |
getBorders()
Gets the border flag value. |
java.lang.String |
getCaption()
Get the caption |
java.lang.String |
getCaptionStyle()
Get the caption style |
java.lang.Object |
getChildComponent(int i)
Get a child component |
boolean |
getFillBorder()
Gets the fill border flag value. |
Image |
getImage()
Returns the Image instance used by ths class. |
java.lang.String |
getImageName()
Gets the name of the image being displayed. |
java.lang.String |
getImageStyle()
Get the image style |
java.awt.Insets |
getInsets()
Get the insets |
java.awt.Dimension |
getMaximumSize()
Get the maximum component size |
int |
getMinHeight()
Get the minimum height of the component |
java.awt.Dimension |
getMinimumSize()
Get the minimum component size |
int |
getMinWidth()
Get the minimum width of the component |
boolean |
getOpaque()
Get the opaque property |
int |
getPadding()
Get the padding |
java.awt.Dimension |
getPreferredSize()
Get the preferred component size |
boolean |
getShadow()
Gets the shadow flag value. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Fired when a mouse is clicked on this component. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Fired when a mouse enters this component. |
void |
mouseExited(java.awt.event.MouseEvent e)
Fired when a mouse exited this component. |
void |
mousePressed(java.awt.event.MouseEvent e)
Fired when a mouse is pressed on this component. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Fired when a mouse is released on this component. |
void |
paintComponent(java.awt.Graphics g)
Update the panel by erasing and then rendering the frame if any |
void |
paintStates()
Repaint the responses |
void |
remove(java.lang.Object c)
Remove a child component |
void |
removeCaptionListener(java.awt.event.MouseListener l)
Removes a mouse listener to this component. |
boolean |
respond()
Called by ClickListener to check if a response event should be sent to the parent form. |
void |
setAlignment(int align)
Set the alignment attribute |
void |
setAlignmentString(java.lang.String align)
Set the alignment attribute |
void |
setAntiAlias(boolean mode)
Set the anti-alias mode |
void |
setArc(int value)
Set the arc size |
void |
setBorders(int bv)
Sets the border flag value. |
void |
setBuffered(boolean value)
Set the double buffering on or off |
void |
setCaption(java.lang.String s)
Set the caption |
void |
setCaptionStyle(java.lang.String newStyle)
Set the caption style |
void |
setContent(java.lang.String content)
Set the component content - the image name |
void |
setDragEnabled(boolean value)
Set the image as drag enabled |
void |
setDragInfo(java.lang.Object info)
Set the drag information |
void |
setEnabled(boolean state)
Set the enabled state |
void |
setImage(java.lang.String value)
Set the relative path of the image to display |
void |
setImageName(java.lang.String name)
Gets the name of the image being displayed. |
void |
setImageStyle(java.lang.String newStyle)
Set the image style |
void |
setMaxHeight(int value)
Set the maximum height of the component |
void |
setMaxWidth(int value)
Set the maximum width of the component |
void |
setMinHeight(int value)
Set the minimum height of the component |
void |
setMinWidth(int value)
Set the minimum width of the component |
void |
setName(java.lang.String value)
Sets the Image instance to have the same name as the instansiating class. |
void |
setNextAttributes(java.lang.Object attribs)
Set the attributes for the next component being added |
void |
setOpaque(boolean value)
Set the opaque property |
void |
setPadding(int pad)
Set the padding |
void |
setPreferredHeight(int value)
Set the preferred height of the component |
void |
setPreferredWidth(int value)
Set the preferred width of the component |
void |
setShadow(boolean value)
Turn on/off the drop shadow |
boolean |
setState(int x,
int y,
int defResponse)
Find a response |
void |
setStretch(int mode)
Set the drag information |
void |
setTooltip(java.lang.String value)
Set the opaque property |
void |
setup(java.lang.String name,
int preferredWidth,
int preferredHeight,
java.util.Hashtable params)
Setup the container |
void |
updateSelectedState()
Does nothing in this instance |
| Methods inherited from class org.formaria.swing.Panel |
|---|
addNotify, getArc, getDrawBorder, getPainter, getUsesLaf, restoreState, saveState, setBlend, setBorder, setBounds, setDrawBorder, setPad, setPainter, setSwingBorder, setTitle, setTitlePos, setTitlePosition, setTitleStyle, setToolTip, setTranslucent, setUsesLaf, update |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.formaria.aria.ContentHolder |
|---|
doLayout, getName |
| Field Detail |
|---|
protected Image image
protected Label caption
protected java.lang.String imgName
protected int padding
protected int minWidth
protected int minHeight
protected int maxWidth
protected int maxHeight
protected int prefWidth
protected int prefHeight
protected int borders
protected boolean shadow
protected ClickListener clickListener
protected java.util.ArrayList listeners
protected Project currentProject
| Constructor Detail |
|---|
public CaptionedImage()
| Method Detail |
|---|
public void setup(java.lang.String name,
int preferredWidth,
int preferredHeight,
java.util.Hashtable params)
setup in interface ContentHoldername - set the container namepreferredWidth - the desired widthpreferredHeight - the desired heightparams - a table of extra propertiespublic java.lang.Object getChildComponent(int i)
getChildComponent in interface ContentHolderi - the index of the child within the container
public void add(java.lang.Object c,
java.lang.Object constraint)
add in interface ContentHolderc - the child componentconstraint - the layout constraintpublic void remove(java.lang.Object c)
remove in interface ContentHolderc - the child componentpublic void paintStates()
paintStates in interface StateListener
public boolean setState(int x,
int y,
int defResponse)
setState in interface StateListenerx - the x coordinate of the mouse clicky - the y coordinate of the mouse clickdefResponse - the default response
public int findCurrentResponse(int x,
int y)
findCurrentResponse in interface StateListenerx - the x coordinate of the mouse clicky - the y coordinate of the mouse click
public void updateSelectedState()
updateSelectedState in interface StateListenerpublic boolean respond()
public java.awt.Dimension getMinimumSize()
getMinimumSize in class javax.swing.JComponentpublic java.awt.Dimension getMaximumSize()
getMaximumSize in class javax.swing.JComponentpublic int getMinWidth()
public int getMinHeight()
public void setMinWidth(int value)
value - the minimum widthpublic void setMinHeight(int value)
value - the minimum heightpublic void setMaxHeight(int value)
value - the minimum heightpublic void setMaxWidth(int value)
value - the minimum heightpublic void setPreferredHeight(int value)
value - the minimum heightpublic void setPreferredWidth(int value)
value - the minimum heightpublic java.awt.Dimension getPreferredSize()
getPreferredSize in class Panelpublic boolean getOpaque()
public void setContent(java.lang.String content)
setContent in interface ContentHolderthe - content valuepublic java.awt.Insets getInsets()
getInsets in class Panelpublic void setEnabled(boolean state)
setEnabled in class javax.swing.JComponentpublic void paintComponent(java.awt.Graphics g)
Panel
paintComponent in class Panelg - the graphics contextpublic int getPadding()
public void setPadding(int pad)
the - paddingpublic int getAlignment()
public void setAlignment(int align)
align - 1 to right align the text, 0 for left alignment and 2 for centered textpublic void setAlignmentString(java.lang.String align)
align - left, right, centerpublic void setBuffered(boolean value)
public java.lang.String getCaptionStyle()
public void setCaptionStyle(java.lang.String newStyle)
newStyle - the style namepublic java.lang.String getImageStyle()
public void setImageStyle(java.lang.String newStyle)
newStyle - the style namepublic java.lang.String getCaption()
public void setCaption(java.lang.String s)
s - the caption textpublic boolean getShadow()
public java.lang.String getImageName()
public void setImageName(java.lang.String name)
setImageName in class Panelname - the new translucencypublic boolean getFillBorder()
public int getBorders()
public void setBorders(int bv)
bv - the border propertypublic void setShadow(boolean value)
value - true to turn the sthadow onpublic void setImage(java.lang.String value)
value - public void setArc(int value)
setArc in class Panelvalue - the arc sizepublic void setOpaque(boolean value)
setOpaque in class javax.swing.JComponentvalue - the opaque value true|falsepublic void setTooltip(java.lang.String value)
value - the opaque value true|falsepublic void setDragEnabled(boolean value)
value - public void setDragInfo(java.lang.Object info)
info - public void setStretch(int mode)
info - public void setAntiAlias(boolean mode)
mode - public void setName(java.lang.String value)
setName in class java.awt.Componentvalue - String specifying the name given tos this class.public Image getImage()
Image instance returned.public void addCaptionListener(java.awt.event.MouseListener l)
l - the MouseListener that is to be added.public void removeCaptionListener(java.awt.event.MouseListener l)
l - the MouseListener that is to be removed.public void setNextAttributes(java.lang.Object attribs)
setNextAttributes in interface ContentHolderattribs - a table of attributespublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenere - the passed MouseEvent instance.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenere - the passed MouseEvent instance.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenere - the passed MouseEvent instance.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenere - the passed MouseEvent instance.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenere - the passed MouseEvent instance.protected void fireActionPerformed(java.awt.event.MouseEvent event)
event
parameter.
event - the MouseEvent object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||