本文整理匯總了Java中org.eclipse.swt.widgets.Layout類的典型用法代碼示例。如果您正苦於以下問題:Java Layout類的具體用法?Java Layout怎麽用?Java Layout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Layout類屬於org.eclipse.swt.widgets包,在下文中一共展示了Layout類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLayoutMargin
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
private Point getLayoutMargin() {
final Layout layout = getLayout();
if (layout == null) {
return new Point(0, 0);
} else if (layout instanceof GridLayout) {
final GridLayout gridLayout = (GridLayout) layout;
return new Point(gridLayout.marginWidth, gridLayout.marginHeight);
} else if (layout instanceof FillLayout) {
final FillLayout fillLayout = (FillLayout) layout;
return new Point(fillLayout.marginWidth, fillLayout.marginHeight);
} else if (layout instanceof FormLayout) {
final FormLayout formLayout = (FormLayout) layout;
return new Point(formLayout.marginWidth, formLayout.marginHeight);
}
return new Point(0, 0);
}
示例2: testCorrectPanelIsShownForFacetedProject
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
@Test
public void testCorrectPanelIsShownForFacetedProject() {
DeployPropertyPage page = new DeployPropertyPage(loginService, googleApiFactory);
Shell parent = shellTestResource.getShell();
page.setElement(getProject());
page.createControl(parent);
page.setVisible(true);
Composite preferencePageComposite = (Composite) parent.getChildren()[0];
for (Control control : preferencePageComposite.getChildren()) {
if (control instanceof Composite) {
Composite maybeDeployPageComposite = (Composite) control;
Layout layout = maybeDeployPageComposite.getLayout();
if (layout instanceof StackLayout) {
StackLayout stackLayout = (StackLayout) layout;
assertThat(stackLayout.topControl, instanceOf(getPanelClass()));
return;
}
}
}
fail("Did not find the deploy preferences panel");
}
示例3: ArtifactEditor
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
/**
* Creates a new {@link ArtifactEditor}.
*
* @param parent parent Container.
* @param style SWT style for the container.
* @param swtTextStyle SWT style for textboxes. Useful to set them
* SWT.READ_ONLY for instance.
*/
public ArtifactEditor(
Composite parent, Integer style, Integer swtTextStyle) {
super(parent, style, swtTextStyle);
// widgets
icon = new Label(this, SWT.NONE);
Label labelName = new Label(this, SWT.NONE);
path = new Text(this, swtTextStyle);
// layout
Layout layout = new GridLayout(3, false);
this.setLayout(layout);
GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
iconGridData.minimumHeight = 16;
iconGridData.minimumWidth = 16;
icon.setLayoutData(iconGridData);
labelName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
path.setLayoutData(
new GridData(SWT.FILL, SWT.FILL, true, false));
// content
icon.setImage(MavenActivator.IMAGE_MAVEN);
labelName.setText("Path");
}
示例4: PropertyEditor
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
/**
* Creates a new {@link PropertyEditor}.
*
* @param parent parent Container.
* @param style SWT style for the container.
* @param swtTextStyle SWT style for textboxes. Useful to set them
* SWT.READ_ONLY for instance.
*/
public PropertyEditor(
Composite parent, Integer style, Integer swtTextStyle) {
super(parent, style, swtTextStyle);
// widgets
icon = new Label(this, SWT.NONE);
Label labelName = new Label(this, SWT.NONE);
path = new Text(this, swtTextStyle);
// layout
Layout layout = new GridLayout(3, false);
this.setLayout(layout);
GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
iconGridData.minimumHeight = 16;
iconGridData.minimumWidth = 16;
icon.setLayoutData(iconGridData);
labelName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
path.setLayoutData(
new GridData(SWT.FILL, SWT.FILL, true, false));
// content
icon.setImage(MavenActivator.IMAGE_MAVEN);
labelName.setText("Path");
}
示例5: DirectoryEditor
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
/**
* Creates a new <code>DirectoryEditor</code>.
*
* @param parent parent Container.
* @param style SWT style for the container.
* @param swtTextStyle SWT style for textboxes. Useful to set them
* SWT.READ_ONLY for instance.
*/
public DirectoryEditor(
Composite parent, Integer style, Integer swtTextStyle) {
super(parent, style, swtTextStyle);
// widgets
icon = new Label(this, SWT.NONE);
Label labelName = new Label(this, SWT.NONE);
path = new Text(this, swtTextStyle);
// layout
Layout layout = new GridLayout(3, false);
this.setLayout(layout);
GridData iconGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
iconGridData.minimumHeight = 16;
iconGridData.minimumWidth = 16;
icon.setLayoutData(iconGridData);
labelName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
path.setLayoutData(
new GridData(SWT.FILL, SWT.FILL, true, false));
// content
icon.setImage(FileSystemActivator.IMAGE_DIRECTORY);
labelName.setText("Path");
}
示例6: makeLayoutTight
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
/**
* Alter a grid layout so that it has no spacing between controls, and no
* margins.
* @param layout The layout to alter.
* @return The layout passed in.
*/
public static Layout makeLayoutTight( Layout layout )
{
if( layout instanceof GridLayout ) {
GridLayout gridLayout = (GridLayout) layout;
gridLayout.marginBottom = 0;
gridLayout.marginHeight = 0;
gridLayout.marginLeft = 0;
gridLayout.marginRight = 0;
gridLayout.marginTop = 0;
gridLayout.marginWidth = 0;
gridLayout.horizontalSpacing = 0;
gridLayout.verticalSpacing = 0;
}
return layout;
}
示例7: PatchedCompositeReflectionAccessor
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
PatchedCompositeReflectionAccessor() throws NoSuchMethodException, NoSuchFieldException {
this.runSkinMethod = Display.class.getDeclaredMethod("runSkin");
runSkinMethod.setAccessible(true);
this.computeSizeMethod = Layout.class.getDeclaredMethod(
"computeSize",
Composite.class,
int.class,
int.class,
boolean.class);
computeSizeMethod.setAccessible(true);
this.minimumSizeMethod = Composite.class.getDeclaredMethod("minimumSize", int.class, int.class, boolean.class);
minimumSizeMethod.setAccessible(true);
this.stateField = Widget.class.getDeclaredField("state");
stateField.setAccessible(true);
}
示例8: LayoutWrapper
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
public LayoutWrapper(final Layout layout) {
super();
Assert.paramNotNull(layout, "layout");
this.layout = new FormLayout();
this.layoutListeners = new HashSet<ILayoutListener>();
try {
this.computeSizeMethod = layout.getClass().getDeclaredMethod(
"computeSize",
Composite.class,
int.class,
int.class,
boolean.class);
this.computeSizeMethod.setAccessible(true);
this.layoutMethod = layout.getClass().getDeclaredMethod("layout", Composite.class, boolean.class);
this.layoutMethod.setAccessible(true);
}
catch (final Exception e) {
throw new RuntimeException(e);
}
}
示例9: InstallProgressMonitorPart
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
/**
* Constructor
*
* @param parent Parent
* @param layout Layout
*/
public InstallProgressMonitorPart(Composite parent, Layout layout) {
super(parent, layout, false);
// Replace the cancel handler with one that can
// prompt for confirmation.
fCancelListener = new Listener() {
public void handleEvent(Event e) {
if (canCancel()) {
setCanceled(true);
if (fCancelComponent != null) {
fCancelComponent.setEnabled(false);
}
}
}
};
}
示例10: createPropertiesComposite
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
private void createPropertiesComposite( Composite content )
{
GridData gridData;
porpertyGroupComposite = new Composite( content, SWT.NONE );
gridData = new GridData( GridData.FILL_HORIZONTAL
| GridData.GRAB_HORIZONTAL );
gridData.horizontalSpan = 4;
gridData.horizontalAlignment = SWT.FILL;
gridData.exclude = true;
porpertyGroupComposite.setLayoutData( gridData );
GridLayout layout = new GridLayout( );
// layout.horizontalSpacing = layout.verticalSpacing = 0;
layout.marginWidth = layout.marginHeight = 0;
layout.numColumns = 5;
Layout parentLayout = porpertyGroupComposite.getParent( ).getLayout( );
if ( parentLayout instanceof GridLayout )
layout.horizontalSpacing = ( (GridLayout) parentLayout ).horizontalSpacing;
porpertyGroupComposite.setLayout( layout );
}
示例11: updateCompositeLayout
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
private void updateCompositeLayout(Composite composite) {
Layout l = composite.getLayout();
if (l instanceof GridLayout) {
GridLayout layout = (GridLayout) l;
layout.marginHeight = convertVerticalDLUsToPixels(getDefaultMargins());
layout.marginWidth = convertHorizontalDLUsToPixels(getDefaultMargins());
layout.verticalSpacing = convertVerticalDLUsToPixels(getDefaultSpacing());
layout.horizontalSpacing = convertHorizontalDLUsToPixels(getDefaultSpacing());
composite.setLayout(layout);
}
for (Control t : composite.getChildren()) {
if (t instanceof Composite) {
updateCompositeLayout((Composite) t);
}
}
}
示例12: createLayout
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
@Override
protected Layout createLayout() {
//Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=438641
return new RulerLayout(GAP_SIZE_1) {
@Override
protected void layout(Composite composite, boolean flushCache) {
StyledText textWidget = getTextWidget();
if (textWidget == null) {
Log.log("Error: textWidget is already null. SourceViewer: " + BaseSourceViewer.this + " control: "
+ BaseSourceViewer.this.getControl());
return;
}
super.layout(composite, flushCache);
}
};
}
示例13: createShell
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
/**
* Support for creating the view's window.
* <p>
* This is called by createShell(Rectangle) in most of our subclasses,
* but needs to be a static method in each of them, hence we can't use
* overriding, and instead have this as a helper to be called explicitly.
*
* @param bounds if null, use a default position, and otherwise use this as
* position and size of the window
* @param width if bounds is null, use this as the default width; otherwise
* the value of <code>width</code> is ignored
* @param height if bounds is null, use this as the default height; otherwise
* the value of <code>height</code> is ignored
* @param layout the Layout used by the window
* @return the new window
*/
protected static Shell createShell(Rectangle bounds,
int width,
int height,
Layout layout)
{
return WindowUtil.createNormalWindow(WindowUtil.GLOBAL_DISPLAY,
"",
((bounds != null)
? bounds
: new Rectangle(0,
0,
width,
height)),
(bounds != null),
layout);
}
示例14: createPropertiesComposite
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
private void createPropertiesComposite(Composite content)
{
GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
gridData.horizontalSpan = 4;
gridData.horizontalAlignment = SWT.FILL;
gridData.exclude = true;
GridLayout layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 0;
layout.numColumns = 5;
Layout parentLayout = content.getLayout();
if (parentLayout instanceof GridLayout)
{
layout.horizontalSpacing = ( (GridLayout) parentLayout ).horizontalSpacing;
}
porpertyGroupComposite = new Composite(content, SWT.NONE);
porpertyGroupComposite.setLayoutData(gridData);
porpertyGroupComposite.setLayout(layout);
}
示例15: createClientLayout
import org.eclipse.swt.widgets.Layout; //導入依賴的package包/類
protected Layout createClientLayout() {
FormLayout clientLayout = new FormLayout();
clientLayout.marginWidth = 8;
clientLayout.marginHeight = 8;
clientLayout.spacing = 8;
return clientLayout;
}