0% found this document useful (0 votes)
108 views2 pages

Lab Manual 19

The document discusses GUI (graphical user interface) basics in Java programming. It defines GUI as a visual display that allows users to interact with applications through graphical components like buttons and windows. To create GUIs in Java, programmers can use either Swing or JavaFX, with JavaFX featuring new graphic components, terminology, and support for web features. A GUI typically includes input controls, informational elements, and navigational elements to display in applications. The document provides a simple login page example in Java Swing and links to additional online resources for learning more about GUI programming in Java and JavaFX.

Uploaded by

Anindita Mishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views2 pages

Lab Manual 19

The document discusses GUI (graphical user interface) basics in Java programming. It defines GUI as a visual display that allows users to interact with applications through graphical components like buttons and windows. To create GUIs in Java, programmers can use either Swing or JavaFX, with JavaFX featuring new graphic components, terminology, and support for web features. A GUI typically includes input controls, informational elements, and navigational elements to display in applications. The document provides a simple login page example in Java Swing and links to additional online resources for learning more about GUI programming in Java and JavaFX.

Uploaded by

Anindita Mishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

North South University

Department of Electrical and Computer Engineering


CSE 215L: Programming Language II Lab
Lab – GUI

Objective:
● To understand GUI basics

GUI stands for Graphical User Interface, a term used not only in Java but in all programming
languages that support the development of GUIs.
A program's graphical user interface presents an easy-to-use visual display to the user.
It is made up of graphical components (e.g., buttons, labels, windows) through which the user can
interact with the page or application.
To make graphical user interfaces in Java, use either Swing (older applications) or JavaFX.
JavaFX features an entirely different set of graphic components as well as a new terminology and
has many features that interface with web programming, such as support for Cascading Style
Sheets (CSS), a web component for embedding a web page inside an FX application, and the
functionality to play web multimedia content.
A GUI includes a range of user interface elements — which just means all the elements that display
when you are working in an application. These can include:
• Input controls such as buttons, dropdown lists, checkboxes, and text fields.
• Informational elements such as labels, banners, icons, or notification dialogs.
• Navigational elements, including sidebars, breadcrumbs, and menus.
Simple Login page using java Swing
Login.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Login extends JFrame {
JPanel pane = new JPanel();
JButton pressme = new JButton("Login");
Login() // the frame constructor
{
super("Project Demo"); setBounds(100,100,300,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container con = this.getContentPane(); // inherit main frame
con.add(pane); // JPanel containers default to FlowLayout
pressme.setMnemonic('P'); // associate hotkey to button
pane.add(pressme); pressme.requestFocus();
setVisible(true); // make frame visible
}
public static void main(String args[]) {
new Login();
}
}
To learn more you can follow the following link
1. https://www.cs.utexas.edu/~mitra/csSpring2009/cs313/lectures/GUIComponents.html
2. https://www.codeproject.com/Articles/33536/An-Introduction-to-Java-GUI-
Programming
3. https://www3.ntu.edu.sg/home/ehchua/programming/java/Javafx1_intro.html#:~:text=Ja
vaFX%20is%20a%20set%20of,Microsoft%20Silverlight%20and%20Java%20Applets).
4. https://www3.cs.stonybrook.edu/~pfodor/courses/CSE114/L14-JavaFXBasics.pdf

For more detailed learning about JavaFX you can follow the chapter of 14, 15 and 16 from the
book- Introduction_to_java_programming_by_Y_Daniel_Liang_10th_edition.
You can get the book from the following Link:
https://eduguidehome.files.wordpress.com/2019/02/introduction-to-java-programming-by-y-daniel-liang-
10th-edition.pdf

You might also like