public class JDSwingObject extends JDRectangular
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 ""; } }
Modifier and Type | Field and Description |
---|---|
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.
|
FILL_STYLE_DOT_PATTERN_1, FILL_STYLE_DOT_PATTERN_2, FILL_STYLE_DOT_PATTERN_3, FILL_STYLE_GRADIENT, FILL_STYLE_LARGE_CROSS_HATCH, FILL_STYLE_LARGE_LEFT_HATCH, FILL_STYLE_LARGE_RIGHT_HATCH, FILL_STYLE_NONE, FILL_STYLE_SMALL_CROSS_HATCH, FILL_STYLE_SMALL_LEFT_HATCH, FILL_STYLE_SMALL_RIGHT_HATCH, FILL_STYLE_SOLID, LINE_STYLE_DASH, LINE_STYLE_DASH_DOT, LINE_STYLE_DOT, LINE_STYLE_LONG_DASH, LINE_STYLE_SOLID, VALUE_CHANGE_ON_XDRAG_LEFT, VALUE_CHANGE_ON_XDRAG_RIGHT, VALUE_CHANGE_ON_YDRAG_BOTTOM, VALUE_CHANGE_ON_YDRAG_TOP, VALUE_INC_ON_CLICK, VALUE_INC_ON_PRESSRELEASE
Constructor and Description |
---|
JDSwingObject(java.lang.String objectName,
java.lang.String className,
int x,
int y)
Contruct a JDSwingObject
|
Modifier and Type | Method and Description |
---|---|
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.
|
moveSummit, rotate90
addExtension, addMouseListener, addValueListener, centerOrigin, clearMouseListener, clearValueListener, getBackground, getBackgroundMapper, getBoundRect, getExtendedParam, getExtendedParam, getExtendedParamIndex, getExtendedParamName, getExtendedParamNumber, getFillStyle, getForeground, getForegroundMapper, getHTranslationMapper, getInitValue, getInvertShadowMapper, getLineStyle, getLineWidth, getMaxValue, getMinValue, getName, getObjectsByName, getOrigin, getShadowWidth, getSummit, getSummitNumber, getValue, getValueChangeMode, getVisibilityMapper, getVTranslationMapper, hasBackgroundMapper, hasExtendedParam, hasForegroundMapper, hasHTranslationMapper, hasInverseShadow, hasInvertShadowMapper, hasVisibilityMapper, hasVTranslationMapper, isAntiAliased, isDisabled, isInsideObject, isInteractive, isProgrammed, isVisible, moveSummitH, moveSummitV, preRefresh, refresh, removeMouseListener, removeValueListener, restoreTransform, saveTransform, scale, scaleTranslate, setAntiAlias, setBackgroundMapper, setDisabled, setExtendedParam, setExtensionList, setForegroundMapper, setGradientFillParam, setHTranslationMapper, setInitValue, setInteractive, setInverseShadow, setInvertShadowMapper, setLineStyle, setLineWidth, setMaxValue, setMinValue, setName, setOrigin, setShadow, setShadowWidth, setValue, setValueChangeMode, setVisibilityMapper, setVTranslationMapper, toString, translate
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
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 coordinatepublic JDObject copy(int x, int y)
JDObject
public void paint(JDrawEditor parent, java.awt.Graphics g)
JDObject
paint
in class JDRectangular
parent
- JdrawEditor parent (Can be null except for JDSwingObject)g
- the specified Graphics windowpublic boolean isFixedExtendedParam(java.lang.String name)
isFixedExtendedParam
in class JDObject
name
- Param name.public void setExtendedParam(java.lang.String name, java.lang.String value)
JDObject
setExtendedParam
in class JDObject
name
- Param namevalue
- Param valueJDObject.setExtensionList(java.lang.String[])
public void removeExtension(int idx)
JDObject
removeExtension
in class JDObject
idx
- Index of the extension.public java.lang.String getExtendedParamDesc(java.lang.String extName)
JDObject
getExtendedParamDesc
in class JDObject
extName
- Extension namepublic void setBackground(java.awt.Color b)
JDObject
setBackground
in class JDObject
b
- Background colorpublic void setForeground(java.awt.Color b)
JDObject
setForeground
in class JDObject
b
- Foreground colorpublic void setVisible(boolean v)
JDObject
setVisible
in class JDObject
v
- True to show, false otherwise.public void setFillStyle(int style)
JDObject
setFillStyle
in class JDObject
style
- 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_GRADIENT
public void setFont(java.awt.Font f)
f
- Fontpublic 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_BORDER
public int getBorder()
setBorder(int)
public java.awt.Font getFont()
setFont(Font)
,
setFont(Font,boolean)
public boolean hasShadow()
JDObject
public java.lang.String getClassName()
public javax.swing.JComponent getComponent()