當前位置: 首頁>>代碼示例>>Java>>正文


Java Layout類代碼示例

本文整理匯總了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);
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:19,代碼來源:SizeConstrainedComposite.java

示例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");
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:22,代碼來源:DeployPropertyPageTest.java

示例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");
}
 
開發者ID:google,項目名稱:depan,代碼行數:33,代碼來源:ArtifactEditor.java

示例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");
}
 
開發者ID:google,項目名稱:depan,代碼行數:33,代碼來源:PropertyEditor.java

示例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");
}
 
開發者ID:google,項目名稱:depan,代碼行數:33,代碼來源:DirectoryEditor.java

示例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;
}
 
開發者ID:brocade,項目名稱:vTM-eclipse,代碼行數:22,代碼來源:SWTUtil.java

示例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);
}
 
開發者ID:jo-source,項目名稱:jo-widgets,代碼行數:19,代碼來源:PatchedCompositeReflectionAccessor.java

示例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);
    }
}
 
開發者ID:jo-source,項目名稱:jo-widgets,代碼行數:23,代碼來源:LayoutWrapper.java

示例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);
				}
        	}
        }
    };
}
 
開發者ID:MentorEmbedded,項目名稱:p2-installer,代碼行數:23,代碼來源:ProgressPage.java

示例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 );
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:22,代碼來源:JDBCSelectionPageHelper.java

示例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);
        }
    }
}
 
開發者ID:fabioz,項目名稱:Pydev,代碼行數:17,代碼來源:TreeSelectionDialog.java

示例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);
        }
    };
}
 
開發者ID:fabioz,項目名稱:Pydev,代碼行數:17,代碼來源:BaseSourceViewer.java

示例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);
}
 
開發者ID:cogtool,項目名稱:cogtool,代碼行數:33,代碼來源:View.java

示例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);
}
 
開發者ID:terraframe,項目名稱:geoprism,代碼行數:23,代碼來源:GeodashboardSelectionPageHelper.java

示例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;
}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:8,代碼來源:DataModelFormPage.java


注:本文中的org.eclipse.swt.widgets.Layout類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。