Example usage for javax.swing JCheckBox setUI

List of usage examples for javax.swing JCheckBox setUI

Introduction

In this page you can find the example usage for javax.swing JCheckBox setUI.

Prototype

@BeanProperty(hidden = true, visualUpdate = true, description = "The UI object that implements the LookAndFeel.")
public void setUI(ButtonUI ui) 

Source Link

Document

Sets the L&F object that renders this component.

Usage

From source file:MyCheckBoxUI.java

public static void main(String[] argv) {
    JFrame f = new JFrame();
    f.setSize(400, 300);//  ww  w .j  av a2  s.c o  m
    f.setLayout(new FlowLayout());

    JPanel p = new JPanel();
    JCheckBox bt1 = new JCheckBox("Click Me");
    bt1.setUI(new MyCheckBoxUI());
    p.add(bt1);
    f.add(p);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:MyCheckBoxUI.java

public static void main(String[] argv) {
    JFrame f = new JFrame();
    f.setSize(400, 300);/*w ww  . j  av  a  2s  . c  o m*/
    f.getContentPane().setLayout(new FlowLayout());

    JPanel p = new JPanel();
    JCheckBox bt1 = new JCheckBox("Click Me");
    bt1.setUI(new MyCheckBoxUI());
    p.add(bt1);
    f.getContentPane().add(p);
    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    f.addWindowListener(wndCloser);
    f.setVisible(true);
}