Basic Elements of The GUI By: Brandon Henderson and James Merino
About Graphical User Interface Commonly used on operating systems such as Windows and Mac Provides a much user-friendly interface for users Are event driven
What GUIs look like What Text-Based looks like
The Basic Elements of GUIs JTextField – Input through text Jlabel – Used to display text Jbutton – Input through a mouse click
Other more complex GUI elements… JPanel JComboBox JCheckBox
Code snippets JPanel – panel = new Jpanel(parameters go here); JLabel – label = new JLabel(text, additional parameters); JTextField – text = new TextField(text, width, additional parameters); JButton = new Jbutton(text, additional parameters); Requires an action listener method where the code that will be run when the button is pressed can be executed. Adding Elements: panel.add(name of element); button.addActionListener(this);
Thanks for listening!