Question: Please answer the below question in Java, thank you. Question 8 The first few lines of a class PrimeNumber are shown below: public class PrimeNumber

Please answer the below question in Java, thank you. Question 8 The first few lines of a class PrimeNumber are shown below: public class PrimeNumber extends JFrame implements ActionListener { private JLabel label private JButton button = new JButton ("Next Prime"); - new JLabel ("2"); 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. Next Prime Write the constructor PrimeNumber () to generate the GUI and add the object itself as the (a) action listener of the button. When the window is closed, the program should terminate. [2 marks] (b) When the button is pressed, the next (larger) prime number is displayed on the label. Write the method action Performed () to perform this action. [3 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
