Class ComponentWidget
java.lang.Object
org.netbeans.api.visual.widget.Widget
org.netbeans.api.visual.widget.ComponentWidget
- All Implemented Interfaces:
Accessible
,org.openide.util.Lookup.Provider
This widget allows to use an AWT/Swing component in the scene. The widget itself just represents and reserve the place
occupied by the component. When a component is resized, then reserved place is recalculated. The component placement
is automatically update based on the placement of the widget.
The widget also paints the component in the satelite views.
When a widget is added into the scene, it has to attach a scene listener for automatic recalculation. The attaching is done automatically for the first time.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Widget
Widget.Dependency
-
Constructor Summary
ConstructorsConstructorDescriptionComponentWidget
(Scene scene, Component component) Creates a component widget. -
Method Summary
Modifier and TypeMethodDescriptionprotected final Rectangle
Calculates a client area from the preferred size of the component.final Component
Returns a AWT/Swing component.final boolean
Returns whether the component should be visible.protected final void
This method is called to notify that the view is shown.protected final void
This method is called to notify that the view is hidden.protected final void
Paints the component widget.final void
setComponentVisible
(boolean componentVisible) Sets whether the component should be visible.Methods inherited from class org.netbeans.api.visual.widget.Widget
addChild, addChild, addChild, addChild, addChildren, addDependency, bringToBack, bringToFront, convertLocalToScene, convertLocalToScene, convertSceneToLocal, convertSceneToLocal, createActions, equals, getAccessibleContext, getActions, getActions, getBackground, getBorder, getBounds, getChildConstraint, getChildren, getClientArea, getCursor, getCursorAt, getDependencies, getFont, getForeground, getGraphics, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getResourceTable, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isRepaintRequiredForRevalidating, isValidated, isVisible, notifyBackgroundChanged, notifyFontChanged, notifyForegroundChanged, notifyStateChanged, paint, paintBackground, paintBorder, paintChildren, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBackgroundFromResource, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setFontFromResource, setForeground, setForegroundFromResource, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setResourceTable, setState, setToolTipText, setVisible, updateResources
-
Constructor Details
-
ComponentWidget
-
-
Method Details
-
getComponent
Returns a AWT/Swing component.- Returns:
- the AWT/Swing component
-
isComponentVisible
public final boolean isComponentVisible()Returns whether the component should be visible.- Returns:
- true if the component is visible
-
setComponentVisible
public final void setComponentVisible(boolean componentVisible) Sets whether the component should be visible.- Parameters:
componentVisible
- if true, then the component is visible
-
notifyAdded
protected final void notifyAdded()Description copied from class:Widget
This method is called to notify that the view is shown. Note: You must not modify a tree of widgets from within this method. It means: do not call addChild, removeChild and similar methods.- Overrides:
notifyAdded
in classWidget
-
notifyRemoved
protected final void notifyRemoved()Description copied from class:Widget
This method is called to notify that the view is hidden. Note: You must not modify a tree of widgets from within this method. It means: do not call addChild, removeChild and similar methods.- Overrides:
notifyRemoved
in classWidget
-
calculateClientArea
Calculates a client area from the preferred size of the component.- Overrides:
calculateClientArea
in classWidget
- Returns:
- the calculated client area
-
paintWidget
protected final void paintWidget()Paints the component widget.- Overrides:
paintWidget
in classWidget
-