|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfr.esrf.tangoatk.widget.util.jdraw.JDObject
fr.esrf.tangoatk.widget.util.jdraw.JDRectangular
fr.esrf.tangoatk.widget.util.jdraw.JDSwingObject
public class JDSwingObject
JDraw Swing graphic object. JDSwingObject allows a JComponent to be edited (and played) within JDraw as if it is a JDObject. The JComponent must implements the JDrawable interface. Implementing JDrawable for a Component is interresting if you want to make your component available in the JDrawEditor. Adding a component for playing only can be done by using the classic add(Component) method, no need here to be JDrawable ,however the add() method shoud be called after initPlayer() or loadFile() is called. Here is an example of a simple JDrawable JButton:
public class MyJDButton extends JButton implements JDrawable {
static String[] extensions = {"text"};
public void initForEditing() {
setText("Button");
setBorder(JDSwingObject.etchedBevelBorder);
}
public JComponent getComponent() {
return this;
}
public String[] getExtensionList() {
return extensions;
}
public boolean setExtendedParam(String name,String value,boolean popupAllowed) {
if(name.equalsIgnoreCase("text")) {
setText(value);
return true;
}
return false;
}
public String getExtendedParam(String name) {
if(name.equalsIgnoreCase("text")) {
return getText();
}
return "";
}
public String getDescription(String extName) {
if(extName.equalsIgnoreCase("text")) {
return "JButton label";
}
return "";
}
}
JDrawable,
JDrawableList,
JDrawEditorFrame.main(java.lang.String[])| Field Summary | |
|---|---|
static int |
ETCHED_BORDER
Etched border. |
static javax.swing.border.Border |
etchedBevelBorder
Swing Etched border used by JDSwingObject. |
static javax.swing.border.Border |
lowerBevelBorder
Swing Lowered border used by JDSwingObject. |
static int |
LOWERED_BORDER
Lowered border. |
static int |
NO_BORDER
No border. |
static javax.swing.border.Border |
raiseBevelBorder
Swing Raised border used by JDSwingObject. |
static int |
RAISED_BORDER
Raised border. |
| Constructor Summary | |
|---|---|
JDSwingObject(java.lang.String objectName,
java.lang.String className,
int x,
int y)
Contruct a JDSwingObject |
|
| Method Summary | |
|---|---|
JDObject |
copy(int x,
int y)
Returns a copy of this object at the specified location. |
int |
getBorder()
Returns the current border. |
java.lang.String |
getClassName()
Returns class name of the Swing JComponent object. |
javax.swing.JComponent |
getComponent()
Returns the actual JComponent. |
java.lang.String |
getExtendedParamDesc(java.lang.String extName)
Returns the description of the specified extension. |
java.awt.Font |
getFont()
Returns the current font. |
boolean |
hasShadow()
Returns true only if this object is shadowed. |
boolean |
isFixedExtendedParam(java.lang.String name)
Returns true if the specified param is fixed. |
void |
paint(JDrawEditor parent,
java.awt.Graphics g)
Paints this object. |
void |
removeExtension(int idx)
Remove the extended param at the specified index. |
void |
setBackground(java.awt.Color b)
Sets the background color (usualy fill color) of this object. |
void |
setBorder(int border)
Sets the border of this component. |
void |
setExtendedParam(java.lang.String name,
java.lang.String value)
Sets the extended param value. |
void |
setFillStyle(int style)
Sets the fill style of this object. |
void |
setFont(java.awt.Font f)
Sets the font of this JDSwingObject. |
void |
setFont(java.awt.Font f,
boolean resize)
Sets the font of this JDSwingObject and resize the component if needed. |
void |
setForeground(java.awt.Color b)
Sets the foreground color (usualy line color) of this object. |
void |
setVisible(boolean v)
Shows or hides this object. |
| Methods inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDRectangular |
|---|
moveSummit, rotate90 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static javax.swing.border.Border lowerBevelBorder
public static javax.swing.border.Border raiseBevelBorder
public static javax.swing.border.Border etchedBevelBorder
public static final int NO_BORDER
public static final int LOWERED_BORDER
public static final int RAISED_BORDER
public static final int ETCHED_BORDER
| Constructor Detail |
|---|
public JDSwingObject(java.lang.String objectName,
java.lang.String className,
int x,
int y)
objectName - Object nameclassName - Class name of the JDrawable objectx - Up left corner x coordinatey - Up left corner y coordinate| Method Detail |
|---|
public JDObject copy(int x,
int y)
JDObject
copy in class JDObjectx - Horizontal position of the copied object (pixel)y - Vertical Position of the copied object (pixel)
public void paint(JDrawEditor parent,
java.awt.Graphics g)
JDObject
paint in class JDRectangularparent - JdrawEditor parent (Can be null except for JDSwingObject)g - the specified Graphics windowpublic boolean isFixedExtendedParam(java.lang.String name)
isFixedExtendedParam in class JDObjectname - Param name.
public void setExtendedParam(java.lang.String name,
java.lang.String value)
JDObject
setExtendedParam in class JDObjectname - Param namevalue - Param valueJDObject.setExtensionList(java.lang.String[])public void removeExtension(int idx)
JDObject
removeExtension in class JDObjectidx - Index of the extension.public java.lang.String getExtendedParamDesc(java.lang.String extName)
JDObject
getExtendedParamDesc in class JDObjectextName - Extension namepublic void setBackground(java.awt.Color b)
JDObject
setBackground in class JDObjectb - Background colorpublic void setForeground(java.awt.Color b)
JDObject
setForeground in class JDObjectb - Foreground colorpublic void setVisible(boolean v)
JDObject
setVisible in class JDObjectv - True to show, false otherwise.public void setFillStyle(int style)
JDObject
setFillStyle in class JDObjectstyle - Fill styleJDObject.FILL_STYLE_NONE,
JDObject.FILL_STYLE_SOLID,
JDObject.FILL_STYLE_LARGE_RIGHT_HATCH,
JDObject.FILL_STYLE_LARGE_LEFT_HATCH,
JDObject.FILL_STYLE_LARGE_CROSS_HATCH,
JDObject.FILL_STYLE_SMALL_RIGHT_HATCH,
JDObject.FILL_STYLE_SMALL_LEFT_HATCH,
JDObject.FILL_STYLE_SMALL_CROSS_HATCH,
JDObject.FILL_STYLE_DOT_PATTERN_1,
JDObject.FILL_STYLE_DOT_PATTERN_2,
JDObject.FILL_STYLE_DOT_PATTERN_3,
JDObject.FILL_STYLE_GRADIENTpublic void setFont(java.awt.Font f)
f - Font
public void setFont(java.awt.Font f,
boolean resize)
f - Fontresize - true to resize the component.public void setBorder(int border)
border - BorderNO_BORDER,
LOWERED_BORDER,
RAISED_BORDER,
ETCHED_BORDERpublic int getBorder()
setBorder(int)public java.awt.Font getFont()
setFont(Font),
setFont(Font,boolean)public boolean hasShadow()
JDObject
hasShadow in class JDObjectpublic java.lang.String getClassName()
public javax.swing.JComponent getComponent()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||