Excerpt from Description of Exercise

Objective: To gain experience using Swing components and listeners.

The Scenario.

You will write a program that manipulates text through a JSlider, a couple of JLabels, a pop-up menu (JComboBox), a JTextField, and a JButton.

A picture of the screen can be seen below:

The center of the screen will be occupied by the canvas. Below the canvas there should be a JTextField where the user can enter text to be displayed on the canvas, and two components used to select a font and remove text from the screen. In addition, there is a JSlider used to control the font size, and a JLabel showing the current font size. When the user clicks anywhere on the canvas, your program should display the text showing in the JTextField in the selected font and font size at the place where the user clicked. When the user adjusts the JSlider or selects a new font with the JComboBox menu, the last text placed on the canvas should change its size or font accordingly. If the JButton is pressed, the last text placed on the canvas should be removed.

Handouts Describing the Exercise

Student Resources for Lab Exercise

Sample solutions