Java Code Examples for com.codename1.ui.Button#getRolloverIcon()

The following examples show how to use com.codename1.ui.Button#getRolloverIcon() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultLookAndFeel.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Dimension getCheckBoxPreferredSize(Button cb) {
    if(cb.isToggle()) {
        return getButtonPreferredSize(cb);
    }
    threeImageCache[0] = cb.getMaskedIcon();
    threeImageCache[1] = cb.getRolloverIcon();
    threeImageCache[2] = cb.getPressedIcon();
    if (chkBoxImages != null) {
        return getPreferredSize(cb, threeImageCache, chkBoxImages[0]);
    }
    Dimension d = getPreferredSize(cb, threeImageCache, null);

    // checkbox square needs to be the height and width of the font height even
    // when no text is in the check box this is a good indication of phone DPI
    int checkBoxSquareSize = cb.getStyle().getFont().getHeight();

    // allow for checkboxes without a string within them
    d.setHeight(Math.max(checkBoxSquareSize, d.getHeight()));

    d.setWidth(d.getWidth() + checkBoxSquareSize + cb.getGap());
    return d;
}
 
Example 2
Source File: DefaultLookAndFeel.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Dimension getButtonPreferredSize(Button b) {
    threeImageCache[0] = b.getMaskedIcon();
    threeImageCache[1] = b.getRolloverIcon();
    threeImageCache[2] = b.getPressedIcon();
    return getPreferredSize(b, threeImageCache, null);
}
 
Example 3
Source File: DefaultLookAndFeel.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Dimension getRadioButtonPreferredSize(Button rb) {
    if(rb.isToggle()) {
        return getButtonPreferredSize(rb);
    }
    threeImageCache[0] = rb.getMaskedIcon();
    threeImageCache[1] = rb.getRolloverIcon();
    threeImageCache[2] = rb.getPressedIcon();
    if (rButtonImages != null) {
        return getPreferredSize(rb, threeImageCache, rButtonImages[0]);
    }
    Dimension d = getPreferredSize(rb, threeImageCache, null);

    // radio button radius needs to be of the size of the font height even
    // when no text is in the radio button this is a good indication of phone DPI
    int height = rb.getStyle().getFont().getHeight();

    // allow for radio buttons without a string within them
    d.setHeight(Math.max(height, d.getHeight()));

    if(rButtonImages != null && rButtonImages.length > 0) {
        d.setWidth(rButtonImages[0].getWidth() + d.getWidth() + rb.getGap());
    } else {
        d.setWidth(d.getWidth() + height + rb.getGap());
    }
    return d;
}