Java Gui1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

CLI VERSUS GUI

 JRadioButton is a component used to create buttons


Command Line Interface (CLI) that offer a way for users to select one option from a
It refers to a type of program that is designed for text-based set of mutually exclusive choices.
interaction. It means that program displays its instructions
and results as text and the user interacts with the program by  JButton stands as a fundamental building block for
typing their responses using a keyboard. creating interactive elements. It's a push button that
users can click, triggering actions within your
Graphical User Interface (GUI) application.
It is a type of program that allows users to interact with the
program through graphic elements such as icons, buttons,  ButtonGroup is a component that helps manage and
text boxes, etc. synchronize the selection state of radio buttons and
toggle buttons. It ensures that only one button can be
STRUCTURE OF GRAPHICAL USER INTERFACE: selected at a time within the group.

Frame  JCheckBox stands as a versatile component for


It is also referred to as “form” which is a window presenting multiple, independent choices to users.
component that acts like a blank canvass where the user Checkboxes allow users to select or deselect options
interface can be designed. individually.

Controls  JComboBox represents a versatile component that


It refers to the graphical elements such as text boxes, labels, combines a button or editable field with a drop-down
scroll bars, buttons, etc. that serve as control components for list. It allows users to select a single value from a
users to interact with. predefined set of options.

Properties  JMenu is a component used to create menu bars and


It refers to the characteristic or attribute of the frame or drop-down menus in your application's user interface.
control elements. Example of properties include names, It allows users to access various features and
captions, size, color, position, and contents. commands through a hierarchical structure of menu
items.
Methods
Is a block of code that performs a specific task. It is like a  JList is a component that displays a list of selectable
mini program within your larger program that you can call items. It allows users to choose one or more items
upon whenever you need it to do its job. from the list, depending on its configuration.

Advantages of Using Methods:  JSlider is a component that represents a horizontal


 Self-contained: Methods group related instructions slider bar allowing users to select a value from a
together, making your code modular and easier to continuous range. It's like a visual volume control or
understand. progress bar where users can slide the handle to
 Reusable: Define a method once and call it multiple choose a specific point within a defined range.
times throughout your program, saving time and effort.
 Parameters: Methods can accept input values  JSpinner is a component that allows users to select a
(parameters) to customize their behavior. value from an ordered sequence either by typing it in
 Return values: Methods can optionally return a value or using up/down arrows to spin through the options.
after their execution. It's like a miniature combo box with the added benefit
of direct value input.
CONTROLS IN JAVA
 JFrame is the top-level window for the application
that acts as the container for all other graphical
elements like buttons, labels, and text fields.

 JLabel is a component in Java GUI frameworks that is


used to display text or images on the user interface.

 JTextField is a component used for single-line text


input from the user. It allows users to type in text,
similar to a typical text box in applications.

 JPasswordField is a specialized component designed


for password entry. It provides a secure way for users
to enter their passwords without displaying the actual
characters they type.

 JTextArea is a component in Java GUI frameworks


that allows users to input, edit, and display multi-line
text.

You might also like