org.eclipse.swt.widgets.Shell.setSize()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.eclipse.swt.widgets.Shell.setSize()方法的一些代码示例,展示了Shell.setSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.setSize()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:setSize

Shell.setSize介绍

暂无

代码示例

代码示例来源: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: pentaho/pentaho-kettle

DeviceData data = new DeviceData();
 data.tracking = true;
 display = new Display( data );
 Sleak sleak = new Sleak();
 Shell sleakShell = new Shell( display );
 sleakShell.setText( "S-Leak" );
 org.eclipse.swt.graphics.Point size = sleakShell.getSize();
 sleakShell.setSize( size.x / 2, size.y / 2 );
 sleak.create( sleakShell );
 sleakShell.open();
} else {
 display = new Display();

代码示例来源:origin: pentaho/pentaho-kettle

public void createDialog( String title, String url, int options, Image logo ) {
 Shell parent = getParent();
 display = parent.getDisplay();
 dialog = new Shell( parent, options );
 dialog.setText( title );
 dialog.setImage( logo );
 dialog.setSize( width, height );
 dialog.setLayout( new FillLayout() );
 try {
  browser = new Browser( dialog, SWT.NONE );
  browser.setUrl( url );
  browser.addCloseWindowListener( new CloseWindowListener() {
   @Override
   public void close( WindowEvent event ) {
    Browser browser = (Browser) event.widget;
    Shell shell = browser.getShell();
    shell.close();
   }
  } );
 } catch ( Exception e ) {
  MessageBox messageBox = new MessageBox( dialog, SWT.ICON_ERROR | SWT.OK );
  messageBox.setMessage( "Browser cannot be initialized." );
  messageBox.setText( "Exit" );
  messageBox.open();
 }
 setPosition();
 dialog.open();
}

代码示例来源:origin: stackoverflow.com

Shell shell = new Shell(display);
try {
  shell.setSize(200, 100);
  shell.setLayout(new FillLayout());
  createComponents(shell);
  shell.open();
  while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) {
      display.sleep();
  if (!shell.isDisposed()) {
    shell.dispose();

代码示例来源:origin: stackoverflow.com

Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
shell.setSize(1000,400);
shell.open();
while (!shell.isDisposed()) {
  if (!display.readAndDispatch())
    display.sleep();

代码示例来源:origin: pentaho/pentaho-kettle

formLayout.marginWidth = 5;
formLayout.marginHeight = 5;
subShell.setLayout( formLayout );
subShell.setSize( 200, 150 );
subShell.setText( BaseMessages.getString( PKG, "MultiMergeJoinMeta.JoinKeys" ) );
subShell.setImage( GUIResource.getInstance().getImageTransGraph() );
subShell.open();

代码示例来源:origin: stackoverflow.com

Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("StackOverflow");
shell.setLayout(new FillLayout());
shell.setSize(100, shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
shell.open();
while (!shell.isDisposed())

代码示例来源:origin: pentaho/pentaho-kettle

private void open( final Display display ) {
 shell.pack();
 final int height = shell.computeSize( SHELL_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( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height );
 shell.setSize( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height );
 getData( meta );
 meta.setChanged( changed );
 shell.open();
 while ( !shell.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: stackoverflow.com

public static void main( String[] args ) {
  Display display = new Display();
  Shell shell = new Shell( display );
  shell.setLayout( new FillLayout() );
  final Table table = new Table( shell, SWT.VIRTUAL );
  table.setItemCount( 10000 );
  table.addListener( SWT.SetData, new Listener() {
    public void handleEvent( Event event ) {
      TableItem item = (TableItem)event.item;
      item.setText( "Item " + table.indexOf( item ) );
    }
  } );
  shell.setSize( 300, 500 );
  shell.open();
  while( !shell.isDisposed() ) {
    if( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
  display.dispose();
}

代码示例来源:origin: pentaho/pentaho-kettle

PropsUI props = PropsUI.getInstance();
props.setLook( dialog );
dialog.setSize( width, height );
formLayout.marginHeight = Const.FORM_MARGIN;
dialog.setLayout( formLayout );
dialog.open();

代码示例来源:origin: pentaho/pentaho-kettle

public static void main( String[] args ) {
 DeviceData data = new DeviceData();
 data.tracking = true;
 Display display = new Display( data );
 Sleak sleak = new Sleak();
 Shell shell = new Shell( display );
 shell.setText( "S-Leak" );
 Point size = shell.getSize();
 shell.setSize( size.x / 2, size.y / 2 );
 sleak.create( shell );
 shell.open();
 // Launch your application here
 // e.g.
 // Shell shell = new Shell(display);
 // Button button1 = new Button(shell, SWT.PUSH);
 // button1.setBounds(10, 10, 100, 50);
 // button1.setText("Hello World");
 // Image image = new Image(display, 20, 20);
 // Button button2 = new Button(shell, SWT.PUSH);
 // button2.setBounds(10, 70, 100, 50);
 // button2.setImage(image);
 // shell.open();
 while ( !shell.isDisposed() ) {
  if ( !display.readAndDispatch() ) {
   display.sleep();
  }
 }
 display.dispose();
}

代码示例来源:origin: pentaho/pentaho-kettle

shell.setSize( bounds.width > 300 ? bounds.width : 300, 200 );
shell.setLocation( location.x, location.y + bounds.height );
shell.setLayout( new FillLayout() );
final List list = new List( shell, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL );
props.setLook( list );
shell.open();

代码示例来源:origin: stackoverflow.com

Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
shell.setText("Hide Label");
shell.setSize(200, 200);
shell.open();
while (!shell.isDisposed()) {
  if (!display.readAndDispatch())
    display.sleep();

代码示例来源:origin: stackoverflow.com

public void sampleApp(Shell shell) { 
  shell.setLayout(new FillLayout());
  shell.setText("Hello");
  JLabel lab=new JLabel("Hello World");
  Label username_checkout=new Label(shell, SWT.BOLD);
  username_checkout.setText("User Name");
  Button button=new Button(shell,SWT.PUSH);
  button.setText("push");
  shell.setSize(270,270);
  shell.open();
}

代码示例来源:origin: stackoverflow.com

Display display = new Display ();
shell.setSize (200, 200);
shell.open ();
while (!shell.isDisposed()) {
  if (!display.readAndDispatch ()) display.sleep ();

代码示例来源: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

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 : 720;
 shell.setSize( width, height );
 shell.open();
 while ( !shell.isDisposed() ) {
  if ( !display.readAndDispatch() ) {
   display.sleep();
  }
 }
 return jobEntry;
}

代码示例来源:origin: pentaho/pentaho-kettle

if ( this.getParent().isDisposed() ) {
 return;
formLayout.marginWidth = margin;
formLayout.marginHeight = margin;
shell.setLayout( formLayout ); // setting layout
shell.setSize( shell.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ) );
Rectangle screenSize = display.getPrimaryMonitor().getBounds();
shell.setLocation( ( screenSize.width - shell.getBounds().width ) / 2, ( screenSize.height - shell.getBounds().height ) / 2 );
closeButton.setFocus();
shell.open();
while ( !shell.isDisposed() ) {
 if ( !display.readAndDispatch() ) {
  display.sleep();

代码示例来源:origin: pentaho/pentaho-kettle

shell.setLayout( new FormLayout() );
shell.setText( title );
props.setLook( shell );
shell.setSize( point );
shell.open();
while ( !shell.isDisposed() ) {
 if ( !display.readAndDispatch() ) {
  display.sleep();

相关文章

微信公众号

最新文章

更多

Shell类方法