![]() ![]() It renders a text box of 20 column width. It does not limit the number of characters that can be input in the box.Įxample: JTextField txtBox = new JTextField(20) This parameter sets the width of the box measured by the number of columns. To initialize the text field, call its constructor and pass an optional integer parameter to it. A user can input non-formatted text in the box. JTextField renders an editable single-line text box. This constructor returns a label with text. ![]() It does not generate any event.Įxample: JLabel textLbl = new JLabel("This is a text label.") JLabel class is used to render a read-only text label or images on the UI. It returns a button with the home icon and text Home. JButton btn2 = new JButton(homeIcon, "Home") It returns a button with a homeIcon on it. This constructor returns a button with text Ok on it. A JButton can be implemented in the application by calling one of its constructors.Įxample: JButton okBtn = new JButton("Ok") It generates an event when clicked and double-clicked. The button can contain some display text or image. JButton class is used to create a push-button on the UI. Note: We would be using this image icon in further examples. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |