本文整理汇总了Java中org.eclipse.swt.widgets.Dialog类的典型用法代码示例。如果您正苦于以下问题:Java Dialog类的具体用法?Java Dialog怎么用?Java Dialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dialog类属于org.eclipse.swt.widgets包,在下文中一共展示了Dialog类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawProcessingAppFinder
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
public void drawProcessingAppFinder(final Composite composite,
final String processingPath, final List<String> selectedLibs ) {
Listener buttonListener = new Listener() {
public void handleEvent(Event event) {
Dialog dialog = OS.helper().getDialog(composite.getShell());
if(dialog instanceof FileDialog)
processing_app_path_text.setText(((FileDialog)dialog).open());
else if(dialog instanceof DirectoryDialog)
processing_app_path_text.setText(((DirectoryDialog)dialog).open());
}
};
ModifyListener textModifyListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
validate_listener.validate();
showDiscoveredLibraries((Text)e.getSource(), baselibs_viewer, true);
setSelectedLibs(baselibs_viewer, selectedLibs);
}
};
processing_app_path_text = drawDirFinder(composite,
PROCESSING_APP_PATH_LABEL, processingPath, buttonListener, textModifyListener);
}
示例2: applyWindowLocation
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
/**
* Shellのウインドウ位置とサイズを読み込み適用します
*
* @param clazz ウインドウクラス
* @param shell Shell
*/
public static void applyWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
WindowLocationBean location;
synchronized (map) {
location = map.get(clazz.getName());
}
if (location != null) {
if ((location.getWidth() > 0) && (location.getHeight() > 0)) {
shell.setLocation(location.getX(), location.getY());
shell.setSize(location.getWidth(), location.getHeight());
}
}
}
示例3: saveWindowLocation
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
/**
* Shellのウインドウ位置とサイズを保存します
*
* @param clazz ウインドウクラス
* @param shell Shell
*/
public static void saveWindowLocation(Class<? extends Dialog> clazz, Shell shell) {
Map<String, WindowLocationBean> map = AppConfig.get().getWindowLocationMap();
Point location = shell.getLocation();
Point size = shell.getSize();
WindowLocationBean wlocation = new WindowLocationBean();
wlocation.setX(location.x);
wlocation.setY(location.y);
wlocation.setWidth(size.x);
wlocation.setHeight(size.y);
synchronized (map) {
map.put(clazz.getName(), wlocation);
}
}
示例4: drawProcessingAppFinder
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
public void drawProcessingAppFinder(final Composite composite) {
Label processingPathLabel = new Label(composite, SWT.NONE);
processingPathLabel.setText(PROCESSING_APP_PATH_LABEL);
GridData gd1 = new GridData();
gd1.widthHint = LABEL_WIDTH_HINT;
gd1.horizontalSpan = 2;
gd1.horizontalAlignment = SWT.BEGINNING;
processingPathLabel.setLayoutData(gd1);
processing_app_path_text = new Text(composite, SWT.NONE | SWT.BORDER );
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = PATH_TEXT_WIDTH_HINT;
processing_app_path_text.setLayoutData(gd);
Button button = new Button(composite, SWT.PUSH);
button.setText(DIR_SEARCH_BUTTON_LABEL);
button.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
Dialog dialog = OS.helper().getDialog(composite.getShell());
if(dialog instanceof FileDialog)
processing_app_path_text.setText(((FileDialog)dialog).open());
else if(dialog instanceof DirectoryDialog)
processing_app_path_text.setText(((DirectoryDialog)dialog).open());
}
});
}
示例5: createContents
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
private void createContents(final Shell shell) {
shell.setLayout(new GridLayout(2, false));
final Label icon = new Label(shell, SWT.NONE);
icon.setImage(Images.getMainIcons()[6]);
GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 3);
icon.setLayoutData(gridData);
final Label info = new Label(shell, SWT.NONE);
info.setText(this.message);
gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
info.setLayoutData(gridData);
final Link linkProject = new Link(shell, SWT.NONE);
linkProject.setText("<a href=\"" + getApplicationUrl() + "\">" + getApplicationUrl() + "</a>");
gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
linkProject.setLayoutData(gridData);
linkProject.addSelectionListener(new LinkSelectionListener());
final Link linkIcon = new Link(shell, SWT.NONE);
String url = getIconUrl().startsWith("http") ? getIconUrl() : "http://" + getIconUrl();
linkIcon.setText(Messages.get("msg.info.icon") + " <a href=\"" + url + "\">" + getIconUrl() + "</a>");
gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
linkIcon.setLayoutData(gridData);
linkIcon.addSelectionListener(new LinkSelectionListener());
final Button okButton = new Button(shell, SWT.PUSH);
okButton.setText(Messages.get("lbl.button.ok"));
final GC gc = new GC(okButton);
gc.setFont(okButton.getFont());
final int buttonWidth = org.eclipse.jface.dialogs.Dialog.convertHorizontalDLUsToPixels(gc.getFontMetrics(), IDialogConstants.BUTTON_WIDTH);
gc.dispose();
GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, false).span(2, 1).minSize(buttonWidth, SWT.DEFAULT).applyTo(okButton);
okButton.setFocus();
okButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.close();
}
});
shell.setDefaultButton(okButton);
}
示例6: createContents
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
private void createContents(final Shell shell) {
shell.setLayout(new GridLayout(2, false));
final Label icon = new Label(shell, SWT.NONE);
icon.setImage(Images.getMainIcons()[5]);
GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 0, 3);
icon.setLayoutData(gridData);
final Label info = new Label(shell, SWT.NONE);
info.setText(this.message);
gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
info.setLayoutData(gridData);
final Link linkProject = new Link(shell, SWT.NONE);
linkProject.setText("<a href=\"" + getApplicationUrl() + "\">" + getApplicationUrl() + "</a>");
gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
linkProject.setLayoutData(gridData);
linkProject.addSelectionListener(new LinkSelectionListener());
final Link linkIcon = new Link(shell, SWT.NONE);
String url = getIconUrl().startsWith("http") ? getIconUrl() : "http://" + getIconUrl();
linkIcon.setText(Messages.get("msg.info.icon") + " <a href=\"" + url + "\">" + getIconUrl() + "</a>");
gridData = new GridData(SWT.LEAD, SWT.CENTER, false, true);
linkIcon.setLayoutData(gridData);
linkIcon.addSelectionListener(new LinkSelectionListener());
final Button okButton = new Button(shell, SWT.PUSH);
okButton.setText(Messages.get("lbl.button.ok"));
final GC gc = new GC(okButton);
gc.setFont(okButton.getFont());
final FontMetrics fontMetrics = gc.getFontMetrics();
final int buttonWidth = org.eclipse.jface.dialogs.Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
gc.dispose();
GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, false).span(2, 1).minSize(buttonWidth, SWT.DEFAULT).applyTo(okButton);
okButton.setFocus();
okButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.close();
}
});
shell.setDefaultButton(okButton);
}
示例7: getBrowseDialog
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
public Dialog getBrowseDialog() {
return browseDialog;
}
示例8: setBrowseDialog
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
public void setBrowseDialog(Dialog browseDialog) {
this.browseDialog = browseDialog;
}
示例9: getDialog
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
public Dialog getDialog(Shell shell) {
System.out.println("OS FILE DIALOG");
// return new FileDialog(shell);
return new DirectoryDialog(shell);
}
示例10: getDialog
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
public Dialog getDialog(Shell shell) {
return new FileDialog(shell);
}
示例11: SaveWindowLocationAdapter
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
/**
* コンストラクター
*
* @param dialogClass ウインドウ
*/
public SaveWindowLocationAdapter(Class<? extends Dialog> dialogClass) {
this.dialogClass = dialogClass;
}
示例12: SaveWindowLocationAdapter
import org.eclipse.swt.widgets.Dialog; //导入依赖的package包/类
/**
* コンストラクター
*
* @param dialog ウインドウ
*/
public SaveWindowLocationAdapter(Class<? extends Dialog> dialogClass) {
this.dialogClass = dialogClass;
}