/** * Sets the action field action. * * @param actions * the action field actions. */ public void setActions(List<Action> actions) { if (!ObjectUtils.equals(this.actions, actions)) { buttonPanel.removeAll(); this.actions = actions; for (Action action : actions) { SButton actionButton = new SButton(); actionButton.setAction(action); actionButton.setDisabledIcon(actionButton.getIcon()); actionButton.setActionCommand("*"); actionButton.setText(null); actionButton.setShowAsFormComponent(false); actionButton.setBorder(SBorderFactory.createSLineBorder(Color.GRAY)); if (showTextField) { if (defaultAction == null) { defaultAction = action; textField.addActionListener(action); } } buttonPanel.add(actionButton); } } }
/** * Constructs a new <code>SColorPicker</code> instance. */ public SColorPicker() { setLayout(new SBoxLayout(this, SBoxLayout.X_AXIS)); chooseButton = new SButton(); chooseButton.addActionListener(new ActionListener() { public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { showColorPickerDialog(); } }); chooseButton.setShowAsFormComponent(false); chooseButton.setPreferredSize(BUTTON_DIM); chooseButton.setBorder(SBorderFactory.createSLineBorder(Color.GRAY)); resetButton = new SButton(); resetButton.addActionListener(new ActionListener() { public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { setValue(resetValue); } }); resetButton.setShowAsFormComponent(false); resetButton.setPreferredSize(BUTTON_DIM); resetButton.setBorder(SBorderFactory.createSLineBorder(Color.GRAY)); add(chooseButton); add(resetButton); }
/** * {@inheritDoc} */ @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); chooseButton.setEnabled(isEnabled()); resetButton.setEnabled(isEnabled()); }
/** * Creates a button. * * @return the created button. */ protected SButton createSButton() { SButton button = new SButton(); button.setActionCommand("*"); // For LOV actions to avoid "1". return button; }
/** * Generic Button creation */ protected final SButton createButton(String key) { String label = CGManager.getString("org.wings.SOptionPane." + key + "ButtonText"); SButton b = new SButton(label); b.setName(getName() + key); b.addActionListener(this); return b; }
actionHandler, view, locale); SButton actionButton = createSButton(); actionButton.setShowAsFormComponent(false); actionButton.setAction(wingsAction); actionButton.setDisabledIcon(actionButton.getIcon()); if (action.getAcceleratorAsString() != null) { KeyStroke ks = KeyStroke.getKeyStroke(action + "-" + KeyEvent.getKeyText(ks.getKeyCode()); actionButton.setToolTipText("<HTML>" + actionButton.getToolTipText() + " <FONT SIZE=\"-2\" COLOR=\"#993366\">" + acceleratorString + "</FONT></HTML>"); actionButton.setText(""); break; case LABEL: actionButton.setIcon(null); break; default:
public void setOptions(Object... options) { resetOptions(); Object[] oldVal = this.options; if (customButtons == null) customButtons = new SPanel(); for (Object option : options) { if (option instanceof SComponent) { if (option instanceof SAbstractButton) ((SAbstractButton) option).addActionListener(this); customButtons.add((SComponent) option); } else { SButton b = new SButton(option.toString()); b.addActionListener(this); customButtons.add(b); } } add(customButtons); propertyChangeSupport.firePropertyChange("options", oldVal, this.options); }
cardPanel.setLayout(cardLayout); final SButton backButton = new SButton(getIconFactory(context) .getBackwardIcon(IIconFactory.SMALL_ICON_SIZE)); final SButton nextButton = new SButton(getIconFactory(context) .getForwardIcon(IIconFactory.SMALL_ICON_SIZE)); final SButton finishButton = new SButton(getIconFactory(context).getIcon( finishAction.getIconImageURL(), IIconFactory.SMALL_ICON_SIZE)); finishButton.setText(finishAction.getI18nName( getTranslationProvider(context), getLocale(context))); SButton cancelButton = new SButton(getIconFactory(context).getCancelIcon( IIconFactory.SMALL_ICON_SIZE)); cancelButton.setText(getTranslationProvider(context).getTranslation( "cancel", getLocale(context))); backButton.addActionListener(new ActionListener() { nextButton.addActionListener(new ActionListener() { finishButton.addActionListener(new ActionListener() { cancelButton.addActionListener(new ActionListener() {
actionHandler, view, locale); SButton actionButton = createSButton(); actionButton.setShowAsFormComponent(false); actionButton.setAction(wingsAction); if (action.getAcceleratorAsString() != null) { KeyStroke ks = KeyStroke.getKeyStroke(action .getModifiers()) + "-" + KeyEvent.getKeyText(ks.getKeyCode()); actionButton.setToolTipText("<HTML>" + actionButton.getToolTipText() + " <FONT SIZE=\"-2\" COLOR=\"#993366\">" + acceleratorString + "</FONT></HTML>"); actionButton.setText(""); toolBar.add(actionButton);
SButton actionButton = new SButton(); actionButton.setAction(action); actionButton.setDisabledIcon(actionButton.getIcon()); buttonBox.add(actionButton); buttonBox.add(new SSpacer(10, 10));
buttonBox.setBorder(new SEmptyBorder(new java.awt.Insets(5, 10, 5, 10))); SButton loginButton = new SButton(getTranslation( "ok", getLocale())); loginButton.setIcon(getIconFactory().getOkYesIcon( getIconFactory().getSmallIconSize())); loginButton.addActionListener(new ActionListener() {
/** * {@inheritDoc} */ @Override protected IView<SComponent> createActionView( IActionViewDescriptor viewDescriptor, IActionHandler actionHandler, Locale locale) { SButton viewComponent = createSButton(); IValueConnector connector = getConnectorFactory().createValueConnector( ModelRefPropertyConnector.THIS_PROPERTY); connector.setExceptionHandler(actionHandler); IView<SComponent> view = constructView(viewComponent, viewDescriptor, connector); viewComponent.setAction(getActionFactory().createAction( viewDescriptor.getAction(), viewDescriptor.getPreferredSize(), actionHandler, view, locale)); switch (viewDescriptor.getRenderingOptions()) { case ICON: viewComponent.setText(null); break; case LABEL: viewComponent.setIcon(null); break; default: break; } return view; }
backButton.setEnabled(true); } else { backButton.setEnabled(false); backButton.setText(translationProvider.getTranslation(wizardStep .getPreviousLabelKey(), locale)); } else { backButton.setText(translationProvider.getTranslation( IWizardStepDescriptor.DEFAULT_PREVIOUS_KEY, locale)); nextButton.setEnabled(true); } else { nextButton.setEnabled(false); nextButton.setText(translationProvider.getTranslation(wizardStep .getNextLabelKey(), locale)); } else { nextButton.setText(translationProvider.getTranslation( IWizardStepDescriptor.DEFAULT_NEXT_KEY, locale)); finishButton.setEnabled(true); } else { finishButton.setEnabled(false);
/** * Set the detailsPane section to be either visible or invisible. Set the text * of the Details button accordingly. * * @param b * if true detailsPane section will be visible */ private void setDetailsVisible(boolean b) { if (b) { collapsedHeight = 200; int height; if (expandedHeight == 0) { height = collapsedHeight + 300; } else { height = expandedHeight; } detailsPanel.setVisible(true); detailsButton.setText(translationProvider.getTranslation("details", locale) + " <<"); setPreferredSize(new SDimension(null, height + "px")); } else { detailsPanel.setVisible(false); detailsButton.setText(translationProvider.getTranslation("details", locale) + " >>"); setPreferredSize(new SDimension(null, collapsedHeight + "px")); } } }
final SDialog colorPickerDialog = new SDialog(getParentFrame(), true); colorPickerDialog.setDraggable(true); SButton okButton = new SButton("OK"); SButton cancelButton = new SButton("Cancel"); SButton restoreButton = new SButton("Restore"); okButton.addActionListener(new ActionListener() { cancelButton.addActionListener(new ActionListener() { restoreButton.addActionListener(new ActionListener() {
/** * Creates a button. * * @return the created button. */ protected SButton createSButton() { SButton button = new SButton(); button.setActionCommand("*"); // For LOV actions to avoid "1". return button; }
gbc.anchor = GridBagConstraints.EAST; gbc.insets = new Insets(12, 0, 11, 5); SButton okButton = new SButton(translationProvider.getTranslation("ok", locale)); pane.add(okButton, gbc); detailsButton = new SButton(translationProvider.getTranslation("details", locale)); gbc = new GridBagConstraints(); pane.add(detailsPanel, gbc); SButton button = new SButton(translationProvider.getTranslation( "copy.name", locale)); button.addActionListener(new ActionListener() { detailsPanel.add(button, gbc); okButton.addActionListener(new ActionListener() { detailsButton.addActionListener(new ActionListener() {
vertSlider.addChangeListener(e -> label.setText("value of slider 4 is "+ String.valueOf(((SSlider)e.getSource()).getValue()))); final SButton button = new SButton("store slider positions"); button.addActionListener(e -> {