private void createImpButtons(Composite container) { Composite buttonContainer = SWTFactory.createComposite(container, 1, 1, GridData.FILL_VERTICAL, 0, 0); fAddButton = SWTFactory.createPushButton(buttonContainer, PDEUIMessages.SourceBlock_add, null); fAddButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleAdd(); } }); fRemoveButton = SWTFactory.createPushButton(buttonContainer, PDEUIMessages.SourceBlock_remove, null); fRemoveButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleRemove(); } }); fRemoveAllButton = SWTFactory.createPushButton( buttonContainer, PDEUIMessages.TargetImplicitPluginsTab_removeAll3, null); fRemoveAllButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleRemoveAll(); } }); updateImpButtons(); }
private void InitViews() { edSubject = (TouchEdit) findViewById(R.id.edCourseSubject); btnStartDate = (Button) findViewById(R.id.btnCourseStartDate); btnStartTime = (Button) findViewById(R.id.btnCourseStartTime); btnStartDate.setVisibility(ImageButton.VISIBLE); btnRepeatSelect = (Button) findViewById(R.id.btnRepeatSelect); btnRepeatSelect.setVisibility(ImageButton.INVISIBLE); btnStartDate.setVisibility(ImageButton.GONE); btnSave = (ImageButton) findViewById(R.id.btnCourseSave); btnSave.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { SaveData(); } }); btnDelete = (ImageButton) findViewById(R.id.btnCourseDelete); btnDelete.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { DeleteData(); } }); }
private void createOptionalDependenciesButton(Composite container) { if (isEditable()) { fIncludeOptionalButton = new Button(container, SWT.CHECK); fIncludeOptionalButton.setText(PDEUIMessages.PluginSection_includeOptional); // initialize value IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { fIncludeOptionalButton.setSelection( "true".equals(file.getPersistentProperty(OPTIONAL_PROPERTY))); // $NON-NLS-1$ } catch (CoreException e) { } } // create listener to save value when the checkbox is changed fIncludeOptionalButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { file.setPersistentProperty( OPTIONAL_PROPERTY, fIncludeOptionalButton.getSelection() ? "true" : null); // $NON-NLS-1$ } catch (CoreException e1) { } } } }); } }
/** * Sets up the add button, which is used to add filters to the graph and to the table view. * * @return The fully configured add button. */ private Button setAddButton() { final Button addButton = new ImageButton("add.png"); addButton.setOnAction(actionEvent -> filterEditingMenu.showMenu()); addButton.setScaleX(0.5); addButton.setScaleY(0.5); return addButton; }
/** * Notify any DialogListeners of changes having occurred If a listener returns false, do not call * further listeners and disable the OK button and preview Checkbox (if it exists). For * PlugInFilters, this ensures that the PlugInFilterRunner, which listens as the last one, is not * called if the PlugInFilter has detected invalid parameters. Thus, unnecessary calling the * run(ip) method of the PlugInFilter for preview is avoided in that case. */ private void notifyListeners(AWTEvent e) { if (dialogListeners == null) return; boolean everythingOk = true; for (int i = 0; everythingOk && i < dialogListeners.size(); i++) try { resetCounters(); if (!((DialogListener) dialogListeners.elementAt(i)).dialogItemChanged(this, e)) everythingOk = false; } // disable further listeners if false (invalid parameters) returned catch (Exception err) { // for exceptions, don't cover the input by a window but IJ.beep(); // show them at in the "Log" IJ.log( "ERROR: " + err + "\nin DialogListener of " + dialogListeners.elementAt(i) + "\nat " + (err.getStackTrace()[0]) + "\nfrom " + (err.getStackTrace()[1])); // requires Java 1.4 } boolean workaroundOSXbug = IJ.isMacOSX() && okay != null && !okay.isEnabled() && everythingOk; if (previewCheckbox != null) previewCheckbox.setEnabled(everythingOk); if (okay != null) okay.setEnabled(everythingOk); if (workaroundOSXbug) repaint(); // OSX 10.4 bug delays update of enabled until the next input }
/* (non-Javadoc) * @see org.eclipse.swt.widgets.Control#setEnabled(boolean) */ public void setEnabled(boolean enabled) { fTree.getControl().setEnabled(enabled); if (enabled) { updateButtons(); } else { fSelectButton.setEnabled(false); fSelectAllButton.setEnabled(false); fDeselectButton.setEnabled(false); fDeselectAllButton.setEnabled(false); fSelectRequiredButton.setEnabled(false); fCountLabel.setText(""); // $NON-NLS-1$ } fModeLabel.setEnabled(enabled); fPluginModeButton.setEnabled(enabled); fFeaureModeButton.setEnabled(enabled); fShowLabel.setEnabled(enabled); fShowPluginsButton.setEnabled(enabled); fShowSourceButton.setEnabled(enabled); boolean isPluginMode = !fFeaureModeButton.getSelection(); fGroupLabel.setEnabled(enabled && isPluginMode); if (fGroupCombo != null) { fGroupCombo.setEnabled(enabled && isPluginMode); } else { fGroupComboPart.setEnabled(enabled && isPluginMode); } }
/** * Sets up the remove button, which is used to remove filters from the table view and the graph. * * @param tableView The table view needed to get the currently selected filter. * @return The fully configured remove button. */ private Button setRemoveButton(TableView tableView) { final Button removeButton = new ImageButton("remove.png"); removeButton.setOnAction( actionEvent -> { final FilterInput filterInput = (FilterInput) tableView.getSelectionModel().getSelectedItem(); if (!data.isEmpty() && filterInput != null) { // Update model final IUserCommand updateGraphFilterCommand = interactionMap.get(FilterInteraction.REMOVE); if (updateGraphFilterCommand != null) { filterInput.setDeleted(); updateGraphFilterCommand.setSelection(filterInput); notifyListeners(updateGraphFilterCommand); logger.debug( "Removed FilterInput: " + filterInput.getName() + " from table view and database."); } else { logger.warn("no remove command mapped"); } } }); removeButton.setScaleX(0.5); removeButton.setScaleY(0.5); return removeButton; }
public Irc(Sentence_itf s) { setLayout(new FlowLayout()); text = new TextArea(10, 60); text.setEditable(false); text.setForeground(Color.red); add(text); data = new TextField(60); add(data); Button write_button = new Button("write"); write_button.addActionListener(new writeListener(this)); add(write_button); Button read_button = new Button("read"); read_button.addActionListener(new readListener(this)); add(read_button); setSize(470, 300); text.setBackground(Color.black); show(); sentence = s; }
void login() { try { logoutBtn.setEnabled(true); contactList.setEditable(false); loginBtn.setEnabled(false); loginId.setEnabled(false); password.setEnabled(false); // plugin.login( getMyLoginId(), password.getText(), getContactList(), MessagingNetwork.STATUS_ONLINE); logoutBtn.setEnabled(true); } catch (Throwable tr) { printException(tr); boolean loggedIn = false; try { loggedIn = plugin.getClientStatus(getMyLoginId()) != MessagingNetwork.STATUS_OFFLINE; } catch (Throwable tr2) { printException(tr2); } if (!loggedIn) { enableLoginUI(); } } }
@Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub go.pressed = false; info.pressed = false; back.pressed = false; }
/** Experimental. Switching themes at runtime does not yet work properly. */ protected void createThemeSwitcher(final Composite parent) { final Button button = new Button(parent, SWT.PUSH); button.setText("Theme Switcher"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { Shell shell = new Shell(parent.getShell(), SWT.DIALOG_TRIM); shell.setText("Theme Switcher"); shell.setLayout(new GridLayout()); Button themeButton = new Button(shell, SWT.PUSH); themeButton.setText("Switch Theme"); themeButton.addSelectionListener( new SelectionAdapter() { String[] availableThemeIds = ThemeUtil.getAvailableThemeIds(); public void widgetSelected(final SelectionEvent e) { int index = 0; String currThemeId = ThemeUtil.getCurrentThemeId(); for (int i = 0; i < availableThemeIds.length; i++) { if (currThemeId.equals(availableThemeIds[i])) { index = (i + 1) % availableThemeIds.length; } } String newThemeId = availableThemeIds[index]; ThemeUtil.setCurrentThemeId(newThemeId); } }); shell.pack(); shell.open(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); // // this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main_login); mEtAccount = (EditText) findViewById(R.id.mainLoginEditAccount); mEtPassword = (EditText) findViewById(R.id.mainLoginEditPassword); mBtnLogin = (Button) findViewById(R.id.mainLoginBtn); mBtnRegister = (Button) findViewById(R.id.main_btn_register); /* this is to render the password edittext font to be default */ mEtPassword.setTypeface(Typeface.DEFAULT); mEtPassword.setTransformationMethod(new PasswordTransformationMethod()); mBtnLogin.setOnClickListener( new OnClickListener() { public void onClick(View v) { MainActivity.this.tryLogin(); } }); mBtnRegister.setOnClickListener( new OnClickListener() { public void onClick(View v) { Intent intent0 = new Intent(MainActivity.this, RegisterActivity.class); startActivity(intent0); } }); }
private void UpdateStartDateTimeView() { btnStartDate.setText(AnCalDateUtils.formatMediumDate(this, dateStart)); if (chkAllDay.isChecked()) { btnStartTime.setText(utils.GetResStr(R.string.labNoTime)); } else { btnStartTime.setText(AnCalDateUtils.formatTime(this, dateStart)); } }
private void updateSIFTypeButtonText() { if (selectedTypes.isEmpty()) { sifTypeButton.setText("Select interaction type"); } else { sifTypeButton.setText( selectedTypes.size() + " type" + (selectedTypes.size() > 1 ? "s" : "") + " selected"); } }
public DynamicEvents() { setLayout(new FlowLayout()); b1.addActionListener(new B()); b1.addActionListener(new B1()); b2.addActionListener(new B()); b2.addActionListener(new B2()); add(b1); add(b2); }
@Override public void onClick(View inButton) { boolean isErr = false; if (mTitle.getText().toString().length() == 0) { mTitle.setError("Required"); mTitle.setEms(10); isErr = true; } if (mDesc.getText().toString().length() == 0) { mDesc.setActivated(true); mDesc.setError("Required"); isErr = true; } if (inButton.getId() == openWeb.getId()) web.setVisibility(View.VISIBLE); else if (inButton.getId() == mAvail.getId()) startActivity(new Intent(this, CheckActivity.class)); else if (inButton.getId() == mBack.getId()) finish(); else if (inButton.getId() == mSub.getId()) { AlertDialog.Builder al = new AlertDialog.Builder(this); if (isErr) return; else al.setTitle("Continue?") .setIcon(R.drawable.ornament) .setMessage("Your listing is going to be submitted to your chosen category.") .setPositiveButton( "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int x) { payment = new ArrayList<String>(); if (mCard.isChecked()) payment.add("Card"); if (mCheck.isChecked()) payment.add("Check"); if (mOnline.isChecked()) payment.add("Online"); if (mCash.isChecked()) payment.add("Cash"); // Toast.makeText(getApplicationContext(), payment.toString(), // Toast.LENGTH_LONG).show(); Intent intent = new Intent(getApplicationContext(), StartActivity.class); intent.putExtra("Payment", payment); intent.putExtra("Category", mChosenCategory); intent.putExtra("Title", mTitle.getText().toString()); intent.putExtra("Price", mPrice.getText().toString()); intent.putExtra("Description", mDesc.getText().toString()); intent.putExtra("Location", mLocation.getText().toString()); intent.putExtra("Photo", jpegData); startActivity(intent); } }) .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int x) {} }) .show(); } else startActivityForResult( new Intent(this, com.lightbox.android.camera.activities.Camera.class), REQ); }
private void setButtonEnabled(String configKey, Button b, boolean enabled) { Boolean previousValue = oldBulkAPIDependencies.put(b, b.getSelection()); b.setSelection( enabled ? (previousValue != null ? previousValue : this.controller.getConfig().getBoolean(configKey)) : false); b.setEnabled(enabled); }
/** Method to create cancel button */ protected void createCancelButton(GridData gridData) { cancelButton.setText("Cancel"); cancelButton.setLayoutData(gridData); cancelButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { shell.close(); } }); }
private void setInterfaceDisabled(boolean disabled) { playlistsView.setDisable(disabled); searchButton.setDisable(disabled); searchText.setDisable(disabled); addButton.setDisable(disabled); renameButton.setDisable(disabled); deleteButton.setDisable(disabled); refreshButton.setDisable(disabled); interfaceDisabled = disabled; }
/** * Cr�e une nouvelle instance de CreeTrans * * @param mf fenetre principale de l'application * @param zg Zone graphique * @param auto automate * @param be barre d'�tat */ public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) { super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true); this.setResizable(false); this.gz = g; this.auto = auto; this.bar = be; this.mf = mf; be.displayInfo("Creating interaction"); tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); tfJPanel1.setBackground(Color.lightGray); tfJPanel1.add(new JLabel("Type : ")); groupe = new CheckboxGroup(); plus = new Checkbox("activator", groupe, true); tfJPanel1.add(plus); minus = new Checkbox("inhibitor", groupe, false); tfJPanel1.add(minus); tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); tfJPanel2.setBackground(Color.lightGray); tfJPanel2.add(new JLabel("Threshold = ")); tf = new JTextField(auto.nbrCharTransLabel); tf.setText("1"); tfJPanel2.add(tf); btJPanel = new JPanel(new GridLayout(1, 2, 0, 0)); btJPanel.setBackground(Color.lightGray); ok = new Button("Ok"); ok.setBackground(Color.lightGray); ok.addActionListener(this); cancel = new Button("Cancel"); cancel.setBackground(Color.lightGray); cancel.addActionListener(this); btJPanel.add(ok); btJPanel.add(cancel); content = this.getContentPane(); content.setLayout(new BorderLayout()); content.setBackground(Color.lightGray); content.add(tfJPanel1, BorderLayout.NORTH); content.add(tfJPanel2, BorderLayout.CENTER); content.add(btJPanel, BorderLayout.SOUTH); this.pack(); this.setLocationRelativeTo(this.mf); tf.requestFocusInWindow(); // rendre la fenetre visible setVisible(true); }
/** Method declaration */ private void initGUI() { Panel pQuery = new Panel(); Panel pCommand = new Panel(); pResult = new Panel(); pQuery.setLayout(new BorderLayout()); pCommand.setLayout(new BorderLayout()); pResult.setLayout(new BorderLayout()); Font fFont = new Font("Dialog", Font.PLAIN, 12); txtCommand = new TextArea(5, 40); txtCommand.addKeyListener(this); txtResult = new TextArea(20, 40); txtCommand.setFont(fFont); txtResult.setFont(new Font("Courier", Font.PLAIN, 12)); butExecute = new Button("Execute"); butClear = new Button("Clear"); butExecute.addActionListener(this); butClear.addActionListener(this); pCommand.add("East", butExecute); pCommand.add("West", butClear); pCommand.add("Center", txtCommand); gResult = new Grid(); setLayout(new BorderLayout()); pResult.add("Center", gResult); pQuery.add("North", pCommand); pQuery.add("Center", pResult); fMain.add("Center", pQuery); tTree = new Tree(); // (ulrivo): screen with less than 640 width Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); if (d.width >= 640) { tTree.setMinimumSize(new Dimension(200, 100)); } else { tTree.setMinimumSize(new Dimension(80, 100)); } gResult.setMinimumSize(new Dimension(200, 300)); fMain.add("West", tTree); doLayout(); fMain.pack(); }
void enableLoginUI() { try { logoutBtn.setEnabled(false); contactList.setEditable(true); loginBtn.setEnabled(true); loginId.setEnabled(true); password.setEnabled(true); } catch (Throwable tr) { CAT.error("exception", tr); } }
private void updateCreateButton(DBPDriver driver) { if (driver == null) { createButton.setEnabled(false); return; } // Enable ""Create" button String paramCreate = CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_CREATE_URL_PARAM)); createButton.setEnabled( !CommonUtils.isEmpty(paramCreate) && !CommonUtils.isEmpty(pathText.getText())); }
protected void createLimitTypesGroup() { GridData gridData; // Group for lengthLimitButton and shortestPlusKButton Group limitTypeGroup = new Group(shell, SWT.NONE); limitTypeGroup.setText("Stop distance"); gridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false); gridData.horizontalSpan = 2; gridData.verticalSpan = 2; limitTypeGroup.setLayoutData(gridData); limitTypeGroup.setLayout(new GridLayout(2, true)); // Length limit radio button lengthLimitLabel = new Label(limitTypeGroup, SWT.NONE); lengthLimitLabel.setText("Length limit"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); lengthLimitLabel.setLayoutData(gridData); // Length limit text lengthLimit = new Text(limitTypeGroup, SWT.BORDER); lengthLimit.addKeyListener(keyAdapter); gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); lengthLimit.setLayoutData(gridData); // Shortest+k radio button shortestPlusKButton = new Button(limitTypeGroup, SWT.CHECK); shortestPlusKButton.setText("Shortest+k"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); shortestPlusKButton.setLayoutData(gridData); shortestPlusKButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { shortestPlusK.setEnabled(shortestPlusKButton.getSelection()); } }); // Shortest+k text shortestPlusK = new Text(limitTypeGroup, SWT.BORDER); shortestPlusK.addKeyListener(keyAdapter); gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); shortestPlusK.setLayoutData(gridData); // Strict check box strictButton = new Button(shell, SWT.CHECK | SWT.WRAP); strictButton.setText("Ignore source-source/target-target paths"); gridData = new GridData(GridData.CENTER, GridData.CENTER, false, false); gridData.verticalSpan = 2; gridData.horizontalSpan = 4; strictButton.setLayoutData(gridData); }
/** * Creates a checkbox that controls whether a background image is set on the registered controls. * * @return the created checkbox */ protected Button createBgImageButton() { final Button button = new Button(styleComp, SWT.CHECK); button.setText("Background Image"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showBgImage = button.getSelection(); updateBgImage(); } }); return button; }
public void start(Stage stage) { Button button = new Button("Click me!"); button.setOnAction( new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { System.out.println("Thanks for clicking!"); } }); stage.setScene(new Scene(button)); stage.show(); }
private void updateButtonEnablement(boolean doAddEnablement, boolean doRemoveEnablement) { updateCount(); int availableCount = fAvailableListViewer.getTable().getItemCount(); int importCount = fImportListViewer.getTable().getItemCount(); if (doAddEnablement) updateSelectionBasedEnablement(fAvailableListViewer.getSelection(), true); if (doRemoveEnablement) updateSelectionBasedEnablement(fImportListViewer.getSelection(), false); fAddAllButton.setEnabled(availableCount > 0); fRemoveAllButton.setEnabled(importCount > 0); fAddRequiredButton.setEnabled(importCount > 0); }
private void addSuggestPanel() { HorizontalPanel langPanel = new HorizontalPanel(); langPanel.setSpacing(5); langPanel.add(new HTML("Enter language:")); MultiWordSuggestOracle langChoices = new ProgrammingLanguageOracle(); SuggestBox langBox = new SuggestBox(langChoices); langPanel.add(langBox); Button searchButton = new Button("Send to Google"); searchButton.addClickHandler(new SearchHandler(langBox)); langPanel.add(searchButton); RootPanel.get("suggest-panel").add(langPanel); }
/** * After creating the dialog box, initial values are assigned to the fields with data in opt * OptionsPack */ public void setInitialValues(QueryOptionsPack opt) { if (main.getPathwayGraph() == null) { newViewButton.setSelection(true); currentViewButton.setSelection(false); currentViewButton.setEnabled(false); opt.setCurrentView(false); } if (opt.isCurrentView()) { currentViewButton.setSelection(true); } else { newViewButton.setSelection(true); } lengthLimit.setText(String.valueOf(opt.getLengthLimit())); if (sourceST != null && opt.getSourceList() != null) { sourceST.symbolText.setText(opt.getOneStringSources()); } if (targetST != null && opt.getTargetList() != null) { targetST.symbolText.setText(opt.getOneStringTargets()); } if (downstreamButton != null) { // Downstream, Upstream or Both if (opt.isDownstream() && opt.isUpstream() && bothButton != null) { bothButton.setSelection(true); } else if (opt.isDownstream()) { downstreamButton.setSelection(true); } else if (opt.isUpstream()) { upstreamButton.setSelection(true); } } if (strictButton != null) { // Strict if (opt.isStrict()) { strictButton.setSelection(true); } } // Set both texts' values if (shortestPlusK != null) { shortestPlusK.setText(String.valueOf(opt.getShortestPlusKLimit())); } if (shortestPlusKButton != null) { shortestPlusKButton.setSelection(!opt.getLimitType()); } }
@Override public void mousePressed(MouseEvent e) { if (go.poly.contains(e.getX(), e.getY())) { what1 me = new what1(); frame.setVisible(false); } if (info.poly.contains(new Point(e.getX(), e.getY()))) { info.pressed = true; } if (back.poly.contains(new Point(e.getX(), e.getY()))) { back.pressed = true; } }