Question: Use java programming for the following questions to have the solutions ready within today Jan 3 2020 at or before 8:00PM GMT+8 time zone: Question

Use java programming for the following questions to have the solutions ready within today Jan 3 2020 at or before 8:00PM GMT+8 time zone:

Question 8

The first few lines of a class PrimeNumber are shown below:

public class PrimeNumber extends JFrame implements ActionListener { private JLabel label = new JLabel("2");

private JButton button = new JButton("Next Prime");

The expected appearance of the GUI, which includes a label and a button, is shown on the right and the layout manager is the FlowLayout manager.

  1. Write the constructor PrimeNumber() to generate the GUI and add the object itself as the action listener of the button. When the window is closed, the program should terminate.
  1. When the button is pressed, the next (larger) prime number is displayed on the label. Write the method actionPerformed() to perform this action.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!