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


Java SWT類代碼示例

本文整理匯總了Java中org.eclipse.swt.SWT的典型用法代碼示例。如果您正苦於以下問題:Java SWT類的具體用法?Java SWT怎麽用?Java SWT使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SWT類屬於org.eclipse.swt包,在下文中一共展示了SWT類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: show

import org.eclipse.swt.SWT; //導入依賴的package包/類
@Override
protected void show ()
{
    super.show ();

    final int tabIndex = findIndex ( this.index );

    if ( tabIndex < 0 )
    {
        this.item = new TabItem ( this.folder, SWT.NONE );
        this.item.setData ( "order", this.index );
    }
    else
    {
        this.item = new TabItem ( this.folder, SWT.NONE, tabIndex );
        this.item.setData ( "order", this.index );
    }

    this.item.setControl ( this.container );

    useItem ( this.item );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:NativeTabProvider.java

示例2: createControl

import org.eclipse.swt.SWT; //導入依賴的package包/類
@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new GridLayout(2, true));

    new Label(container, SWT.NONE).setText(Messages.DiffWizard_source + ':');
    new Label(container, SWT.NONE).setText(Messages.DiffWizard_target + ':');
    lblSource = new Label(container, SWT.WRAP);
    lblTarget = new Label(container, SWT.WRAP);

    diffTable = new DiffTableViewer(container, false, null);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd.widthHint = 480;
    gd.heightHint = 360;
    diffTable.setLayoutData(gd);

    setControl(container);
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:19,代碼來源:DiffWizard.java

示例3: handleEvent

import org.eclipse.swt.SWT; //導入依賴的package包/類
@Override
public void handleEvent(Event event){

    if(encryptToggle.getSelection()){
        Messages.setLanguageText(encryptToggle,"SpeedTestWizard.test.panel.encrypted");
        originalColor = encryptToggle.getForeground();
        //Color highlightColor = ColorCache.getColor(display,178,78,127);
        Color highlightColor = Colors.getSystemColor(display, SWT.COLOR_DARK_YELLOW);
        encryptToggle.setBackground(highlightColor);
    }else{
        Messages.setLanguageText(encryptToggle,"SpeedTestWizard.test.panel.standard");
        if(originalColor!=null){
            encryptToggle.setBackground(originalColor);
        }
    }
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:17,代碼來源:SpeedTestPanel.java

示例4: ParameterGridDialog

import org.eclipse.swt.SWT; //導入依賴的package包/類
/**
 * Create the dialog.
 * @param parentShell
 */
public ParameterGridDialog(Shell parentShell) {
	super(parentShell);
	setShellStyle(SWT.CLOSE | SWT.RESIZE | SWT.TITLE | SWT.WRAP | SWT.APPLICATION_MODAL);
	runGraph=false;
	
	
	lastRowLastColumnTraverseListener=new TraverseListener() {
		
		@Override
		public void keyTraversed(TraverseEvent e) {
			if(e.detail == SWT.TRAVERSE_TAB_NEXT)
				addRowToTextGrid();
		}
	};
	
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:21,代碼來源:ParameterGridDialog.java

示例5: createGroupDecoration

import org.eclipse.swt.SWT; //導入依賴的package包/類
/**
 * This method initializes groupDecoration	
 *
 */
private void createGroupDecoration() {
	GridData gridData1 = new org.eclipse.swt.layout.GridData();
	gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData1.horizontalSpan = 2;
	gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	groupDecoration = new Group(this, SWT.NONE);
	groupDecoration.setText("Decoration");
	createCompositeIntense();
	groupDecoration.setLayoutData(gridData1);
	createCompositeReverse();
	createCompositeUnderline();
	createCompositeBlink();
	
	
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:20,代碼來源:JavelinAttributeEditorComposite.java

示例6: createUploadLimitMenu

import org.eclipse.swt.SWT; //導入依賴的package包/類
/**
 * Creates the global upload limit context menu item
 * @param parent The system tray contextual menu
 */
private final void createUploadLimitMenu(final Menu parent) {
	if ( gm == null ){
		return;
	}
	final MenuItem uploadSpeedItem = new MenuItem(parent, SWT.CASCADE);
	uploadSpeedItem.setText(MessageText.getString("GeneralView.label.maxuploadspeed"));

	final Menu uploadSpeedMenu = new Menu(uiFunctions.getMainShell(),
			SWT.DROP_DOWN);

	uploadSpeedMenu.addListener(SWT.Show, new Listener() {
		@Override
		public void handleEvent(Event event) {
			SelectableSpeedMenu.generateMenuItems(uploadSpeedMenu, core, gm, true);
		}
	});

	uploadSpeedItem.setMenu(uploadSpeedMenu);
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:24,代碼來源:SystemTraySWT.java

示例7: createContents

import org.eclipse.swt.SWT; //導入依賴的package包/類
@Override
protected Control createContents(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	composite.setLayout(layout);
	composite.setFont(parent.getFont());

	GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);

	configurationBlockControl = super.createContents(composite);
	configurationBlockControl.setLayoutData(data);

	if (isProjectPreferencePage()) {
		boolean useProjectSpecificSettings = hasProjectSpecificOptions();
		enableProjectSpecificSettings(useProjectSpecificSettings);
	}

	Dialog.applyDialogFont(composite);
	return composite;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:AbstractN4JSPreferencePage.java

示例8: createDialogArea

import org.eclipse.swt.SWT; //導入依賴的package包/類
/**
 * Create contents of the dialog.
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));
	container.getShell().setText(this.windowLabel);
	
	Composite main_composite = new Composite(container, SWT.NONE);
	main_composite.setLayout(new GridLayout(1, false));
	main_composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

	createTopComposite(main_composite);

	createTableComposite(main_composite);

	populateWidget();

	return container;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:ExcelFormattingDialog.java

示例9: configureText

import org.eclipse.swt.SWT; //導入依賴的package包/類
void configureText(final Composite parent) {
	// Don't set caret to 'null' as this causes
	// https://bugs.eclipse.org/293263.
	// text.setCaret(null);
	Color background = JFaceColors.getBannerBackground(parent.getDisplay());
	Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());

	text.setFont(parent.getFont());
	text.setText(item.getText());

	text.setBackground(background);
	text.setForeground(foreground);
	text.setMargins(TEXT_MARGIN, TEXT_MARGIN, TEXT_MARGIN, 0);

	GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
	text.setLayoutData(gd);

	aboutTextManager = new AboutTextManager(text);
	aboutTextManager.setItem(item);

	createTextMenu();

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:CustomAboutDialog.java

示例10: showPreferenceDialogMAC

import org.eclipse.swt.SWT; //導入依賴的package包/類
private SWTBotShell showPreferenceDialogMAC() {
	final IWorkbench workbench = PlatformUI.getWorkbench();
	workbench.getDisplay().asyncExec(new Runnable() {
		public void run() {
			IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
			if (window != null) {
				Menu appMenu = workbench.getDisplay().getSystemMenu();
				for (MenuItem item : appMenu.getItems()) {
					if (item.getText().startsWith("Preferences")) {
						Event event = new Event();
						event.time = (int) System.currentTimeMillis();
						event.widget = item;
						event.display = workbench.getDisplay();
						item.setSelection(true);
						item.notifyListeners(SWT.Selection, event);
						break;
					}
				}
			}
		}
	});
	return  getPreferenceDialog() ;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:24,代碼來源:GW4EPreferencePage.java

示例11: updateSymbol

import org.eclipse.swt.SWT; //導入依賴的package包/類
private void updateSymbol ()
{
    if ( this.symbolArea == null )
    {
        // too early
        return;
    }

    this.loadedUris.clear ();

    if ( this.viewer != null )
    {
        this.viewer.dispose ();
        this.viewer = null;
    }

    final Symbol symbol = getSymbol ();
    if ( symbol != null )
    {
        final Map<String, String> properties = new HashMap<> ();
        final SymbolLoader symbolLoader = new StaticSymbolLoader ( symbol );
        final Map<String, Object> scriptObjects = new HashMap<> ();
        this.viewer = new VisualInterfaceViewer ( this.symbolArea, SWT.NONE, symbolLoader, scriptObjects, properties, this.factoryContext );
    }
    this.symbolArea.layout ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:27,代碼來源:PreviewEditorImpl.java

示例12: isCollapsed

import org.eclipse.swt.SWT; //導入依賴的package包/類
/**
 * When any <code>ProgressReporterPanel</code> in this window is expanded or collapsed
 * re-layout the controls and window appropriately
 */
@Override
public void isCollapsed(boolean value) {
	if (null != shell && !shell.isDisposed()) {
		scrollable.setRedraw(false);
		Rectangle r = scrollable.getClientArea();
		scrollable.setMinSize(scrollChild.computeSize(r.width, SWT.DEFAULT));

		/*
		 * Resizing to fit the panel if there is only one
		 */
		if (pReporters.length == 1) {
			Point p = shell.computeSize(defaultShellWidth, SWT.DEFAULT);
			if (shell.getSize().y != p.y) {
				p.x = shell.getSize().x;
				shell.setSize(p);
			}
		}

		scrollable.layout();
		scrollable.setRedraw(true);
	}
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:27,代碼來源:ProgressReporterWindow.java

示例13: createPartControl

import org.eclipse.swt.SWT; //導入依賴的package包/類
public void createPartControl(Composite parent) {
	try {
		parent.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		GridLayout gridLayout = new GridLayout();
		parent.setLayout(gridLayout);
		gridLayout.horizontalSpacing = 0;
		gridLayout.marginWidth = 0;
		gridLayout.marginHeight = 0;
		gridLayout.verticalSpacing = 0;

		GridData gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;
		gridData.verticalAlignment = GridData.FILL;
		gridData.grabExcessHorizontalSpace = true;
		gridData.grabExcessVerticalSpace = true;
		
		SequenceEditorInput sequenceEditorInput = (SequenceEditorInput) getEditorInput();
		
		sequenceEditorPart = new SequenceEditorPart(this, sequenceEditorInput.sequence, parent, SWT.None);
		sequenceEditorPart.setLayoutData(gridData);
	}
	catch(Throwable e) {
		ConvertigoPlugin.logException(e, "Unable to create editor part");
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:26,代碼來源:SequenceEditor.java

示例14: updateButtonVisibility

import org.eclipse.swt.SWT; //導入依賴的package包/類
private void updateButtonVisibility(final Tag[] tags) {
 	Utils.execSWTThread(new AERunnable() {

		@Override
		public void runSupport() {
			if (btnAnyTags == null || btnAnyTags.isDisposed()) {
				return;
			}
			boolean show = tags != null && tags.length > 1;
			btnAnyTags.setVisible(show);
			FormData fd = Utils.getFilledFormData();
			fd.height = show ? SWT.DEFAULT : 0;
			btnAnyTags.setLayoutData(fd);
			Composite cTop = btnAnyTags.getParent();
			cTop.getParent().layout(true, true);
		}
	});
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:19,代碼來源:MyTorrentsSubView.java

示例15: onClick

import org.eclipse.swt.SWT; //導入依賴的package包/類
protected void onClick(MouseEvent event) {
	// update selection
	final Node mNode = getNodeAt(event.x, event.y);
	final boolean shiftPressed = (event.stateMask & SWT.SHIFT) != 0;
	if (!shiftPressed) {
		if (mNode == null) {
			clearSelection();
		} else {
			setSelectedNodes(mNode);
		}
	} else {
		if (mNode == null) {
			// do nothing
		} else {
			toggleSelection(mNode);
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:19,代碼來源:GraphCanvas.java


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