Package pivot.wtk

Examples of pivot.wtk.RadioButton


        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        Component content =
            (Component)wtkxSerializer.readObject("pivot/tutorials/buttons/radio_buttons.wtkx");

        // Get a reference to the button group
        RadioButton oneButton =
            (RadioButton)wtkxSerializer.getObjectByName("oneButton");
        final Button.Group numbersGroup = oneButton.getGroup();

        // Add a button press listener
        PushButton selectButton =
            (PushButton)wtkxSerializer.getObjectByName("selectButton");
View Full Code Here


    private static final int BUTTON_DIAMETER = 14;
    private static final int BUTTON_SELECTION_DIAMETER = 6;

    public int getPreferredWidth(int height) {
        RadioButton radioButton = (RadioButton)getComponent();
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();

        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        int preferredWidth = BUTTON_DIAMETER
            + dataRenderer.getPreferredWidth(height)
            + spacing * 2;

 
View Full Code Here

        return preferredWidth;
    }

    public int getPreferredHeight(int width) {
        RadioButton radioButton = (RadioButton)getComponent();
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();

        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        if (width != -1) {
            width = Math.max(width - (BUTTON_DIAMETER + spacing), 0);
        }
View Full Code Here

        return preferredHeight;
    }

    public Dimensions getPreferredSize() {
        RadioButton radioButton = (RadioButton)getComponent();
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();

        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        int preferredWidth = BUTTON_DIAMETER
            + dataRenderer.getPreferredWidth(-1)
            + spacing * 2;

 
View Full Code Here

        return new Dimensions(preferredWidth, preferredHeight);
    }

    public void paint(Graphics2D graphics) {
        RadioButton radioButton = (RadioButton)getComponent();
        int width = getWidth();
        int height = getHeight();

        // Paint the button
        Graphics2D buttonGraphics = (Graphics2D)graphics.create();
        paintButton(buttonGraphics, radioButton, height);
        buttonGraphics.dispose();

        // Paint the content
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
        dataRenderer.render(radioButton.getButtonData(), radioButton, false);
        dataRenderer.setSize(Math.max(width - (BUTTON_DIAMETER + spacing * 2), 0), height);

        Graphics2D contentGraphics = (Graphics2D)graphics.create();
        contentGraphics.translate(BUTTON_DIAMETER + spacing, 0);
        contentGraphics.clipRect(0, 0, dataRenderer.getWidth(), dataRenderer.getHeight());
        dataRenderer.paint(contentGraphics);
        contentGraphics.dispose();

        // Paint the focus state
        if (radioButton.isFocused()) {
            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);

            graphics.setStroke(dashStroke);
            graphics.setColor(BUTTON_BORDER_COLOR);
View Full Code Here

        disabledButtonBorderColor = theme.getColor(7);
        disabledButtonSelectionColor = theme.getColor(7);
    }

    public int getPreferredWidth(int height) {
        RadioButton radioButton = (RadioButton)getComponent();
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();

        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        int preferredWidth = BUTTON_DIAMETER
            + dataRenderer.getPreferredWidth(height)
            + spacing * 2;

 
View Full Code Here

        return preferredWidth;
    }

    public int getPreferredHeight(int width) {
        RadioButton radioButton = (RadioButton)getComponent();
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();

        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        if (width != -1) {
            width = Math.max(width - (BUTTON_DIAMETER + spacing), 0);
        }
View Full Code Here

        return preferredHeight;
    }

    public Dimensions getPreferredSize() {
        RadioButton radioButton = (RadioButton)getComponent();
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();

        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        int preferredWidth = BUTTON_DIAMETER
            + dataRenderer.getPreferredWidth(-1)
            + spacing * 2;

 
View Full Code Here

        return new Dimensions(preferredWidth, preferredHeight);
    }

    public void paint(Graphics2D graphics) {
        RadioButton radioButton = (RadioButton)getComponent();
        int width = getWidth();
        int height = getHeight();

        // Paint the button
        Graphics2D buttonGraphics = (Graphics2D)graphics.create();
        paintButton(buttonGraphics, radioButton, height);
        buttonGraphics.dispose();

        // Paint the content
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
        dataRenderer.render(radioButton.getButtonData(), radioButton, false);
        dataRenderer.setSize(Math.max(width - (BUTTON_DIAMETER + spacing * 2), 0), height);

        Graphics2D contentGraphics = (Graphics2D)graphics.create();
        contentGraphics.translate(BUTTON_DIAMETER + spacing, 0);
        contentGraphics.clipRect(0, 0, dataRenderer.getWidth(), dataRenderer.getHeight());
        dataRenderer.paint(contentGraphics);
        contentGraphics.dispose();

        // Paint the focus state
        if (radioButton.isFocused()) {
            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
                BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);

            graphics.setStroke(dashStroke);
            graphics.setColor(buttonBorderColor);
View Full Code Here

public abstract class RadioButtonSkin extends ButtonSkin {
    @Override
    public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
        boolean consumed = super.mouseClick(component, button, x, y, count);

        RadioButton radioButton = (RadioButton)getComponent();

        radioButton.requestFocus();
        radioButton.press();

        return consumed;
    }
View Full Code Here

TOP

Related Classes of pivot.wtk.RadioButton

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.