本文整理了Java中org.eclipse.swt.widgets.Shell
类的一些代码示例,展示了Shell
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell
类的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
[英]Instances of this class represent the "windows" which the desktop or "window manager" is managing. Instances that do not have a parent (that is, they are built using the constructor, which takes a Display
as the argument) are described as top level shells. Instances that do have a parent are described as secondary or dialog shells.
Instances are always displayed in one of the maximized, minimized or normal states:
RESIZE
) until it is no longer maximized.The modality of an instance may be specified using style bits. The modality style bits are used to determine whether input is blocked for other shells on the display. The PRIMARY_MODAL
style allows an instance to block input to its parent. The APPLICATION_MODAL
style allows an instance to block input to every other shell in the display. The SYSTEM_MODAL
style allows an instance to block input to all shells, including shells belonging to different applications.
Note: The styles supported by this class are treated as HINTs, since the window manager for the desktop on which the instance is visible has ultimate control over the appearance and behavior of decorations and modality. For example, some window managers only support resizable windows and will always assume the RESIZE style, even if it is not set. In addition, if a modality style is not supported, it is "upgraded" to a more restrictive modality style that is supported. For example, if PRIMARY_MODAL
is not supported, it would be upgraded to APPLICATION_MODAL
. A modality style may also be "downgraded" to a less restrictive style. For example, most operating systems no longer support SYSTEM_MODAL
because it can freeze up the desktop, so this is typically downgraded to APPLICATION_MODAL
. Styles: BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL, SHEET APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL Events: Activate, Close, Deactivate, Deiconify, Iconify Class SWT
provides two "convenience constants" for the most commonly required style combinations: SHELL_TRIM
the result of combining the constants which are required to produce a typical application top level shell: (that is, CLOSE | TITLE | MIN | MAX | RESIZE
) DIALOG_TRIM
the result of combining the constants which are required to produce a typical application dialog shell: (that is, TITLE | CLOSE | BORDER
)
Note: Only one of the styles APPLICATION_MODAL, MODELESS, PRIMARY_MODAL and SYSTEM_MODAL may be specified.
IMPORTANT: This class is not intended to be subclassed.
[中]
代码示例来源:origin: pentaho/pentaho-kettle
protected void mainLayout( Class<?> PKG, String prefix, Image img ) {
display = parent.getDisplay();
shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.APPLICATION_MODAL );
props.setLook( shell );
shell.setImage( img );
shell.setLayout( new FormLayout() );
shell.setText( BaseMessages.getString( PKG, prefix + ".Shell.Title" ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
private void open( final Display display ) {
shell.pack();
if ( width > 0 ) {
final int height = shell.computeSize( width, SWT.DEFAULT ).y;
// for some reason the actual width and minimum width are smaller than what is requested - add the
// SHELL_WIDTH_OFFSET to get the desired size
shell.setMinimumSize( width + SHELL_WIDTH_OFFSET, height );
shell.setSize( width + SHELL_WIDTH_OFFSET, height );
}
shell.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
}
}
}
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void mouseUp(MouseEvent e) {
if(btnDeleteSubcontainerUnder!= null)
result = btnDeleteSubcontainerUnder.getSelection();
else
result = false;
shell.dispose();
}
});
代码示例来源:origin: pentaho/pentaho-kettle
public void hide() {
if ( !splash.isDisposed() ) {
splash.setVisible( false );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public void dispose() {
if ( !splash.isDisposed() ) {
splash.dispose();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public String open() {
Display display = parent.getDisplay();
new Shell( parent, SWT.DIALOG_TRIM
| SWT.RESIZE | SWT.MAX | SWT.MIN | ( modal ? SWT.APPLICATION_MODAL | SWT.SHEET : SWT.NONE ) );
props.setLook( shell );
shell.setImage( GUIResource.getInstance().getImageSpoon() );
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
shell.setText( title );
wDesc = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
} else {
wDesc = new Text( shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
fdDesc.left = new FormAttachment( 0, 0 );
shell.addShellListener( new ShellAdapter() {
public void shellClosed( ShellEvent e ) {
checkCancel( e );
shell.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
代码示例来源:origin: pentaho/pentaho-kettle
public int open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX );
props.setLook( shell );
formLayout.marginHeight = 15;
shell.setLayout( formLayout );
shell.setText( BaseMessages.getString( PKG, "RunConfigurationDeleteDialog.Title" ) );
shell.setImage( getImage() );
Image image = display.getSystemImage( SWT.ICON_WARNING );
wcMessage.setLayout( new GridLayout() );
shell.addShellListener( new ShellAdapter() {
public void shellClosed( ShellEvent e ) {
cancel();
shell.layout();
shell.pack( true );
shell.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
代码示例来源:origin: pentaho/pentaho-kettle
public void open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.RESIZE );
shell.setImage( GUIResource.getInstance().getImageSpoon() );
shell.setLayout( new FormLayout() );
shell.setText( title );
props.setLook( shell );
fdMessage.left = new FormAttachment( wlImage, 15, SWT.RIGHT );
Button spacer = new Button( shell, SWT.NONE );
spacer.setLayoutData( fdSpacer );
spacer.setVisible( false );
props.setLook( spacer );
attachTo = wButton;
Point point = shell.computeSize( 436, SWT.DEFAULT );
shell.setSize( point );
shell.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
代码示例来源:origin: pentaho/pentaho-kettle
public void open() {
shell = new Shell( parentShell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );
props.setLook( shell );
shell.setImage( GUIResource.getInstance().getImageSpoon() );
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout( formLayout );
shell.setText( dialogTitle );
wClose = new Button( shell, SWT.PUSH );
wClose.setText( BaseMessages.getString( PKG, "System.Button.Close" ) );
wClose.addListener( SWT.Selection, new Listener() {
public void handleEvent( Event e ) {
close();
shell.addShellListener( new ShellAdapter() {
public void shellClosed( ShellEvent e ) {
close();
shell.open();
while ( !shell.isDisposed() ) {
if ( !shell.getDisplay().readAndDispatch() ) {
shell.getDisplay().sleep();
代码示例来源:origin: pentaho/pentaho-kettle
public void widgetSelected( SelectionEvent e ) {
final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM );
dialog.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) );
dialog.setImage( GUIResource.getInstance().getImageSpoon() );
dialog.setLayout( new GridLayout( 3, false ) );
final DateTime calendar = new DateTime( dialog, SWT.CALENDAR );
final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME );
new Label( dialog, SWT.NONE );
new Label( dialog, SWT.NONE );
Button ok = new Button( dialog, SWT.PUSH );
ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) );
ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) );
ok.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
Calendar cal = Calendar.getInstance();
cal.set( Calendar.YEAR, calendar.getYear() );
cal.set( Calendar.MONTH, calendar.getMonth() );
cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() );
cal.set( Calendar.HOUR_OF_DAY, time.getHours() );
cal.set( Calendar.MINUTE, time.getMinutes() );
cal.set( Calendar.SECOND, time.getSeconds() );
wReadFrom.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) );
dialog.close();
}
} );
dialog.setDefaultButton( ok );
dialog.pack();
dialog.open();
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
private void fillLocalizationData() {
labelDimension.setText( BaseMessages.getString( PKG, "PaloDimInputDialog.SelectDimension" ) );
labelStepName.setText( BaseMessages.getString( PKG, "PaloDimInputDialog.StepName" ) );
shell.setText( BaseMessages.getString( PKG, "PaloDimInputDialog.PaloDimInput" ) );
buttonGetLevels.setText( BaseMessages.getString( PKG, "PaloDimInputDialog.GetLevels" ) );
buttonClearLevels.setText( BaseMessages.getString( PKG, "PaloDimInputDialog.ClearLevels" ) );
labelBaseElementsOnly.setText( BaseMessages.getString( PKG, "PaloDimInputDialog.BaseElementsOnly" ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
*
* @param shell
* the shell.
*/
public OlapInputAboutDialog( final Shell shell ) {
this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET );
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
this.dialog.setLayout( gridLayout );
this.dialog.setText( BaseMessages.getString( PKG, "OlapInputDialog.About.Shell.Title" ) );
this.dialog.setImage( shell.getImage() );
this.buildIconCell();
this.buildPluginInfoCell();
this.buildOkButton();
this.dialog.pack();
Rectangle shellBounds = shell.getBounds();
Point dialogSize = this.dialog.getSize();
this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
+ ( shellBounds.height - dialogSize.y ) / 2 );
}
代码示例来源:origin: pentaho/pentaho-kettle
public JobEntryInterface open() {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell( parent, props.getJobsDialogStyle() );
props.setLook( shell );
JobDialog.setShellImage( shell, jobEntry );
backupChanged = jobEntry.hasChanged();
createElements();
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener( new ShellAdapter() {
public void shellClosed( ShellEvent e ) {
cancel();
}
} );
getData();
setActive();
BaseStepDialog.setSize( shell );
int width = 750;
int height = Const.isWindows() ? 730 : 718;
shell.setSize( width, height );
shell.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
}
}
return jobEntry;
}
代码示例来源:origin: pentaho/pentaho-kettle
protected void openDialog() {
shell.pack();
// Set the focus on the OK button
wOK.setFocus();
Rectangle shellBounds = getParent().getBounds();
Point dialogSize = shell.getSize();
shell.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
+ ( shellBounds.height - dialogSize.y ) / 2 );
shell.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public String open() {
shell.layout();
shell.open();
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener( new ShellAdapter() {
public void shellClosed( ShellEvent e ) {
cancel();
}
} );
while ( !shell.isDisposed() ) {
if ( !shell.getDisplay().readAndDispatch() ) {
shell.getDisplay().sleep();
}
}
return formula;
}
代码示例来源:origin: stackoverflow.com
Display display = Display.getDefault();
Shell dialogShell = new Shell(display, SWT.APPLICATION_MODAL);
// populate dialogShell
dialogShell.open();
while (!dialogShell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public void open() {
shell = new Shell( display );
shell.setLayout( new FillLayout() );
shell.setText( APP_NAME );
shell.setImage( GUIResource.getInstance().getImageLogoSmall() );
try {
readFiles();
} catch ( Exception e ) {
new ErrorDialog(
shell, "Error reading translations", "There was an unexpected error reading the translations", e );
}
// Put something on the screen
sashform = new SashForm( shell, SWT.HORIZONTAL );
sashform.setLayout( new FormLayout() );
addLists();
addGrid();
addListeners();
sashform.setWeights( new int[] { 40, 60 } );
sashform.setVisible( true );
shell.pack();
refresh();
shell.setSize( 1024, 768 );
shell.open();
}
代码示例来源:origin: pentaho/pentaho-kettle
public static void main( String[] args ) {
Display display = new Display( );
try {
KettleEnvironment.init();
PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON );
KettleLogStore
.init( PropsUI.getInstance().getMaxNrLinesInLog(), PropsUI.getInstance().getMaxLogLineTimeoutMinutes() );
} catch ( KettleException e ) {
e.printStackTrace();
}
KettleClientEnvironment.getInstance().setClient( KettleClientEnvironment.ClientType.SPOON );
Shell shell = new Shell( display, SWT.DIALOG_TRIM );
shell.open();
CapabilityManagerDialog capabilityManagerDialog = new CapabilityManagerDialog( shell );
capabilityManagerDialog.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void modifyText( ModifyEvent arg0 ) {
// Now set the combo's
shell.getDisplay().asyncExec( new Runnable() {
@Override
public void run() {
setComboBoxes();
}
} );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
public KettleFileRepositoryDialog( Shell parent, int style, RepositoryMeta repositoryMeta,
RepositoriesMeta repositoriesMeta ) {
this.display = parent.getDisplay();
this.props = PropsUI.getInstance();
this.input = (KettleFileRepositoryMeta) repositoryMeta;
this.masterRepositoriesMeta = repositoriesMeta.clone();
this.masterRepositoryName = repositoryMeta.getName();
// this.repositories = repositoriesMeta;
shell = new Shell( parent, style | SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );
shell.setText( BaseMessages.getString( PKG, "KettleFileRepositoryDialog.Dialog.Main.Title" ) );
}
内容来源于网络,如有侵权,请联系作者删除!