本文整理汇总了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 );
}
示例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);
}
示例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);
}
}
}
示例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();
}
};
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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() ;
}
示例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 ();
}
示例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);
}
}
示例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");
}
}
示例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);
}
});
}
示例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);
}
}
}