You are on page 1of 4

Ramon Magsaysay Memorial College

LABORATORY EXERCISE
nd
2 SEMESTER: AY: 2021 – 2022
Name: ________________________ Schedule: __________________________ Score: ________
Subject: IPT101 Int. Prog. & Tech. 1 Instructor: _________________________ Date: _________

LABORATORY EXERCISE 1
JOptionPane: Easy Input, Output with Dialog Box
Learning Objectives
 To determine how JOptionPane use in input and output of information.
 To understand the use of JOptionPane f Java NetBeans.

Prerequisite student experiences and knowledge


Students should have an idea how NetBeans application intended for. This lesson is written
for those who have knowledge and idea how to navigate and use the Java NetBeans.

Background
NetBeans have similarities of GUI (Graphical User Interface) to the other application, their
differences are their architecture and usage, because NetBeans are normally use for Java
Development.

Materials/Resources
 PC/Internet
 Pen
 Java (NetBeans / Alice)
 Web Browser (Internet Explorer, Mozilla, Google Chrome, and Etc.)  Word-processing
program

Laboratory Activity

Instructions: Perform the following steps.


1. Start the program NetBeans
2. Then, run the syntax

Import javax.swing.JOptionPane;

Public class Sample {


Public static void main( String args[])
{
JOptionPane.showMessageDialog(null, “Hello World”);
System.exit(0
}
}
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
nd
2 SEMESTER: AY: 2021 – 2022
Name: ________________________ Schedule: __________________________ Score: ________
Subject: IPT101 Int. Prog. & Tech. 1 Instructor: _________________________ Date: _________

3. Fix if the program is not running


4. Display the result.
5. Print the result in the page provided.

QUESTIONS

1. What is the role of “Import javax.swing.JOptionPane” in the syntax


given?
- the role of the syntax given is, it is needed for dialog box

2. Why the syntax ends up with “System.exit(0)”? what is the


purpose of it?

- because it is used to indicate successful termination.

3. Base of the given pseudocode, what did you observe? And why?

- Base of the given pseudocode, i observe that the program will not
run just because it need to check it and analyze the program so
that the placement of variables are in the right place so that it will
run.
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
nd
2 SEMESTER: AY: 2021 – 2022
Name: ________________________ Schedule: __________________________ Score: ________
Subject: IPT101 Int. Prog. & Tech. 1 Instructor: _________________________ Date: _________

Output / Results
Ramon Magsaysay Memorial College
LABORATORY EXERCISE
nd
2 SEMESTER: AY: 2021 – 2022
Name: ________________________ Schedule: __________________________ Score: ________
Subject: IPT101 Int. Prog. & Tech. 1 Instructor: _________________________ Date: _________

Conclusion

JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs
them of something. The JOptionPane class is used to provide standard dialog boxes such as message
dialog box, confirm dialog box and input dialog box. These dialog boxes are used to display information
or get input from the user.

You might also like