简体   繁体   中英

How to remove background color of a checkbox in java

when I run this code it runs error.

        Checkbox term3 = new Checkbox("SENG 12213 - Data Structures and Algorithms");
        term3.setFont(new Font("Arial",Font.PLAIN,13));
        term3.setSize(300,20);
        term3.setLocation(50,310);
        term3.setOpaque(false);

when I run this code, the error is

cannot resolve the method'setOpaque(Boolen)'

how can I remove this background color,help me with this? enter image description here

when I run this code, the error is 'cannot resolve the method'setOpaque(Boolen)'

Checkbox is an AWT component.

The setOpaque(…) method is a Swing method so you need to use a Swing component.

Use a JCheckBox .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM