Java Code Examples for org.eclipse.swt.widgets.Button#setGrayed()
The following examples show how to use
org.eclipse.swt.widgets.Button#setGrayed() .
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: CMakePropertyTab.java From cmake4eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void handleEvent(Event event) { final Button btn = (Button) event.widget; if (btn != null && Boolean.TRUE.equals(btn.getData())) { // button is in tri-state mode if (btn.getSelection()) { if (!btn.getGrayed()) { btn.setGrayed(true); } } else { if (btn.getGrayed()) { btn.setGrayed(false); btn.setSelection(true); } } } }
Example 2
Source File: FallDetailBlatt2.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
/** * changing state: empty -> checked -> unchecked (cycling through) */ @Override public void widgetSelected(SelectionEvent e){ Button button = ((Button) e.getSource()); boolean selection = !button.getSelection(); boolean grayed = button.getGrayed(); if (selection) { if (grayed) { button.setSelection(true); button.setGrayed(false); } else { button.setSelection(false); button.setGrayed(false); } } else { button.setSelection(true); button.setGrayed(true); } }
Example 3
Source File: TristateCheckbox.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void widgetSelected(SelectionEvent e){ Button button = ((Button) e.getSource()); boolean selection = !button.getSelection(); boolean grayed = button.getGrayed(); if (falseFirst) { if (selection) { if (grayed) { button.setSelection(false); button.setGrayed(false); } else { button.setSelection(true); button.setGrayed(true); } } else { button.setSelection(true); button.setGrayed(false); } } else { if (selection) { if (grayed) { button.setSelection(true); button.setGrayed(false); } else { button.setSelection(false); button.setGrayed(false); } } else { button.setSelection(true); button.setGrayed(true); } } }
Example 4
Source File: RoundedCheckBoxSnippet.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * @param args */ public static void main(final String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(2, false)); // ------------------------- Checkboxes final Label lbl1 = new Label(shell, SWT.NONE); lbl1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl1.setText("Simple Checkbox (2 states)"); final Button button1 = new Button(shell, SWT.CHECK); button1.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); final Label lbl2 = new Label(shell, SWT.NONE); lbl2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl2.setText("Simple Checkbox (Inderminate)"); final Button button2 = new Button(shell, SWT.CHECK); button2.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); button2.setGrayed(true); // ------------------------- Rounded Checkboxes final Label lbl3 = new Label(shell, SWT.NONE); lbl3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl3.setText("Rounded Checkbox (2 states)"); final RoundedCheckbox button3 = new RoundedCheckbox(shell, SWT.NONE); button3.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); final Label lbl4 = new Label(shell, SWT.NONE); lbl4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl4.setText("Rounded Checkbox (2 states, selected)"); final RoundedCheckbox button4 = new RoundedCheckbox(shell, SWT.NONE); button4.setSelection(true); button4.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); final Label lbl5 = new Label(shell, SWT.NONE); lbl5.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl5.setText("Rounded Checkbox (3 states, selected)"); final RoundedCheckbox button5 = new RoundedCheckbox(shell, SWT.NONE); button5.setSelection(true); button5.setGrayed(true); button5.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); // ------------------------- Rounded Checkboxes final Label lbl6 = new Label(shell, SWT.NONE); lbl6.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl6.setText("Rounded Checkbox (Disabled,2 states)"); final RoundedCheckbox button6 = new RoundedCheckbox(shell, SWT.NONE); button6.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); button6.setEnabled(false); final Label lbl7 = new Label(shell, SWT.NONE); lbl7.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl7.setText("Rounded Checkbox (Disabled,2 states, selected)"); final RoundedCheckbox button7 = new RoundedCheckbox(shell, SWT.NONE); button7.setSelection(true); button7.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); button7.setEnabled(false); final Label lbl8 = new Label(shell, SWT.NONE); lbl8.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); lbl8.setText("Rounded Checkbox (Disabled,3 states, selected)"); final RoundedCheckbox button8 = new RoundedCheckbox(shell, SWT.NONE); button8.setSelection(true); button8.setGrayed(true); button8.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); button8.setEnabled(false); shell.setSize(400, 350); shell.open(); SWTGraphicUtil.centerShell(shell); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
Example 5
Source File: CMakePropertyTab.java From cmake4eclipse with Eclipse Public License 2.0 | 2 votes |
/** * Switches the specified button behavior from tri-state mode to toggle mode. * * @param button * the button to modify * @param buttonSelected * the selection of the button */ private static void enterToggleMode(Button button, boolean buttonSelected) { button.setData(null); // mark toggle mode button.setSelection(buttonSelected); button.setGrayed(false); }
Example 6
Source File: CMakePropertyTab.java From cmake4eclipse with Eclipse Public License 2.0 | 2 votes |
/** * Switches the specified button behavior to toggle mode or to tri-state mode. * * @param button * the button to modify */ private static void enterTristateMode(Button button) { button.setData(Boolean.TRUE); // mark in tri-state mode button.setSelection(true); button.setGrayed(true); }