















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of the abstract windowing toolkit (awt) components and layout managers used in developing java graphical user interfaces (guis). It covers the initial set of awt components, including buttons, text fields, labels, text areas, check boxes, menus, radio buttons, canvases, lists, and scroll panes. The document also explains how to use layout managers, such as flowlayout and gridlayout, to organize and position components in a container.
Typology: Slides
1 / 55
This page cannot be seen from the preview
Don't miss anything!
An Introduction
Outline
Container-Non-Container Components
JPanel
JPanel
JButton JButton
JTextArea
Combination
JPanel
JButton
JLabel
JButton JButton
JTextArea
AWT Components
Swing
Components
Packages
Abstract Windowing Kit GUI-Components are drawn according to the underlying windowing system Initial set of Components developed AWT Components Buttons Text Fields Labels Text Areas Check Boxes Menus Radio Buttons Canvases Lists Scroll Panes Choices
First Button
public Button firstButton = new Button(“ Click It ”);
add(firstButton);
Button applet output
Adding few more buttons
import java.awt.*;
import java.applet.*;
public class ButtonApplet extends Applet{
//creating the button component
public Button firstButton = new Button(“One”);
public Button secondButton = new Button(“Two”);
public Button thirdButton = new Button(“Threet”);
public void init( ){
//adding to the applet
add(firstButton); add(secondButton); add(thirdButton); }
}
Why Buttons are in one row?
How to control them?
Layout Managers
Flow Layout GridLayout Border Layout CardLayout GridBagLayout Null layout
The default layout manager
Flow Layout
Public FlowLayout myFlowLayout=new FlowLayout();
setLayout(myFlowLayout)
Flow Layout…cont..
Using Flow Layout constructor 1
import java.awt.; import java.applet.;
public class flowLayoutTest extends Applet{
public FlowLayout myFlowLayout=new FlowLayout(); Button B=new Button(“Click It”);
public void init(){ setLayout(myFlowLayout); add(B); } }