GUI Design

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

  • Into what type of GUI component will the user enter the Fahrenheit temperature?
    • Into a JTextField.
  • What type of GUI component will display the result?
    • Another JTextField.

Swing has other components that might be appropriate for input and display of output, but for now, let us use JTextFields .

GUI Design

GUI of the application

The user enters text (a String) into the Fahrenheit text field. The string will be converted into int format. We'll look at this this later.

This is similar to the application of the previous chapter; the GUI consists of JLabels and JTextFields placed into a JFrame.

QUESTION 4:

Which components need a listener?