Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Button


      GUIUpdater.getInstance().addRefreshable(refreshable);
   
    Composite buttons_composite = new Composite(content,SWT.NONE);
    buttons_composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    buttons_composite.setLayout(new GridLayout(1,false));
    Button button_close = new Button(buttons_composite,SWT.NONE);
    GridData grid_data = new GridData();
    grid_data.widthHint = 70;
    grid_data.horizontalAlignment = GridData.END;
    grid_data.grabExcessHorizontalSpace = true;
    button_close.setLayoutData(grid_data);
   
    button_close.setFont(skin.getButtonFont());
    button_close.setText(Localizer._("uploadinfowindow.button.close"));
   
    button_close.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected( SelectionEvent e ) {
        for(Refreshable refreshable : tabs) {
          GUIUpdater.getInstance().removeRefreshable(refreshable);
        }
        shell.close();
View Full Code Here


    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    GridLayout layout = new GridLayout(3,false);
    button_bar.setLayout(layout);
   
    Button button_ok = new Button(button_bar,SWT.NONE);
    button_ok.setFont(skin.getButtonFont());
    button_ok.setText(_._("settingswindow.button.ok"));
    button_ok.setImage(SWTImageRepository.getImage("ok.png"));
    GridData grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
    grid_data.grabExcessHorizontalSpace = true;
    button_ok.setLayoutData(grid_data);
    button_ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        if (apply())
          shell.close();
      }
    });
   
    Button button_cancel = new Button(button_bar,SWT.NONE);
    button_cancel.setFont(skin.getButtonFont());
    button_cancel.setText(_._("settingswindow.button.cancel"));
    button_cancel.setImage(SWTImageRepository.getImage("cancel.png"));
    grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 80;
    button_cancel.setLayoutData(grid_data);
    button_cancel.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        shell.close();
      }
    });
   
    Button button_apply = new Button(button_bar,SWT.NONE);
    button_apply.setFont(skin.getButtonFont());
    button_apply.setText(_._("settingswindow.button.apply"));
    button_apply.setImage(SWTImageRepository.getImage("accept.png"));
    grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 80;
    button_apply.setLayoutData(grid_data);
   
    button_apply.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        apply();
      }
    });
   
View Full Code Here

      nick_name_text.setText(_core.getConfigurationManager().getNickName());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    prompt_on_exit_check = new Button(content,SWT.CHECK);
    prompt_on_exit_check.setText(_._("settingswindow.tab.general.checkbox.prompt_on_exit"));
    prompt_on_exit_check.setSelection(swt_preferences.promptOnExit());
   
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    prompt_on_exit_check.setLayoutData(layout_data);
   
    server_list_update = new Button(content,SWT.CHECK);
    server_list_update.setText(_._("settingswindow.tab.general.checkbox.update_server_list"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    server_list_update.setLayoutData(layout_data);
    boolean update = false;
    try {
      update = config_manager.updateServerListAtConnect();
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    server_list_update.setSelection(update);

    startup_update_check = new Button(content,SWT.CHECK);
    startup_update_check.setText(_._("settingswindow.tab.general.checkbox.startup_update_check"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    startup_update_check.setLayoutData(layout_data);
    startup_update_check.setSelection(swt_preferences.updateCheckAtStartup());
   
    connect_at_startup = new Button(content,SWT.CHECK);
    connect_at_startup.setText(_._("settingswindow.tab.general.checkbox.connect_at_startup"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    connect_at_startup.setLayoutData(layout_data);
    connect_at_startup.setSelection(swt_preferences.isConnectAtStartup());
   
    kad_enabled = new Button(content,SWT.CHECK);
    kad_enabled.setText(_._("settingswindow.tab.general.checkbox.enable_kad"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    kad_enabled.setLayoutData(layout_data);
    try {
      kad_enabled.setSelection(config_manager.isJKadAutoconnectEnabled());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
   
    if (JMConstants.IS_NIGHTLY_BUILD) {
      show_nightly_build_warning = new Button(content,SWT.CHECK);
      show_nightly_build_warning.setText(_._("settingswindow.tab.general.checkbox.show_nightly_build_warning"));
      layout_data = new GridData(GridData.FILL_HORIZONTAL);
      layout_data.horizontalSpan = 2;
      show_nightly_build_warning.setLayoutData(layout_data);
      show_nightly_build_warning.setSelection(swt_preferences.isNightlyBuildWarning());
    }
   
    Group ports = new Group(content,SWT.NONE);
    ports.setText(_._("settingswindow.tab.general.group.ports"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    ports.setLayoutData(layout_data);
   
    ports.setLayout(new GridLayout(2,false));
   
    label = new Label(ports,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.tcp_port") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    tcp_port = new Spinner (ports, SWT.BORDER);
    tcp_port.setMinimum(1);
    tcp_port.setMaximum(65535);
    try {
      tcp_port.setSelection(config_manager.getTCP());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    tcp_port.setIncrement(1);
    tcp_port.setPageIncrement(100);

    label = new Label(ports,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.udp_port") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    Composite container1 = new Composite(ports,SWT.NONE);
    container1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout = new GridLayout(2,false);
    layout.marginWidth=0;
    layout.marginHeight=0;
    container1.setLayout(layout);
   
    udp_port = new Spinner (container1, SWT.BORDER);
    udp_port.setMinimum(1);
    udp_port.setMaximum(65535);
    try {
      udp_port.setSelection(config_manager.getUDP());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    udp_port.setIncrement(1);
    udp_port.setPageIncrement(100);
   
    enable_udp = new Button(container1,SWT.CHECK);
    enable_udp.setText(_._("settingswindow.tab.connection.button.enabled"));
    enable_udp.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        updateUDPControls();
      }
     
    });
    try {
      enable_udp.setSelection(config_manager.isUDPEnabled());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    updateUDPControls();
   
    Group limits = new Group(content,SWT.NONE);
    limits.setText(_._("settingswindow.tab.general.group.limits"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    limits.setLayoutData(layout_data);
    limits.setLayout(new GridLayout(2,false));
   
    label = new Label(limits,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.download_limit") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    Composite container2 = new Composite(limits,SWT.NONE);
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    container2.setLayoutData(layout_data);
    layout = new GridLayout(3,false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container2.setLayout(layout);
   
    download_limit = new Text(container2,SWT.BORDER );
    download_limit.addListener(SWT.Verify, number_filter);
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    download_limit.setLayoutData(layout_data);
    try {
      download_limit.setText((config_manager.getDownloadLimit()/1024)+"");
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    new Label(container2,SWT.NONE).setText(_._("settingswindow.tab.connection.label.kb_s"));
   
    enable_download_limit = new Button(container2,SWT.CHECK);
    enable_download_limit.setText(_._("settingswindow.tab.connection.button.enabled"));
    enable_download_limit.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        updateDownloadLimitControls();
      }
    });
   
    label = new Label(limits,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.upload_limit") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    Composite container3 = new Composite(limits,SWT.NONE);
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    container3.setLayoutData(layout_data);
    layout = new GridLayout(3,false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container3.setLayout(layout);
   
    upload_limit = new Text(container3,SWT.BORDER );
    upload_limit.addListener(SWT.Verify, number_filter);
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    upload_limit.setLayoutData(layout_data);
    try {
      upload_limit.setText((config_manager.getUploadLimit()/1024)+"");
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    new Label(container3,SWT.NONE).setText(_._("settingswindow.tab.connection.label.kb_s"));
   
    enable_upload_limit = new Button(container3,SWT.CHECK);
    enable_upload_limit.setText(_._("settingswindow.tab.connection.button.enabled"));
    enable_upload_limit.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        updateUploadLimitControls();
      }
    });
   
    boolean enable = false;
    try {
      enable = config_manager.getDownloadLimit()==0 ? false : true;
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    enable_download_limit.setSelection(enable);
   
    try {
      enable = config_manager.getUploadLimit() == 0 ? false : true;
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    enable_upload_limit.setSelection(enable);
   
    updateDownloadLimitControls();
    updateUploadLimitControls();
   
    Group capacities = new Group(content,SWT.NONE);
    capacities.setText(_._("settingswindow.tab.general.group.capacities"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    capacities.setLayoutData(layout_data);
    capacities.setLayout(new GridLayout(2,false));
   
    label = new Label(capacities,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.download_capacity") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
   
    download_capacity = new Text(capacities,SWT.BORDER );
    download_capacity.addListener(SWT.Verify, number_filter);
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    download_capacity.setLayoutData(layout_data);
   
    label = new Label(capacities,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.upload_capacity") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    upload_capacity = new Text(capacities,SWT.BORDER );
    upload_capacity.addListener(SWT.Verify, number_filter);
   
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    upload_capacity.setLayoutData(layout_data);
   
    new Label(capacities,SWT.NONE);
   
    container = new Composite(capacities,SWT.NONE);
    layout_data = new GridData();

    container.setLayoutData(layout_data);
    layout = new GridLayout(2,false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
   
    kbit_button = new Button(container,SWT.RADIO);
    kbit_button.setText(_._("settingswindow.tab.connection.button.k_bit"));
   
    kbit_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        if (kbit_button.getSelection()) {
          if (!kbyte_selected) return ;
          kbyte_selected = false;
          long download = Long.parseLong(download_capacity.getText());
          long upload = Long.parseLong(upload_capacity.getText());
          download*=8;
          upload*=8;
         
          download_capacity.setText(download+"");
          upload_capacity.setText(upload+"");
        }
      }
    });
   
    kbyte_button = new Button(container,SWT.RADIO);
    kbyte_button.setText(_._("settingswindow.tab.connection.button.k_byte"));
    kbyte_button.setSelection(true);
   
    kbyte_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
View Full Code Here

    Composite buttons_composite = new Composite(shell,SWT.BORDER);
    buttons_composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout grid_layout = new GridLayout(4,false);
    buttons_composite.setLayout(grid_layout);
   
    Button button_paste_ed2k_link = new Button(buttons_composite,SWT.NONE);
    button_paste_ed2k_link.setFont(skin.getButtonFont());
    button_paste_ed2k_link.setText(_._("newwindow.button.paste_ed2k_link"));
    button_paste_ed2k_link.setImage(SWTImageRepository.getImage("ed2k_link_paste.png"));
    button_paste_ed2k_link.forceFocus();
    button_paste_ed2k_link.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        table.paste();
      }
    });
   
    Button button_clear = new Button(buttons_composite,SWT.NONE);
    button_clear.setFont(skin.getButtonFont());
    button_clear.setText(_._("newwindow.button.clear"));
    button_clear.setImage(SWTImageRepository.getImage("remove_all.png"));
    button_clear.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        table.clear();
      }
    });
   
    grid_data = new GridData();
    grid_data.widthHint = 70;
    grid_data.horizontalAlignment = GridData.END;
    grid_data.grabExcessHorizontalSpace = true;
   
    Button button_ok = new Button(buttons_composite,SWT.NONE);
    button_ok.setText(_._("newwindow.button.ok"));
    button_ok.setFont(skin.getButtonFont());
    button_ok.setImage(skin.getButtonImage(Skin.OK_BUTTON_IMAGE));
    button_ok.setLayoutData(grid_data);
    button_ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        table.save();
        shell.close();
      }
    });
   
    Button button_cancel = new Button(buttons_composite,SWT.NONE);
    button_cancel.setFont(skin.getButtonFont());
    button_cancel.setImage(skin.getButtonImage(Skin.CANCEL_BUTTON_IMAGE));
    button_cancel.setText(_._("newwindow.button.cancel"));
   
    button_cancel.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        shell.close();
      }
    });
   
View Full Code Here

   
    controls_composite.setLayoutData(grid_data);
   
    controls_composite.setLayout(new GridLayout(2,false));
   
    final Button button_check = new Button(controls_composite,SWT.CHECK);
    grid_data = new GridData();
    button_check.setLayoutData(grid_data);
    button_check.setText(_._("nightlybuildwarningwindow.label.show_at_startup"));
    button_check.setSelection(SWTPreferences.getInstance().isNightlyBuildWarning());
   
    Button button = new Button(controls_composite,SWT.PUSH);
    grid_data = new GridData();
 
    grid_data.widthHint = 60;
    grid_data.grabExcessHorizontalSpace = true;
    grid_data.horizontalAlignment = GridData.END;
    button.setLayoutData(grid_data);
    button.forceFocus();
    button.setText(_._("nightlybuildwarningwindow.button.ok"));
    button.setImage(skin.getButtonImage(SWTSkin.OK_BUTTON_IMAGE));
    button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        SWTPreferences.getInstance().setNightlyBuildWarning(button_check.getSelection());
        shell.close();
      }
    });
View Full Code Here

    label.setText(_._("serverlistimportwindow.label.file_path")+" : ");
   
    file_path = new Text(group,SWT.BORDER );
    file_path.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    browse_button = new Button(group,SWT.NONE);
    browse_button.setFont(skin.getButtonFont());
    browse_button.setText(_._("serverlistimportwindow.button.browse"));
   
    browse_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        FileDialog dialog = new FileDialog (shell, SWT.OPEN);
        dialog.setFilterNames (new String [] {"Server.met(*.met)", "All Files (*.*)"});
        dialog.setFilterExtensions (new String [] {"*.met", "*.*"});
        String result = dialog.open();
        if (result != null)
          file_path.setText(result);
    } });
   
   
    Composite button_bar = new Composite(shell,SWT.NONE);
    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    GridLayout layout = new GridLayout(2,false);
    button_bar.setLayout(layout);
   
    ok_button = new Button(button_bar,SWT.NONE);
    ok_button.setFont(skin.getButtonFont());
    ok_button.setText(_._("serverlistimportwindow.button.ok"));
    ok_button.setImage(SWTImageRepository.getImage("accept.png"));
    GridData grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
    grid_data.grabExcessHorizontalSpace = true;
    ok_button.setLayoutData(grid_data);
    ok_button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        importServerList();
    } });
   
   
    cancel_button = new Button(button_bar,SWT.NONE);
    cancel_button.setFont(skin.getButtonFont());
    cancel_button.setText(_._("serverlistimportwindow.button.cancel"));
    cancel_button.setImage(SWTImageRepository.getImage("cancel2.png"));
    grid_data = new GridData();
    grid_data.widthHint = 80;
View Full Code Here

    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    GridLayout layout = new GridLayout(1,false);
    button_bar.setLayout(layout);

    Button button = new Button(button_bar,SWT.NONE);
    button.setFont(skin.getButtonFont());
    button.setText(Localizer._("serverpropertieswindow.close"));
    button.setFocus();
    GridData grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
    grid_data.grabExcessHorizontalSpace = true;
    button.setLayoutData(grid_data);

    label_version.setText(server.getVersion()+"");
    label_soft_limit.setText(server.getSoftLimit()+"");
    label_hard_limit.setText(server.getHardLimit()+"");
    label_ping.setText(server.getPing()+"");
    label_files.setText(server.getNumFiles()+"");
    label_users.setText(server.getNumUsers()+"");
    label_desc.setText(server.getDesc());
    label_name.setText(server.getName());
   
    final Refreshable refreshable = this;
   
    button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        GUIUpdater.getInstance().removeRefreshable(refreshable);
        shell.close();
      }
    });
View Full Code Here

    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    layout = new GridLayout(3,false);
    button_bar.setLayout(layout);
   
    final Button button_startup_check = new Button(button_bar,SWT.CHECK);
    grid_data = new GridData();
    grid_data.horizontalSpan = 2;
    grid_data.horizontalAlignment = GridData.BEGINNING;
    button_startup_check.setLayoutData(grid_data);
    button_startup_check.setText(_._("updaterwindow.check.startup_check"));
    button_startup_check.setSelection(SWTPreferences.getInstance().updateCheckAtStartup());
   
    Button button_ok = new Button(button_bar,SWT.NONE);
    button_ok.setFont(skin.getButtonFont());
    button_ok.setText(_._("updaterwindow.button.ok"));
    button_ok.setImage(SWTImageRepository.getImage("ok.png"));
    grid_data = new GridData();
    grid_data.horizontalAlignment = GridData.END;
    grid_data.widthHint = 60;
    grid_data.grabExcessHorizontalSpace = true;
    button_ok.setLayoutData(grid_data);
    button_ok.forceFocus();
    button_ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        SWTPreferences.getInstance().setUpdateCheckAtStartup(button_startup_check.getSelection());
        shell.close();
      }
    });
View Full Code Here

   rLayout.marginRight = 0;
   rLayout.marginBottom = 0;
   rLayout.spacing = 5;
   cButtonArea.setLayout (rLayout);
   
    Button bOk = new Button(cButtonArea,SWT.PUSH);
    bOk.setFont(skin.getButtonFont());
    bOk.setImage(skin.getButtonImage(SkinConstants.FINISH_BUTTON_IMAGE));
    bOk.setText(Localizer._("mainwindow.button.ok"));
    rd = new RowData();
    rd.width = 70;
    bOk.setLayoutData(rd);
    bOk.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event e) {
        saveAndApply();
        close();
      }
    });
   
    Button bCancel = new Button(cButtonArea,SWT.PUSH);
    bCancel.setFont(skin.getButtonFont());
    bCancel.setImage(skin.getButtonImage(SkinConstants.CANCEL_BUTTON_IMAGE));
    bCancel.setText(Localizer._("mainwindow.button.cancel"));
    rd = new RowData();
    rd.width = 70;
    bCancel.setLayoutData(rd);
    bCancel.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event e) {
        close();
      }
    });
   
    Button bApply = new Button(cButtonArea,SWT.PUSH);
    bApply.setFont(skin.getButtonFont());
    bApply.setImage(skin.getButtonImage(SkinConstants.OK_BUTTON_IMAGE));
    bApply.setText(Localizer._("mainwindo.button.apply"));
    rd = new RowData();
    rd.width = 70;
    bApply.setLayoutData(rd);
    bApply.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event e) {
        saveAndApply();
      }
    });
   
View Full Code Here

    Composite buttons_composite = new Composite(shell,SWT.NONE);
    buttons_composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    buttons_composite.setLayout(new GridLayout(2,false));
   
    Button button_ok = new Button(buttons_composite,SWT.NONE);
    GridData grid_data = new GridData();
    //grid_data.widthHint = 40;
    grid_data.horizontalAlignment = GridData.END;
    grid_data.grabExcessHorizontalSpace = true;
    button_ok.setLayoutData(grid_data);
   
    button_ok.setFont(skin.getButtonFont());
    button_ok.setImage(skin.getButtonImage(SkinConstants.OK_BUTTON_IMAGE));
    button_ok.setText(Localizer._("mainwindow.button.ok"));
    button_ok.addSelectionListener(new SelectionListener() {
    public void widgetDefaultSelected(SelectionEvent arg0) {
      }

      public void widgetSelected(SelectionEvent arg0) {
        String server_ip = text_server_ip.getText();
        if (!AddressUtils.isValidIP(server_ip)) {
          MessageBox dialog = new MessageBox(shell,
                      SWT.OK | SWT.ICON_WARNING);
          dialog.setMessage(Localizer._("serveraddwindow.wrong_server_address"));
          dialog.open();
          return ;
        }
       
        if (!AddressUtils.isValidPort(text_port.getText())) {
          MessageBox dialog = new MessageBox(shell,
          SWT.OK | SWT.ICON_WARNING);
          dialog.setMessage(Localizer._("serveraddwindow.wrong_server_port"));
          dialog.open();
          return ;
        }
        int server_port = Integer.parseInt(text_port.getText());
        try {
          _core.getServerManager().newServer(server_ip, server_port);
        } catch (ServerManagerException e) {
          Utils.showWarningMessage(shell, "", e.getMessage());
        }
       
        shell.close();
    } });
   
    Button button_cancel = new Button(buttons_composite,SWT.NONE);
    button_cancel.setImage(skin.getButtonImage(SkinConstants.CANCEL_BUTTON_IMAGE));
    button_cancel.setText(Localizer._("mainwindow.button.cancel"));
   
    button_cancel.addSelectionListener(new SelectionListener() {

      public void widgetDefaultSelected(SelectionEvent arg0) {
      }

      public void widgetSelected(SelectionEvent arg0) {
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Button

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.