首页javajcheckboxJava Swing - 如何扩展BasicButtonUI来创建自定义JButton...

Java Swing - 如何扩展BasicButtonUI来创建自定义JButton...

我们想知道如何扩展BasicButtonUI来创建自定义JButton。...

import javax.swing.JCheckBox;

public class Main {
  public static void main(String[] argv) throws Exception {

    JCheckBox checkbox = new JCheckBox();

    // Get the current state of the checkbox
    boolean b = checkbox.isSelected();

    // Set the state of the checkbox to off
    checkbox.setSelected(false);

    // Set the state of the checkbox to on
    checkbox.setSelected(true);

  }
}