当前位置: 首页>>代码示例>>Java>>正文


Java SWT.DEFAULT属性代码示例

本文整理汇总了Java中org.eclipse.swt.SWT.DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.DEFAULT属性的具体用法?Java SWT.DEFAULT怎么用?Java SWT.DEFAULT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.SWT的用法示例。


在下文中一共展示了SWT.DEFAULT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: packTable

protected void packTable(Table table, int[] columnWidths) {
    if (table == null) {
        return;
    }

    table.pack();

    TableColumn[] columns = table.getColumns();

    for (int i = 0; i < columns.length; i++) {

        int columnWidth = columnWidths[i];
        if (columnWidth == SWT.DEFAULT) {
            columns[i].pack();
        }
        else {
            columns[i].setWidth(columnWidth);
        }
    }
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:20,代码来源:DataModelFormPage.java

示例2: packTable

@Override
public void packTable(Table table) {
    table.pack();

    TableColumn[] columns = table.getColumns();
    int[] columnWidths = getColumnWidths();
    for (int i = 0; i < columns.length; i++) {

        int columnWidth = columnWidths[i];
        if (columnWidth == SWT.DEFAULT) {
            columns[i].pack();
        }
        else {
            columns[i].setWidth(columnWidth);
        }
    }
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:17,代码来源:BaseElementType.java

示例3: fixLayout

private void fixLayout() {

        Table table = getTable();

        // HACK to get the removed item to disappear.
        table.pack();
        layout(true);

        int[] columnWidths = TABLE_COLUMN_WIDTHS;
        TableColumn[] columns = table.getColumns();
        for (int i = 0; i < columns.length; i++) {

            if (columnWidths == null) {
                columns[i].pack();
            }
            else {
                int columnWidth = columnWidths[i];
                if (columnWidth == SWT.DEFAULT) {
                    columns[i].pack();
                }
                else {
                    columns[i].setWidth(columnWidth);
                }
            }
        }
    }
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:26,代码来源:ZnodeAclComposite.java

示例4: findFontByInt

public static Font findFontByInt(GC gc, Font font, FontData[] fontData,
		float[] returnSize, int heightInPixels, int style) {
	int size = (int) returnSize[0];
	do {
		if (font != null) {
			size--;
			font.dispose();
		}
		fontData[0].setHeight(size);
		if (style != SWT.DEFAULT) {
			fontData[0].setStyle(style);
		}

		font = new Font(gc.getDevice(), fontData);

		gc.setFont(font);

	} while (font != null
			&& gc.textExtent(Utils.GOOD_STRING).y > heightInPixels && size > 1);

	returnSize[0] = size;
	return font;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:23,代码来源:FontUtils.java

示例5: dispose

public void dispose() {
	if (control == null || control.isDisposed()) {
		return;
	}

	if (!TEST_SWT_PAINTING) {
		control.removeListener(SWT.Resize, this);
		control.removeListener(SWT.Paint, this);
		control.getShell().removeListener(SWT.Show, this);
	}

	control.removeListener(SWT.Dispose, this);
	control.setBackgroundImage(null);
	FormData formData = (FormData) control.getLayoutData();
	formData.width = SWT.DEFAULT;
	formData.height = SWT.DEFAULT;
	control.setData("BGPainter", null);
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:18,代码来源:SWTBGImagePainter.java

示例6: computeSize

@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
	if (hHint == SWT.DEFAULT) {
		return super.computeSize(wHint, preferredHeight, changed);
	}
	return super.computeSize(wHint, hHint, changed);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:7,代码来源:TestProgressBar.java

示例7: initFromModelInternal

protected final void initFromModelInternal() {

        Table table = getTable();

        if (table == null || getModel().isDestroyed()) {
            return;
        }

        table.setRedraw(false);

        try {
            initTableItemsFromZnode();
            setDirtyInternal(false);
        }
        finally {
            table.setRedraw(true);
        }

        table.pack();
        forceLayout();

        TableColumn[] columns = getTable().getColumns();
        int[] columnWidths = getTableColumnWidths();
        for (int i = 0; i < columns.length; i++) {

            if (columnWidths == null) {
                columns[i].pack();
            }
            else {
                int columnWidth = columnWidths[i];
                if (columnWidth == SWT.DEFAULT) {
                    columns[i].pack();
                }
                else {
                    columns[i].setWidth(columnWidth);
                }
            }
        }
    }
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:39,代码来源:BaseZnodeModelTableFormPage.java

示例8: ValueComposite

public ValueComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final String decimal, final boolean isText, final String attribute, final Boolean isDate, final String hdConnectionId, final String hdItemId, final String queryString )
{
    super ( parent, style, format, decimal, isText, attribute );

    this.isDate = isDate;

    final RowLayout layout = new RowLayout ();
    layout.wrap = false;
    layout.center = true;
    layout.spacing = 7;
    layout.pack = true;
    setLayout ( layout );

    this.controlImage = new ControlImage ( this, this.registrationManager );
    Helper.createTrendButton ( this.controlImage, hdConnectionId, hdItemId, queryString );

    this.dataLabel = new Label ( this, SWT.NONE );
    final RowData rowData = new RowData ( 80, SWT.DEFAULT );
    this.dataLabel.setAlignment ( SWT.RIGHT );
    this.dataLabel.setLayoutData ( rowData );
    this.dataLabel.setText ( "" ); //$NON-NLS-1$
    new DescriptorLabel ( this, SWT.NONE, format, descriptor );

    if ( descriptor != null )
    {
        this.controlImage.setDetailItem ( descriptor.asItem () );
        this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:29,代码来源:ValueComposite.java

示例9: computeSize

public Point computeSize(Composite editor, int wHint, int hHint, boolean force) {
    if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
        return new Point(wHint, hHint);
    }
    Point textSize = labelCtrl.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
    Point buttonNullSize = buttonNullCtrl.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
    
    // Just return the button width to ensure the button is not clipped if the text is long.
    // The text will just use whatever extra width there is
    Point result = new Point(buttonNullSize.x, Math.max(textSize.y, buttonNullSize.y));
    return result;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:12,代码来源:ArrayOrNullEditor.java

示例10: createContents

@Override
protected Control createContents(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    panel.setLayout(layout);

    btnForceUnixNewlines = new Button(panel, SWT.CHECK);
    btnForceUnixNewlines.setText(Messages.ProjectProperties_force_unix_newlines);
    btnForceUnixNewlines.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
    btnForceUnixNewlines.setSelection(prefs.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true));

    Label label = new Label(panel, SWT.NONE);
    label.setText(Messages.projectProperties_timezone_for_all_db_connections);

    cmbTimezone = new Combo(panel, SWT.BORDER | SWT.DROP_DOWN);
    cmbTimezone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    cmbTimezone.setItems(UIConsts.TIME_ZONES.toArray(new String[UIConsts.TIME_ZONES.size()]));
    String tz = prefs.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC);
    cmbTimezone.setText(tz);
    cmbTimezone.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            checkSwitchWarnLbl();
        }
    });

    lblWarn = new CLabel(panel, SWT.NONE);
    lblWarn.setImage(Activator.getEclipseImage(ISharedImages.IMG_OBJS_WARN_TSK));
    lblWarn.setText(Messages.ProjectProperties_change_projprefs_warn);
    GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false, 2, 1);
    gd.exclude = true;
    lblWarn.setLayoutData(gd);
    lblWarn.setVisible(false);

    return panel;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:39,代码来源:ProjectProperties.java

示例11: findFontByFloat

public static Font findFontByFloat(GC gc, Font font, FontData[] fontData,
		float[] returnSize, int heightInPixels, int style) {
	float size = returnSize[0];
	float delta = 2.0f;
	boolean fits;
	int numLoops = 0;
	do {
		numLoops++;
		if (font != null) {
			size -= delta;
			font.dispose();
		}
		try {
			mFontData_SetHeight.invoke(fontData[0], size);
		} catch (Throwable e) {
			Debug.out(e);
		}
		if (style != SWT.DEFAULT) {
			fontData[0].setStyle(style);
		}

		font = new Font(gc.getDevice(), fontData);

		gc.setFont(font);

		//System.out.println("yay " + size + " = "
		//		+ gc.textExtent(Utils.GOOD_STRING).y + " (want " + heightInPixels
		//		+ ")");

		fits = gc.textExtent(Utils.GOOD_STRING).y <= heightInPixels;
		if (fits && delta > .1) {
			size += delta;
			delta /= 2;
			fits = false;
		}
	} while (!fits && size > 1);

	returnSize[0] = size;
	return font;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:40,代码来源:FontUtils.java

示例12: swt_printString_NoAdvanced

private boolean swt_printString_NoAdvanced() {
	boolean b = false;
	try {
		boolean wasAdvanced = gc.getAdvanced();
		Rectangle clipping = null;
		// With Advanced on text antialias in SWT.DEFAULT is not the system's
		// default (Try flipping the "Turn on ClearType" checkbox on
		// the ClearType Text Tuner", and you'll see the text redraw correctly
		// when advanced is off, but not when it's on)
		// Other problems with text and GDIP, see http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/362ab21b-1dc4-4140-a39a-a366beea9e40

		// Turn off Advanced while drawing text so it antialiases based on
		// system prefs.
		// NOTE: This messes up any Transforms :(
		if (gc.getAdvanced() && gc.getTextAntialias() == SWT.DEFAULT
				&& gc.getAlpha() == 255) {
			clipping = gc.getClipping();
			gc.setAdvanced(false);
			Utils.setClipping(gc, clipping);
		}
		b = __printString();
		if (wasAdvanced) {
			gc.setAdvanced(true);
			Utils.setClipping(gc, clipping);
		}
	} catch (Throwable t) {
		Debug.out(t);
	}

	if (DEBUG) {
		System.out.println("");
	}

	return b;
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:35,代码来源:GCStringPrinter.java

示例13: computeSize

@Override
public Point computeSize(int wHint, int hHint) {
	if (!inSetSize && wHint > 0 && hHint == SWT.DEFAULT) {
		inSetSize = true;
		return super.computeSize(Utils.adjustPXForDPI(wHint), hHint);
	}
	return super.computeSize(wHint, hHint);
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:8,代码来源:ShellFactory.java

示例14: ProgressComposite

public ProgressComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final String decimal, final String attribute, final double max, final double min, final double factor, final int width, final String hdConnectionId, final String hdItemId, final String queryString )
{
    super ( parent, style, format, decimal, false, attribute );

    if ( max != 0 )
    {
        this.max = max;
    }

    if ( min != 0 )
    {
        this.min = min;
    }

    if ( factor != 0 )
    {
        this.factor = factor;
    }

    if ( width > 0 )
    {
        this.width = width;
    }

    addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            ProgressComposite.this.handleDispose ();
        }
    } );

    final RowLayout layout = new RowLayout ();
    layout.wrap = false;
    layout.center = true;
    layout.spacing = 7;
    layout.pack = true;
    setLayout ( layout );

    this.progressWidth = this.width - this.textWidth - layout.spacing;
    if ( this.progressWidth < 1 )
    {
        this.progressWidth = 1;
    }

    this.controlImage = new ControlImage ( this, this.registrationManager );
    Helper.createTrendButton ( this.controlImage, hdConnectionId, hdItemId, queryString );

    this.progressBar = new ProgressBar ( this, SWT.NONE );
    //        this.progressBar.setSize ( this.progressWidth, this.textHeight );
    final RowData progressData = new RowData ( this.progressWidth, SWT.DEFAULT );
    this.progressBar.setLayoutData ( progressData );
    final int minimum = (int)Math.round ( this.min );
    final int maximum = (int)Math.round ( this.max );
    this.progressBar.setMinimum ( minimum );
    this.progressBar.setMaximum ( maximum );

    this.text = new Text ( this, SWT.MULTI | SWT.WRAP | SWT.RIGHT );
    //        final RowData rowData = new RowData ( 60, SWT.DEFAULT );
    //        this.font = new Font ( getDisplay (), new FontData ( "Arial", 10, 0 ) ); //$NON-NLS-1$
    //        this.text.setFont ( this.font );
    final RowData rowData = new RowData ( this.textWidth, this.textHeight );
    //        this.dataText.setAlignment ( SWT.RIGHT );
    this.text.setLayoutData ( rowData );
    this.text.setEnabled ( true );
    this.text.setEditable ( false );

    this.text.setText ( "" ); //$NON-NLS-1$
    new DescriptorLabel ( this, SWT.NONE, format, descriptor );

    if ( descriptor != null )
    {
        this.controlImage.setDetailItem ( descriptor.asItem () );
        this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:77,代码来源:ProgressComposite.java

示例15: TextComposite

public TextComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final String decimal, final boolean isText, final String attribute, int width, int height, final boolean date, final int textHeight, final String textMap, final String hdConnectionId, final String hdItemId, final String queryString )
{
    super ( parent, style, format, decimal, isText, attribute );

    this.date = date;

    this.map = stringToMap ( textMap );

    if ( width == 0 )
    {
        width = 60;
    }
    if ( height == 0 )
    {
        height = SWT.DEFAULT;
    }

    final GridLayout layout = new GridLayout ( 3, false );

    setLayout ( layout );

    this.controlImage = new ControlImage ( this, this.registrationManager );
    Helper.createTrendButton ( this.controlImage, hdConnectionId, hdItemId, queryString );

    this.blockImage = new BlockControlImage ( this.controlImage, SWT.NONE, this.registrationManager );

    this.dataText = new CLabel ( this, SWT.MULTI | SWT.WRAP | SWT.RIGHT | SWT.SHADOW_IN );
    if ( textHeight != 0 )
    {
        // FIXME: use parent font
        this.font = new Font ( getDisplay (), new FontData ( "Arial", textHeight, 0 ) ); //$NON-NLS-1$
        this.dataText.setFont ( this.font );
    }
    final GridData data = new GridData ( SWT.FILL, SWT.CENTER, false, false );
    data.widthHint = data.minimumWidth = width;
    data.heightHint = data.minimumHeight = height;

    this.dataText.setLayoutData ( data );
    this.dataText.setEnabled ( true );
    this.dataText.setEllipsis ( "…" );
    this.dataText.setEllipsisAlignment ( SWT.END );

    this.dataText.setText ( "" ); //$NON-NLS-1$
    final DescriptorLabel label = new DescriptorLabel ( this, SWT.NONE, format, descriptor );
    final GridData labelData = new GridData ( SWT.FILL, SWT.CENTER, true, false );
    labelData.minimumWidth = 100;
    label.setLayoutData ( labelData );

    if ( descriptor != null )
    {
        this.controlImage.setDetailItem ( descriptor.asItem () );
        this.blockImage.setBlockItem ( descriptor.asItem () );
        this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:55,代码来源:TextComposite.java


注:本文中的org.eclipse.swt.SWT.DEFAULT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。