org.eclipse.swt.widgets.Shell#setBackgroundMode ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Shell#setBackgroundMode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: nebula   文件: Notifier.java
/**
 * Creates a notification window
 *
 * @param image image. If <code>null</code>, a default image is used
 * @param title title, the title of the window
 * @param text text of the window
 * @param colors color set
 * @return the notification window as a shell object
 */
protected static Shell createNotificationWindow(final Image image, final String title, final String text, final NotifierColors colors) {
	final Shell shell = new Shell(Display.getDefault().getActiveShell(), SWT.NO_TRIM | SWT.NO_FOCUS | SWT.ON_TOP);
	shell.setLayout(new GridLayout(2, false));
	shell.setBackgroundMode(SWT.INHERIT_FORCE);

	createTitle(shell, title, colors);
	createImage(shell, image);
	createText(shell, text, colors);
	createBackground(shell, colors);
	createCloseAction(shell);

	shell.addListener(SWT.Dispose, event -> {
		colors.dispose();
	});

	shell.pack();
	shell.setMinimumSize(320, 100);
	return shell;
}
 
源代码2 项目: hop   文件: SimpleMessageDialog.java
/**
 * Overridden to make the shell background white.
 *
 * @param shell
 */
@Override
protected void configureShell( Shell shell ) {
  super.configureShell( shell );
  shell.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
  shell.setBackgroundMode( SWT.INHERIT_FORCE );
}
 
源代码3 项目: scava   文件: LibrarySuggestionView.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setToolTipText("");
	newShell.setImage(ResourceManager.getPluginImage("org.eclipse.scava.plugin",
			"icons/features/crossminer_library_search_16x16.png"));
	newShell.setText("Library search");

	newShell.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	newShell.setBackgroundMode(SWT.INHERIT_FORCE);
}
 
源代码4 项目: scava   文件: SearchView.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setToolTipText("");
	newShell.setImage(ResourceManager.getPluginImage("org.eclipse.scava.plugin",
			"icons/features/crossminer_project_search_16x16.png"));
	newShell.setText("Project search");

	newShell.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	newShell.setBackgroundMode(SWT.INHERIT_FORCE);
}
 
源代码5 项目: scava   文件: InstallView.java
@Override
protected void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setImage(ResourceManager.getPluginImage("org.eclipse.scava.plugin", "icons/features/crossminer_project_search_16x16.png"));
	newShell.setToolTipText("");
	newShell.setText("Project search");

	newShell.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	newShell.setBackgroundMode(SWT.INHERIT_FORCE);
}
 
源代码6 项目: pentaho-kettle   文件: SimpleMessageDialog.java
/**
 * Overridden to make the shell background white.
 *
 * @param shell
 */
@Override
protected void configureShell( Shell shell ) {
  super.configureShell( shell );
  shell.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
  shell.setBackgroundMode( SWT.INHERIT_FORCE );
}
 
源代码7 项目: nebula   文件: PGroupSnippet2.java
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new GridLayout());

    //Set the shell background to something different
    shell.setBackground(display.getSystemColor(SWT.COLOR_RED));
    
    //Tell the shell to give its children the same background color or image
    shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
    
    //Optionally trying creating a patterned image for the shell background
//    final Image backImage = new Image(display,10,10);
//    GC gc = new GC(backImage);
//    gc.drawLine(0,0,9,9);
//    gc.dispose();
//    shell.addDisposeListener(new DisposeListener() {
//		public void widgetDisposed(DisposeEvent e) {
//			backImage.dispose();
//		}	
//	});
//    shell.setBackgroundImage(backImage);
    
    PGroup group = new PGroup(shell, SWT.SMOOTH);
    group.setText("Example");
    group.setLayout(new FillLayout());    
    group.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    Composite groupClient = new Composite(group,SWT.NONE);
    groupClient.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    groupClient.setLayout(new GridLayout());
    
    Label label = new Label(groupClient,SWT.NONE);
    label.setText("Contents");
    Button button = new Button(groupClient,SWT.PUSH);
    button.setText("Contents");
    Scale scale = new Scale(groupClient,SWT.HORIZONTAL);
    
    
    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
源代码8 项目: nebula   文件: Bug385585.java
public static void main(String[] args) {

		// get display.
		Display display = new Display();

		// create a new visible shell.
		final Shell shell = new Shell(display);
		shell.setText("Test");
		shell.setSize(600, 400);
		GridLayoutFactory.swtDefaults().numColumns(2).applyTo(shell);

		Button button = new Button(shell, SWT.PUSH);
		button.setText("Click me");
		GridDataFactory.fillDefaults().grab(false, false).applyTo(button);

		final Label label = new Label(shell, SWT.NONE);
		label.setText("Combo will appear here");
		GridDataFactory.fillDefaults().grab(true, false).applyTo(label);

		// create a new "background" shell
		Shell limbo = new Shell(display, SWT.NONE);
		limbo.setLocation(0, 10000);
		limbo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
		limbo.setBackgroundMode(SWT.INHERIT_FORCE);
		GridLayoutFactory.swtDefaults().numColumns(2).applyTo(limbo);

		final TableComboViewer comboViewer = new TableComboViewer(limbo);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(comboViewer.getControl());
		comboViewer.getTableCombo().defineColumns(1);
		comboViewer.setContentProvider(ArrayContentProvider.getInstance());
		comboViewer.setLabelProvider(new LabelProvider() {
			@Override
			public String getText(Object element) {
				return (String) element;
			}
		});
		comboViewer.setInput(Arrays.asList("One", "Two", "Three"));

		// move combo
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				label.dispose();
				comboViewer.getTableCombo().setParent(shell);
				shell.layout(true);
			}
		});

		// open the shell.
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}

		// dispose display
		display.dispose();
	}
 
源代码9 项目: nebula   文件: SnippetCheckBoxGroup.java
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
	final FillLayout layout1 = new FillLayout(SWT.VERTICAL);
	layout1.marginWidth = layout1.marginHeight = 10;
	shell.setLayout(layout1);

	// Displays the group
	final CheckBoxGroup group = new CheckBoxGroup(shell, SWT.NONE);
	group.setLayout(new GridLayout(4, false));
	group.setText("Use proxy server");

	final Composite content = group.getContent();

	final Label lblServer = new Label(content, SWT.NONE);
	lblServer.setText("Server:");
	lblServer.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtServer = new Text(content, SWT.NONE);
	txtServer.setText("proxy.host.com");
	txtServer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblPort = new Label(content, SWT.NONE);
	lblPort.setText("Port:");
	lblPort.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtPort = new Text(content, SWT.NONE);
	txtPort.setText("1234");
	txtPort.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblUser = new Label(content, SWT.NONE);
	lblUser.setText("User ID:");
	lblUser.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtUser = new Text(content, SWT.NONE);
	txtUser.setText("MyName");
	txtUser.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblPassword = new Label(content, SWT.NONE);
	lblPassword.setText("Password:");
	lblPassword.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtPassword = new Text(content, SWT.PASSWORD);
	txtPassword.setText("password");
	txtPassword.setEnabled(false);
	txtPassword.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	// Open the shell
	shell.setSize(640, 360);
	SWTGraphicUtil.centerShell(shell);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}