Menu

Use Java Programming Following Questions Solutions Ready Within Today Jan 3 2020 8 00pm Gm Q43785328

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

Question 8

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

public classPrimeNumber extends JFrame implements ActionListener { privateJLabel label = new JLabel(“2”);

private JButton button = newJButton(“Next Prime”);

Z

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

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

Expert Answer


Answer to Use java programming for the following questions to have the solutions ready within today Jan 3 2020 at or before 8:00PM…

OR