Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
html#radiobuttonapi
Contoh Aplikasi:
Buat project dengan sebuah frame "RadioButton#emo$ Struktur project%
#ari gambar ini! package components berisi J&rame bernama RadioButton.ja'a. package components.images berisi lima buah gambar "Bird.gif! (at.gif! #og.gif! ig.gif! Rabbit.gif$. #esain form%
Seting komponen% )o 1 2 3 Komponen JFrame ButtonGroup roperti title variable )ilai RadioButtonDemo bg1 panel1
JPanel variable (untuk diisi bua! JRadioButton JRadioButton variable (masukkan ke te$t JPanel# selected icon JRadioButton variable (masukkan ke te$t JPanel#
"
rbBird Bird dicentang (true# Bird%gi& rb'at 'at rbDog Dog rbRabbit Rabbit rbPig Pig gambar './0.R Bird%gi& 1dikosongkan2
JRadioButton variable (masukkan ke te$t JPanel# JRadioButton variable (masukkan ke te$t JPanel# JRadioButton variable (masukkan ke te$t JPanel# J,abel variable !ori-ontalAlignment icon te$t
untuk radio button lainnya juga diberi e'ent yang sama seperti rbBird! hanya file gif yang diset "set+con$ disesuaikan.
Radio Button Constructors Constructor JRadioButton(Action JRadioButton(!tring JRadioButton(!tring" boolean JRadioButton(#con JRadioButton(#con" boolean JRadioButton(!tring" #con JRadioButton(!tring" #con" boolean JRadioButton( JRadioButton+enu#tem(Action JRadioButton+enu#tem(!tring JRadioButton+enu#tem(#con JRadioButton+enu#tem(!tring" #con JRadioButton+enu#tem( Purpose Create a JRadioButton instance. $he string argument speci%ies the te&t" i% an'" that the radio button should displa'. !imilarl'" the :con argument speci%ies the image that should be used instead o% the loo( and %eel)s de%ault radio button image. !peci%'ing the boolean argument as true initiali*es the radio button to be selected" subject to the approval o% the ButtonGroup object. #% the boolean argument is absent or &alse" then the radio button is initiall' unselected. Create a JRadioButton<enu:tem instance. $he arguments are interpreted in the same wa' as the arguments to the JRadioButton constructors" e&cept that an' speci%ied icon is shown in addition to the normal radio button icon.