Package javax.swing

Examples of javax.swing.ButtonModel


    public void setEditable(boolean editable) {
      if (this.editable != editable) {
        this.editable = editable;
        // Invoke setModel so we set the model to be the correct sort of model
        if (editable) {
          ButtonModel model = getModel();
          if (model instanceof ReadOnlyButtonModel) {
            this.setModel(((ReadOnlyButtonModel)model).getOriginalModel());
          }
        }
        else {
          ButtonModel model = getModel();
          if (!(model instanceof ReadOnlyButtonModel)) {
            this.setModel(new ReadOnlyButtonModel(this, model));
          }
        }
        this.firePropertyChange("editable", !editable, editable);
View Full Code Here


    }//GEN-LAST:event_jCheckBox1ActionPerformed


    private void makeSelection()   
    {
        ButtonModel model=buttonGroup1.getSelection();
        if (jToggleButton1.isSelected())
        {           
          myPanel.modus=ColorPanel.MODE_FLAT;
          myPanel.updateUI();
          jCheckBox1.setVisible(false);
View Full Code Here

   *
   * @see
   * java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
   */
  public void mouseReleased(MouseEvent e) {
    ButtonModel model = this.item.getModel();
    model.setRollover(false);
  }
View Full Code Here

        }
    }
   
    @Action
    public void setLookAndFeel() {
        ButtonModel model = lookAndFeelRadioGroup.getSelection();
        String lookAndFeelName = model.getActionCommand();
        try {
            setLookAndFeel(lookAndFeelName);
        } catch (Exception ex) {
            displayErrorMessage(resourceMap.getString("error.unableToChangeLookAndFeel") +
                    "to "+lookAndFeelName, ex);
View Full Code Here

        }

        @Override
        public void paintIcon(Component c, Graphics g, int x, int y) {
            JCheckBox cb = (JCheckBox) c;
            ButtonModel model = cb.getModel();

            // TODO fix up for Nimbus LAF
            if (model.isEnabled()) {
                if (model.isPressed() && model.isArmed()) {
                    g.setColor(MetalLookAndFeel.getControlShadow());
                    g.fillRect(x, y, iconWidth - 1, iconHeight - 1);
                    drawPressed3DBorder(g, x, y, iconWidth, iconHeight);
                } else {
                    drawFlush3DBorder(g, x, y, iconWidth, iconHeight);
View Full Code Here

     * @param resourcename name of resource whose button is to be selected
     */
    public void setText(String resourcename) {
        Enumeration<AbstractButton> en = this.bGroup.getElements();
        while (en.hasMoreElements()) {
            ButtonModel model = en.nextElement().getModel();
            if (model.getActionCommand().equals(resourcename)) {
                this.bGroup.setSelected(model, true);
            } else {
                this.bGroup.setSelected(model, false);
            }
        }
View Full Code Here

     * @param resourcename name of resource whose button is to be selected
     */
    public void setText(String resourcename) {
        Enumeration en = this.bGroup.getElements();
        while (en.hasMoreElements()) {
            ButtonModel model = ((JRadioButton) en.nextElement()).getModel();
            if (model.getActionCommand().equals(resourcename)) {
                this.bGroup.setSelected(model, true);
            } else {
                this.bGroup.setSelected(model, false);
            }
        }
View Full Code Here

        return ui;
    }

    protected void paintText(Graphics g, JComponent com, Rectangle rect, String s) {
        XBayaLinkButton bn = (XBayaLinkButton) com;
        ButtonModel bnModel = bn.getModel();
        if (bnModel.isEnabled()) {
            if (bnModel.isPressed())
                bn.setForeground(bn.getActiveLinkColor());
            else if (bn.isLinkVisited())
                bn.setForeground(bn.getVisitedLinkColor());

            else
                bn.setForeground(bn.getLinkColor());
        } else {
            if (bn.getDisabledLinkColor() != null)
                bn.setForeground(bn.getDisabledLinkColor());
        }
        super.paintText(g, com, rect, s);
        int behaviour = bn.getLinkBehavior();
        boolean drawLine = false;
        if (behaviour == XBayaLinkButton.HOVER_UNDERLINE) {
            if (bnModel.isRollover())
                drawLine = true;
        } else if (behaviour == XBayaLinkButton.ALWAYS_UNDERLINE || behaviour == XBayaLinkButton.SYSTEM_DEFAULT)
            drawLine = true;
        if (!drawLine)
            return;
        FontMetrics fm = g.getFontMetrics();
        int x = rect.x + getTextShiftOffset();
        int y = (rect.y + fm.getAscent() + fm.getDescent() + getTextShiftOffset()) - 1;
        if (bnModel.isEnabled()) {
            g.setColor(bn.getForeground());
            g.drawLine(x, y, (x + rect.width) - 1, y);
        } else {
            g.setColor(bn.getBackground().brighter());
            g.drawLine(x, y, (x + rect.width) - 1, y);
View Full Code Here

                    String scriptText = inputTextArea.getText();

                    log.info("scriptText: " + scriptText);

                    ButtonModel buttonModel =
                        requestMenuItemsGroup.getSelection();

                    JRadioButtonMenuItem selectedMenuItem =
                        radioButtonMap.get(buttonModel);
View Full Code Here

    setResizable(false);
  }

  public void auswahlHintergrund() {
    ButtonModel selectedModel = bg3.getSelection();
    if (rdbtnWiese.getModel() == selectedModel) {
      PlayCanvas.bild = Bild.RASEN;
    } else if (rdbtnWolken.getModel() == selectedModel) {
      PlayCanvas.bild = Bild.WOLKEN;
    } else if (rdbtnSpace.getModel() == selectedModel) {
View Full Code Here

TOP

Related Classes of javax.swing.ButtonModel

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.