Experiment No 9
Experiment No 9
Date:
CO mapped: CO-5
Objectives:
Background:
Practical questions:
1. Write a program that can dynamically change the font of a text in a label displayed on
a stack pane. The text can be displayed in bold and italic at the same time. You can
select the font name or font size from combo boxes, as shown in Figure. The available
font names can be obtained using Font.getFamilies(). The combo box for the font size
is initialized with numbers from 1 to 100.
1. Write a program that displays a moving text, as shown in Figure. The text moves from
left to right circularly. When it disappears in the right, it reappears from the left. The
text freezes when the mouse is pressed and moves again when the button is released.
3. Create animation in Figure to meet the following requirements:
■ Get the number of iamges and image’s file-name prefix from the user. For example, if
the user enters n for the number of images and L for the image prefix, then the files are
L1.gif, L2.gif, and so on, to Ln.gif. Assume that the images are stored in the image
directory, a subdirectory of the program’s class directory. The animation displays the
images one after the other.
■ Allow the user to specify an audio file URL. The audio is played while the animation
runs.
1. How does event handling work in Java, and what is the event-driven programming
model?
2. What is the role of the java.awt.event and javafx.event packages in Java event
handling?
3. Explain: MouseEvent, KeyEvent, ActionEvent
4. What are the primary libraries or frameworks for creating animations in Java, and
which one do you prefer?
5. How to set the cycle count of an animation to infinite?
Suggested Reference:
1. https://www.tutorialspoint.com/java/
2. https://www.geeksforgeeks.org/
3. https://www.w3schools.com/java/
4. https://www.javatpoint.com/