Java Code Examples for org.eclipse.swt.custom.CTabFolder#setSelectionBackground()
The following examples show how to use
org.eclipse.swt.custom.CTabFolder#setSelectionBackground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SWTUtil.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Creates the tab folder for displaying the composite fragments * * @param parent */ public static CTabFolder createTabFolder(Composite parent) { Display display = getStandardDisplay(); Color c1 = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), c2 = display .getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT); CTabFolder tabs = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; tabs.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true); tabs.setSelectionForeground(getStandardDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND)); tabs.setSimple(PlatformUI.getPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); tabs.setLayoutData(gd); tabs.setBorderVisible(true); tabs.setFont(parent.getFont()); return tabs; }
Example 2
Source File: MainPanel.java From Rel with Apache License 2.0 | 5 votes |
/** * Create the composite. * * @param parent * @param style */ public MainPanel(Composite parent, int style) { super(parent, style); setLayout(new FormLayout()); getShell().addListener(SWT.Close, e -> LogWin.remove()); getShell().addListener(SWT.Move, e -> Preferences.setPreference(rectPrefName, getShell().getBounds())); getShell().addListener(SWT.Resize, e -> Preferences.setPreference(rectPrefName, getShell().getBounds())); // Install logging LogWin.install(parent); // Install platform logging and UI error trapping new CrashTrap(getShell(), Version.getVersion()); Rectangle rect = Preferences.getPreferenceRectangle(rectPrefName); if (rect.height > 0 && rect.width > 0) getShell().setBounds(rect); tabFolder = new CTabFolder(this, SWT.None); FormData fd_tabFolder = new FormData(); fd_tabFolder.top = new FormAttachment(0); fd_tabFolder.left = new FormAttachment(0); fd_tabFolder.right = new FormAttachment(100); tabFolder.setLayoutData(fd_tabFolder); tabFolder.setSelectionBackground( Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); tabFolder.addListener(SWT.Selection, e -> setStatus(((DbTab) tabFolder.getSelection()).getStatus())); statusPanel = new StatusPanel(this, SWT.None); FormData fd_statusPanel = new FormData(); fd_statusPanel.left = new FormAttachment(0); fd_statusPanel.right = new FormAttachment(100); fd_statusPanel.bottom = new FormAttachment(100); statusPanel.setLayoutData(fd_statusPanel); fd_tabFolder.bottom = new FormAttachment(statusPanel); layout(); }
Example 3
Source File: PropsUi.java From hop with Apache License 2.0 | 4 votes |
public void setLook( final Control control, int style ) { if ( this.isOSLookShown() && style != WIDGET_STYLE_FIXED ) { return; } final GuiResource gui = GuiResource.getInstance(); Font font = null; Color background = null; switch ( style ) { case WIDGET_STYLE_DEFAULT: background = gui.getColorBackground(); if ( control instanceof Group && OS.indexOf( "mac" ) > -1 ) { control.addPaintListener( paintEvent -> { paintEvent.gc.setBackground( gui.getColorBackground() ); paintEvent.gc.fillRectangle( 2, 0, control.getBounds().width - 8, control.getBounds().height - 20 ); } ); } font = null; // GuiResource.getInstance().getFontDefault(); break; case WIDGET_STYLE_FIXED: if ( !this.isOSLookShown() ) { background = gui.getColorBackground(); } font = gui.getFontFixed(); break; case WIDGET_STYLE_TABLE: background = gui.getColorBackground(); font = null; // gui.getFontGrid(); break; case WIDGET_STYLE_NOTEPAD: background = gui.getColorBackground(); font = gui.getFontNote(); break; case WIDGET_STYLE_GRAPH: background = gui.getColorBackground(); font = gui.getFontGraph(); break; case WIDGET_STYLE_TOOLBAR: background = GuiResource.getInstance().getColorDemoGray(); break; case WIDGET_STYLE_TAB: background = GuiResource.getInstance().getColorWhite(); CTabFolder tabFolder = (CTabFolder) control; tabFolder.setSimple( false ); tabFolder.setBorderVisible( true ); // need to make a copy of the tab selection background color to get around PDI-13940 Color c = GuiResource.getInstance().getColorTab(); Color tabColor = new Color( c.getDevice(), c.getRed(), c.getGreen(), c.getBlue() ); tabFolder.setSelectionBackground( tabColor ); break; default: background = gui.getColorBackground(); font = null; // gui.getFontDefault(); break; } if ( font != null && !font.isDisposed() ) { control.setFont( font ); } if ( background != null && !background.isDisposed() ) { if ( control instanceof Button ) { Button b = (Button) control; if ( ( b.getStyle() & SWT.PUSH ) != 0 ) { return; } } control.setBackground( background ); } }
Example 4
Source File: PropsUI.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void setLook( final Control control, int style ) { if ( this.isOSLookShown() && style != WIDGET_STYLE_FIXED ) { return; } final GUIResource gui = GUIResource.getInstance(); Font font = null; Color background = null; switch ( style ) { case WIDGET_STYLE_DEFAULT: background = gui.getColorBackground(); if ( control instanceof Group && OS.indexOf( "mac" ) > -1 ) { control.addPaintListener( new PaintListener() { @Override public void paintControl( PaintEvent paintEvent ) { paintEvent.gc.setBackground( gui.getColorBackground() ); paintEvent.gc.fillRectangle( 2, 0, control.getBounds().width - 8, control.getBounds().height - 20 ); } } ); } font = null; // GUIResource.getInstance().getFontDefault(); break; case WIDGET_STYLE_FIXED: if ( !this.isOSLookShown() ) { background = gui.getColorBackground(); } font = gui.getFontFixed(); break; case WIDGET_STYLE_TABLE: background = gui.getColorBackground(); font = null; // gui.getFontGrid(); break; case WIDGET_STYLE_NOTEPAD: background = gui.getColorBackground(); font = gui.getFontNote(); break; case WIDGET_STYLE_GRAPH: background = gui.getColorBackground(); font = gui.getFontGraph(); break; case WIDGET_STYLE_TOOLBAR: background = GUIResource.getInstance().getColorDemoGray(); break; case WIDGET_STYLE_TAB: background = GUIResource.getInstance().getColorWhite(); CTabFolder tabFolder = (CTabFolder) control; tabFolder.setSimple( false ); tabFolder.setBorderVisible( true ); // need to make a copy of the tab selection background color to get around PDI-13940 Color c = GUIResource.getInstance().getColorTab(); Color tabColor = new Color( c.getDevice(), c.getRed(), c.getGreen(), c.getBlue() ); tabFolder.setSelectionBackground( tabColor ); break; default: background = gui.getColorBackground(); font = null; // gui.getFontDefault(); break; } if ( font != null && !font.isDisposed() ) { control.setFont( font ); } if ( background != null && !background.isDisposed() ) { if ( control instanceof Button ) { Button b = (Button) control; if ( ( b.getStyle() & SWT.PUSH ) != 0 ) { return; } } control.setBackground( background ); } }