|
|
||||||||||||||||||||||||
Class UIGrouppublic class UIGroup extends UIPanel { // Constructors public UIGroup(); public UIGroup(String label); public UIGroup(IUIComponent header); // Methods public void adjustLayoutSize(IUIComponent comp, Dimension oldSize, Dimension newSize); public Insets getInsets(); public boolean isWidthRelative(); public void layout(); public void paint(FxGraphics fxg); public void setName(String name); } This class implements a group box control. A group box is a control that consists of a rectangular frame and a label, and is used to organize other controls. The following examples show the different ways to create UIGroup objects. // Use the default constructor to create an empty // group box, and the setName method to set its label. UIGroup uigroup1 = new UIGroup(); uigroup1.setName("Direction"); // You can create the same group box with a different constructor. UIGroup uigroup2 = new UIGroup("Direction"); // You can also use an IUIComponent for the // group box's header. UIText header = new UIText("Direction", UIStatic.LEFT); UIGroup uigroup3 = new UIGroup(header); The UIGroup class uses a default UIVerticalFlowLayout to lay out components in the group box control. If you add certain components to the group box, such as a UIList object, no scroll bars are added to view the list (because the control is not contained in a UIScrollViewer), and the list may not be completely viewable. However, simply adding a UIScrollViewer object does not help, because the layout is still a vertical flow layout. You must set the layout manager of the group box to something other than the default (to UIBorderLayout, for example). The following example shows how to correctly add lists and other vertically scrollable components to a group box. // Create a list object to add to the UIGroup object list = new UIList(); for(int loop = 0;loop < 150;loop++) { list.add("List " + loop); } // Add the list. uigroup4.setLayout(new UIBorderLayout()); uigroup4.add("Center",new UIScrollViewer(list)); UIComponent | +--UIContainer | +--UIStateContainer | +--UIPanel | +--UIGroup ConstructorsUIGrouppublic UIGroup(); UIGrouppublic UIGroup(String label); UIGrouppublic UIGroup(IUIComponent header); MethodsadjustLayoutSizepublic void adjustLayoutSize(IUIComponent comp, Dimension oldSize, Dimension newSize); getInsetspublic Insets getInsets(); isWidthRelativepublic boolean isWidthRelative(); layoutpublic void layout(); paintpublic void paint(FxGraphics fxg); setNamepublic void setName(String name);
|
© 1998 Microsoft Corporation. All rights reserved. Terms of use. |