Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.RadioButton


        disabledButtonSelectionColor = theme.getColor(7);
    }

    @Override
    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;
    }

    @Override
    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;
    }

    @Override
    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);
    }

    @Override
    public int getBaseline(int width, int height) {
        RadioButton radioButton = (RadioButton)getComponent();

        int baseline = -1;

        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        int clientWidth = Math.max(width - (BUTTON_DIAMETER + spacing), 0);
        baseline = dataRenderer.getBaseline(clientWidth, height);

        return baseline;
View Full Code Here

        return baseline;
    }

    @Override
    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

        disabledButtonSelectionColor = theme.getColor(7);
    }

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

        int preferredWidth = BUTTON_DIAMETER;

        Object buttonData = radioButton.getButtonData();
        if (buttonData != null) {
            dataRenderer.render(buttonData, radioButton, false);
            preferredWidth += dataRenderer.getPreferredWidth(height)
                + spacing * 2;
        }
View Full Code Here

        return preferredWidth;
    }

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

        int preferredHeight = BUTTON_DIAMETER;

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

        return preferredHeight;
    }

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

        int preferredWidth = BUTTON_DIAMETER;
        int preferredHeight = BUTTON_DIAMETER;

        Object buttonData = radioButton.getButtonData();
        if (buttonData != null) {
            dataRenderer.render(buttonData, radioButton, false);
            preferredWidth += dataRenderer.getPreferredWidth(-1)
                + spacing * 2;

 
View Full Code Here

        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public int getBaseline(int width, int height) {
        RadioButton radioButton = (RadioButton)getComponent();

        int baseline = -1;

        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
        dataRenderer.render(radioButton.getButtonData(), radioButton, false);

        int clientWidth = Math.max(width - (BUTTON_DIAMETER + spacing), 0);
        baseline = dataRenderer.getBaseline(clientWidth, height);

        return baseline;
View Full Code Here

        return baseline;
    }

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

        // Paint the button
        int offset = (height - BUTTON_DIAMETER) / 2;
        graphics.translate(0, offset);
        paintButton(graphics, radioButton.isEnabled(), radioButton.isSelected());
        graphics.translate(0, -offset);

        // Paint the content
        Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
        Object buttonData = radioButton.getButtonData();
        dataRenderer.render(buttonData, 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()) {
            if (buttonData == null) {
                Color focusColor = new Color(buttonSelectionColor.getRed(),
                    buttonSelectionColor.getGreen(),
                    buttonSelectionColor.getBlue(), 0x44);
                graphics.setColor(focusColor);
View Full Code Here

TOP

Related Classes of org.apache.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.