JCheckBoxTest.java Source code

Java tutorial

Introduction

Here is the source code for JCheckBoxTest.java

Source

import java.awt.FlowLayout;

import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class JCheckBoxTest {

    public static void main(String[] args) {
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame frame = new JFrame("JCheckBox Test");
        frame.setLayout(new FlowLayout());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JCheckBox ac = new JCheckBox("A/C");
        ac.setSelected(true);
        JCheckBox cdPlayer = new JCheckBox("A");
        JCheckBox cruiseControl = new JCheckBox("B");
        JCheckBox keylessEntry = new JCheckBox("C");
        JCheckBox antiTheft = new JCheckBox("D");
        JCheckBox centralLock = new JCheckBox("E");

        frame.add(new JLabel("Car Features"));
        frame.add(ac);
        frame.add(cdPlayer);
        frame.add(cruiseControl);
        frame.add(keylessEntry);
        frame.add(antiTheft);
        frame.add(centralLock);
        frame.pack();
        frame.setVisible(true);
    }
}