Java Code Examples for org.eclipse.swt.widgets.Button#setForeground()
The following examples show how to use
org.eclipse.swt.widgets.Button#setForeground() .
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: WorkspaceMergeDialog.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * Creates the checkbox buttons. * * @param parent the composite where to create them */ private void createCheckboxButtons(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new RowLayout(SWT.VERTICAL)); GridDataFactory.fillDefaults().span(2, 1).applyTo(composite); final Button buttonShowCommandLineText = new Button(composite, SWT.CHECK); buttonShowCommandLineText.setText("Show Command Line Text"); buttonShowCommandLineText.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { final boolean selection = buttonShowCommandLineText.getSelection(); commandLineText.getParent().setVisible(selection); ((GridData) commandLineText.getParent().getLayoutData()).exclude = !selection; final Point size = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell().setSize(size); getShell().layout(true, true); } }); buttonConfirmCommit = new Button(composite, SWT.CHECK); RowDataFactory.swtDefaults().exclude(true).applyTo(buttonConfirmCommit); buttonConfirmCommit.setText("Confirm 'Commit'. Repository contained changes before merge."); buttonConfirmCommit.setForeground(buttonConfirmCommit.getDisplay().getSystemColor(SWT.COLOR_RED)); buttonConfirmCommit.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { commitButton.setEnabled(buttonConfirmCommit.getSelection()); } }); }
Example 2
Source File: HorizontalSpinner.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Create minus button * * @param buttonStyle button style */ private void createMinusButton(final int buttonStyle) { leftButton = new Button(this, buttonStyle | SWT.LEFT); leftButton.setFont(getFont()); leftButton.setBackground(getBackground()); leftButton.setCursor(getCursor()); leftButton.setEnabled(getEnabled()); leftButton.setFont(getFont()); leftButton.setForeground(getForeground()); leftButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false)); }
Example 3
Source File: HorizontalSpinner.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Create plus button * * @param buttonStyle button style */ private void createPlusButton(final int buttonStyle) { rightButton = new Button(this, buttonStyle | SWT.RIGHT); rightButton.setFont(getFont()); rightButton.setBackground(getBackground()); rightButton.setCursor(getCursor()); rightButton.setEnabled(getEnabled()); rightButton.setFont(getFont()); rightButton.setForeground(getForeground()); rightButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false)); }
Example 4
Source File: ClassFileEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private Button createButton(Composite parent, String text) { Button button = new Button(parent, SWT.FLAT); button.setBackground(fBackgroundColor); button.setForeground(fForegroundColor); if (text != null) button.setText(text); return button; }
Example 5
Source File: MultiChoice.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Create the popup that contains all checkboxes */ private void createPopup() { this.popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); this.popup.setLayout(new FillLayout()); final int[] popupEvents = { SWT.Close, SWT.Deactivate, SWT.Dispose }; for (final int popupEvent : popupEvents) { this.popup.addListener(popupEvent, this.listener); } if (this.elements == null) { return; } this.scrolledComposite = new ScrolledComposite(this.popup, SWT.BORDER | SWT.V_SCROLL); final Composite content = new Composite(this.scrolledComposite, SWT.NONE); content.setLayout(new GridLayout(this.numberOfColumns, true)); this.checkboxes = new ArrayList<>(this.elements.size()); for (final T o : this.elements) { final Button checkBoxButton = new Button(content, SWT.CHECK); if (this.font != null) { checkBoxButton.setFont(this.font); } if (this.foreground != null) { checkBoxButton.setForeground(this.foreground); } if (this.background != null) { checkBoxButton.setBackground(this.background); } checkBoxButton.setEnabled(text.getEditable()); checkBoxButton.setData(o); checkBoxButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); checkBoxButton.setText(this.labelProvider.getText(o)); checkBoxButton.addListener(SWT.Selection, e -> { if (checkBoxButton.getSelection()) { MultiChoice.this.selection.add(o); } else { MultiChoice.this.selection.remove(o); } MultiChoice.this.lastModified = o; setLabel(); }); if (this.selectionListener != null) { checkBoxButton.addSelectionListener(this.selectionListener); } checkBoxButton.setSelection(this.selection.contains(o)); this.checkboxes.add(checkBoxButton); } this.scrolledComposite.setContent(content); this.scrolledComposite.setExpandHorizontal(false); this.scrolledComposite.setExpandVertical(true); content.pack(); this.preferredHeightOfPopup = content.getSize().y; }