Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args){
- final Display d = new Display();
- Shell s = new Shell(d);
- s.setLayout(new GridLayout(2, false));
- s.setSize(500, 500);
- new Label(s, SWT.NONE).setText("C");
- final Button c = new Button(s, SWT.CHECK);
- new Label(s, SWT.NONE).setText("L1");
- final Button b = new Button(s, SWT.PUSH|SWT.FLAT);
- b.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- b.setText("Button 1");
- b.setEnabled(false);
- new Label(s, SWT.NONE).setText("C2");
- final Button c2 = new Button(s, SWT.CHECK);
- new Label(s, SWT.NONE).setText("L2");
- final Button b2 = new Button(s, SWT.PUSH|SWT.FLAT);
- b2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- b2.setImage(null);
- b2.setText("Button 2");
- b2.setEnabled(false);
- new Label(s, SWT.NONE).setText("C3");
- final Button c3 = new Button(s, SWT.CHECK);
- new Label(s, SWT.NONE).setText("L3");
- final Button b3 = new Button(s, SWT.PUSH|SWT.FLAT);
- b3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- b3.setText("Button 3");
- b3.setEnabled(false);
- c.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- if (!b.isEnabled()) {
- b.setImage(d.getSystemImage(SWT.ICON_ERROR));
- b.setEnabled(true);
- } else {
- b.setImage(null);
- b.setEnabled(false);
- }
- }
- });
- c2.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- if (!b2.isEnabled()) {
- b2.setImage(d.getSystemImage(SWT.ICON_ERROR));
- b2.setEnabled(true);
- } else {
- b2.setImage(null);
- b2.setEnabled(false);
- }
- }
- });
- c3.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- if (!b3.isEnabled()) {
- b3.setImage(d.getSystemImage(SWT.ICON_ERROR));
- b3.setEnabled(true);
- } else {
- b3.setImage(null);
- b3.setEnabled(false);
- }
- }
- });
- s.open();
- while (!s.isDisposed())
- {
- if (!d.readAndDispatch())
- d.sleep();
- }
- d.dispose();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement