本文整理汇总了Java中org.netbeans.api.visual.widget.Widget.setLayout方法的典型用法代码示例。如果您正苦于以下问题:Java Widget.setLayout方法的具体用法?Java Widget.setLayout怎么用?Java Widget.setLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.visual.widget.Widget
的用法示例。
在下文中一共展示了Widget.setLayout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFlowLayoutInsets
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void testFlowLayoutInsets () {
Scene scene = new Scene ();
Widget parent = new Widget (scene);
parent.setBorder (BorderFactory.createResizeBorder (10));
parent.setLayout (LayoutFactory.createVerticalFlowLayout ());
scene.addChild (parent);
Widget child = new Widget (scene);
child.setBackground (Color.BLUE);
child.setOpaque (true);
child.setPreferredBounds (new Rectangle (-50, -30, 30, 20));
parent.addChild (child);
assertScene (scene, Color.WHITE, new Rectangle (-1, -1, 52, 42));
}
示例2: testFlowLayoutWeightOverflow
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
public void testFlowLayoutWeightOverflow () {
Scene scene = new Scene ();
LayerWidget layer = new LayerWidget (scene);
layer.setMinimumSize (new Dimension (300, 200));
scene.addChild (layer);
Widget vbox = new Widget (scene);
vbox.setBorder (BorderFactory.createLineBorder (1, Color.BLACK));
vbox.setLayout (LayoutFactory.createVerticalFlowLayout (LayoutFactory.SerialAlignment.JUSTIFY, 0));
layer.addChild (vbox);
Widget hbox1 = new Widget (scene);
hbox1.setBorder (BorderFactory.createLineBorder (1, Color.BLUE));
hbox1.setLayout (LayoutFactory.createHorizontalFlowLayout ());
vbox.addChild (hbox1);
Widget item1 = new LabelWidget (scene, "Item1");
item1.setBorder (BorderFactory.createLineBorder (1, Color.GREEN));
hbox1.addChild (item1);
Widget item2 = new LabelWidget (scene, "Item2");
item2.setBorder (BorderFactory.createLineBorder (1, Color.YELLOW));
hbox1.addChild (item2, 1000);
Widget item3 = new LabelWidget (scene, "Item3");
item3.setBorder (BorderFactory.createLineBorder (1, Color.RED));
hbox1.addChild (item3);
Widget hbox2 = new Widget (scene);
hbox2.setBorder (BorderFactory.createLineBorder (1, Color.BLUE));
hbox2.setPreferredSize (new Dimension (200, 20));
vbox.addChild (hbox2);
Color color = (Color) (new DefaultLookFeel()).getBackground();
assertScene (scene, color, new Rectangle (-5, -5, 210, 100));
}
示例3: ShedScene
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
/**
* Create initial visual configuration and set the presenter. This does not
* draw the plan! Making sure that view (the scene) is correctly displaying
* the model is responsibility of presenter.
*
* @param plan initial.
*/
public ShedScene(PoshPlan plan) {
backgroundLayer = createBackground();
addChild(backgroundLayer);
widgetLayer = new LayerWidget(this);
addChild(widgetLayer);
connectionLayer = new LayerWidget(this);
addChild(connectionLayer);
dragAndDropLayer = new LayerWidget(this);
addChild(dragAndDropLayer);
widgetLayer.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, 0));
dcPadding = new Widget(this);
dcPadding.setMinimumSize(new Dimension(ShedWidgetFactory.HORIZONTAL_GAP, 1));
widgetLayer.addChild(dcPadding);
dcAnchor = new FixedWidgetAnchor(dcPadding, new Point(0, 0), Anchor.Direction.BOTTOM);
dcEnvelope = new Widget(this);
dcEnvelope.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, ShedWidgetFactory.VERTICAL_GAP));
widgetLayer.addChild(dcEnvelope);
goalEnvelope = new ShedTriggerEnvelope(this, dcAnchor);
dcEnvelope.addChild(goalEnvelope);
drivesEnvelope = new ShedDrivesEnvelope(this);
dcEnvelope.addChild(drivesEnvelope);
presenter = new ShedPresenter(this, plan);
getActions().addAction(ActionFactory.createWheelPanAction());
getActions().addAction(ActionFactory.createPanAction());
getActions().addAction(ActionFactory.createZoomAction(1.25, false));
}
示例4: initContent
import org.netbeans.api.visual.widget.Widget; //导入方法依赖的package包/类
@Messages("ACT_FixVersionConflict=Fix Version Conflict...")
private void initContent (DependencyGraphScene scene, GraphNodeImplementation impl, Icon icon) {
contentW = new LevelOfDetailsWidget(scene, 0.05, 0.1, Double.MAX_VALUE, Double.MAX_VALUE);
contentW.setBorder(BorderFactory.createLineBorder(10));
contentW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 1));
//Artifact name (with optional project icon on the left)
nodeW = new IconNodeWidget(scene, TextOrientation.RIGHT_CENTER);
nodeW.setLabel(node.getImpl().getQualifiedName() + " ");
if (null != icon) {
nodeW.setImage(ImageUtilities.icon2Image(icon));
}
nodeW.getLabelWidget().setUseGlyphVector(true);
if (node.isRoot()) {
Font defF = scene.getDefaultFont();
nodeW.getLabelWidget().setFont(defF.deriveFont(Font.BOLD, defF.getSize() + 3f));
}
contentW.addChild(nodeW);
if(getDependencyGraphScene().supportsVersions()) {
Widget versionDetW = new LevelOfDetailsWidget(scene, 0.5, 0.7, Double.MAX_VALUE, Double.MAX_VALUE);
versionDetW.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 2));
contentW.addChild(versionDetW);
versionW = new LabelWidget(scene);
versionW.setLabel(scene.getVersion(node.getImpl()));
versionW.setUseGlyphVector(true);
int mngState = node.getManagedState();
if (mngState != GraphNode.UNMANAGED) {
lockW = new ImageWidget(scene,
mngState == GraphNode.MANAGED ? ImageUtilities.loadImage(LOCK_ICON) : ImageUtilities.loadImage(LOCK_BROKEN_ICON));
}
versionDetW.addChild(versionW);
if (lockW != null) {
versionDetW.addChild(lockW);
}
}
// fix hint
if (fixConflictAction != null) {
Widget rootW = new Widget(scene);
rootW.setLayout(LayoutFactory.createOverlayLayout());
fixHintW = new ImageWidget(scene, ImageUtilities.loadImage(BULB_ICON));
fixHintW.setVisible(false);
fixHintW.setToolTipText(ACT_FixVersionConflict());
fixHintW.getActions().addAction(sceneHoverActionAction);
fixHintW.getActions().addAction(fixConflictAction);
Widget panelW = new Widget(scene);
panelW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.LEFT_TOP, 0));
panelW.setBorder(BorderFactory.createEmptyBorder(0, 3));
panelW.addChild(fixHintW);
rootW.addChild(panelW);
rootW.addChild(contentW);
addChild(rootW);
} else {
addChild(contentW);
}
}