net.luniks.jtvd
Class ImagePanel.Item
java.lang.Object
java.awt.event.MouseAdapter
net.luniks.jtvd.ImagePanel.Item
- All Implemented Interfaces:
- java.util.EventListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
- Direct Known Subclasses:
- ImagePanel.MenuItem
- Enclosing class:
- ImagePanel
- class ImagePanel.Item
- extends java.awt.event.MouseAdapter
- implements java.awt.event.MouseMotionListener, java.awt.event.KeyListener
This class provides a text item that can be drawn on for example a JPanel
and selected and moved around with the arrow keys or by dragging it with
the mouse. Properties such as colors and font style can be set.
The purpose of these items is to use them as text elements in the menu.
- Author:
- Torsten Römer, luniks.net
|
Constructor Summary |
ImagePanel.Item(int id,
java.lang.String text,
int x,
int y)
|
| Methods inherited from class java.awt.event.MouseAdapter |
mouseClicked, mouseEntered, mouseExited, mouseReleased |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SHORT_TEXT_LENGTH
public static final int SHORT_TEXT_LENGTH
- See Also:
- Constant Field Values
id
protected int id
text
protected java.lang.String text
x
protected int x
y
protected int y
dx
protected int dx
dy
protected int dy
selected
protected boolean selected
print
protected boolean print
selectedRect
protected java.awt.Rectangle selectedRect
selectedColor
protected java.awt.Color selectedColor
fontColor
protected java.awt.Color fontColor
font
protected java.awt.Font font
selectedStroke
protected java.awt.BasicStroke selectedStroke
width
protected int width
height
protected int height
textX
protected int textX
textY
protected int textY
deleteable
protected boolean deleteable
ImagePanel.Item
public ImagePanel.Item(int id,
java.lang.String text,
int x,
int y)
draw
public void draw(java.awt.Graphics2D g2d)
mousePressed
public void mousePressed(java.awt.event.MouseEvent me)
- Specified by:
mousePressed in interface java.awt.event.MouseListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent me)
- Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent me)
- Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
keyPressed
public void keyPressed(java.awt.event.KeyEvent ke)
- Specified by:
keyPressed in interface java.awt.event.KeyListener
keyReleased
public void keyReleased(java.awt.event.KeyEvent ke)
- Specified by:
keyReleased in interface java.awt.event.KeyListener
keyTyped
public void keyTyped(java.awt.event.KeyEvent ke)
- Specified by:
keyTyped in interface java.awt.event.KeyListener
setId
public void setId(int id)
setText
public void setText(java.lang.String text)
setX
public void setX(int x)
- Sets the x coordinate of this item. This method ensures that
the center x of this item is never outside the ImagePanel.
- Parameters:
x - the new x coordinate
setY
public void setY(int y)
- Sets the y coordinate of this item. This method ensures that
the center y of this item is never outside the ImagePanel.
- Parameters:
y - the new y coordinate
setLocation
public void setLocation(int x,
int y)
validateLocation
public void validateLocation()
setSelected
public void setSelected(boolean selected)
setSelectedColor
public void setSelectedColor(java.awt.Color selectedColor)
setPrint
public void setPrint(boolean print)
setRect
public void setRect(java.awt.Rectangle selectedRect)
setFontColor
public void setFontColor(java.awt.Color fontColor)
setFont
public void setFont(java.awt.Font font)
setDeleteable
public void setDeleteable(boolean deleteable)
getId
public int getId()
getText
public java.lang.String getText()
getShortText
public java.lang.String getShortText()
getX
public int getX()
getY
public int getY()
isSelected
public boolean isSelected()
getPrint
public boolean getPrint()
getRect
public java.awt.Rectangle getRect()
getSelectedColor
public java.awt.Color getSelectedColor()
getFont
public java.awt.Font getFont()
getFontColor
public java.awt.Color getFontColor()
isDeleteable
public boolean isDeleteable()
toString
public java.lang.String toString()
Copyright (c) 2004, 2005 Torsten Römer, dode@luniks.net