站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

ComponentWidget (Visual Library API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.api.visual 2.2

org.netbeans.api.visual.widget
Class ComponentWidget

java.lang.Object
  extended by org.netbeans.api.visual.widget.Widget
      extended by org.netbeans.api.visual.widget.ComponentWidget

public class ComponentWidget
extends Widget

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
ComponentWidget(Scene scene, Component component)
          Creates a component widget.
 
Method Summary
protected  Rectangle calculateClientArea()
          Calculates a client area from the preferred size of the component.
 Component getComponent()
          Returns a AWT/Swing component.
 boolean isComponentVisible()
          Returns whether the component should be visible.
protected  void notifyAdded()
          This method is called to notify that the view is shown.
protected  void notifyRemoved()
          This method is called to notify that the view is hidden.
protected  void paintWidget()
          Paints the component widget.
 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, getFont, getForeground, getGraphics, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isRepaintRequiredForRevalidating, isValidated, isVisible, notifyStateChanged, paint, paintBackground, paintBorder, paintChildren, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setForeground, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setState, setToolTipText, setVisible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentWidget

public ComponentWidget(Scene scene,
                       Component component)
Creates a component widget.

Parameters:
scene - the scene
component - the AWT/Swing component
Method Detail

getComponent

public final Component 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 class Widget

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 class Widget

calculateClientArea

protected final Rectangle calculateClientArea()
Calculates a client area from the preferred size of the component.

Overrides:
calculateClientArea in class Widget
Returns:
the calculated client area

paintWidget

protected final void paintWidget()
Paints the component widget.

Overrides:
paintWidget in class Widget

org.netbeans.api.visual 2.2

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.