Diseño Avanzado de Interfaz Grafica de Usuario con SWING JCheckBox
description
Transcript of Diseño Avanzado de Interfaz Grafica de Usuario con SWING JCheckBox
Diseño Avanzado de Interfaz Grafica de Usuario con SWING
JCheckBox
Se trata de controles que permiten su activación y desactivación a fin de elegir una serie de opciones independientes. En Swing es la clase JCheckBox la encargada de representarlas. Esta clase deriva de JToggleButton, que, a su vez, deriva de AbstractButton
DEFINICIÓN
import javax.swing.*
import javax.swing.JCheckBox;
javax.swing.JCheckBox objeto = new javax.swing.JCheckBox();
javax
swing
JCheckBox
¿DONDE SE ENCUENTRA?
CONSTRUCTORES
Constructor Summary
JCheckBox()
Creates an initially unselected check box button with no text, no icon.
JCheckBox(Action a)
Creates a check box where properties are taken from the Action supplied.
JCheckBox(Icon icon)
Creates an initially unselected check box with an icon.
JCheckBox(Icon icon, boolean selected)
Creates a check box with an icon and specifies whether or not it is initially selected.
JCheckBox(String text)
Creates an initially unselected check box with text.
JCheckBox(String text, boolean selected)
Creates a check box with text and specifies whether or not it is initially selected.
JCheckBox(String text, Icon icon)
Creates an initially unselected check box with the specified text and icon.
JCheckBox(String text, Icon icon, boolean selected)
Creates a check box with text and icon, and specifies whether or not it is initially selected.
CREANDO OBJETOS JCHECKBOX
JCheckBox check1 = new JCheckBox();JCheckBox check2 = new JCheckBox();
ImageIcon imagenUno = new ImageIcon("imagenes/mad.gif");ImageIcon imagenDos = new ImageIcon("imagenes/whistling.gif");
JCheckBox check1 = new JCheckBox(imagenUno);JCheckBox check2 = new JCheckBox(imagenDos);
JCheckBox check1 = new JCheckBox("Perros");JCheckBox check2 = new JCheckBox("Pajaros");
JCheckBox check1 = new JCheckBox("Perros", true);JCheckBox check2 = new JCheckBox("Pajaros", false);
MÉTODOS DEL JCHECKBOX
Method Summaryprotected voidconfigurePropertiesFromAction(Action a)
Factory method which sets the ActionEvent source's properties according to values from the Action instance.
protected PropertyChangeListenercreateActionPropertyChangeListener(Action a)
Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.
AccessibleContextgetAccessibleContext()
Gets the AccessibleContext associated with this JCheckBox.
StringgetUIClassID()
Returns a string that specifies the name of the L&F class that renders this component.
booleanisBorderPaintedFlat() Gets the value of the borderPaintedFlat property.
protected StringparamString() Returns a string representation of this JCheckBox.
voidsetBorderPaintedFlat(boolean b)
Sets the borderPaintedFlat property, which gives a hint to the look and feel as to the appearance of the check box border.
voidupdateUI() Resets the UI property to a value from the current
look and feel.