Java Swing Tutorial A – Z : Part 6 : JToggleButton Usage (English subtitle)

Java Swing Tutorial A – Z : Part 6 : JToggleButton Usage (English subtitle)


Create a new empty java application project Create a new JFrame named LightOnAndOff Create new folder named images to contain images Copy images to the subpackage images Design GUI with a JToggleButton and a JLabel, edit text of JToggleButton, change variable name, chang icon of JLabel to off.jpg image, clear text of JLabel Create action event for bPower toggle button If toggle button is selected, set background of button to red, set text to “ON”, set image icon to on.jpg and otherwise Run the project and check result Change the background color property of toggle button to green Run project again and check changes

7 thoughts on “Java Swing Tutorial A – Z : Part 6 : JToggleButton Usage (English subtitle)”

  1. Алик Антипов

    Кровиночка, объясни внуку. как достучаться до JToggleButton по индексу или тексту, если они(много JToggleButton) созданы программно в цикле?

Leave a Reply

Your email address will not be published. Required fields are marked *