Set the first Font object as the font setting of the nine (9) JLabel objects. Set the second Font object nameofJLabe10bj.setFont (nameofFontobj); • Add the JLabel objects to the JFrame. Ex....


Set the first Font object as the font setting of the nine (9) JLabel objects. Set the second<br>Font object<br>nameofJLabe10bj.setFont (nameofFontobj);<br>• Add the JLabel objects to the JFrame. Ex. add(nameofJLabel0bj);<br>• Set<br>nameofJLabe10bj.addMouselistener (this);<br>the<br>font setting of the<br>tenth<br>JLabel<br>object.<br>Ex.<br>as<br>the<br>nine<br>(9)<br>JLabel<br>objects<br>as<br>mouse<br>listeners.<br>Ex.<br>The JFrame should look like this once the program is executed:<br>Number Finder<br>123456789<br>6.5 Construct the five (5) required methods of the Mouselistener interface. The program will not<br>execute if these methods are not complete.<br>mouseClicked<br>mousePressed<br>• mouseReleased<br>• mouseEntered<br>mouseExited<br>Ex. public void mouseClicked(MouseEvent e) { }<br>The program shall:<br>• allow the user to click a number until the secret number is found<br>display a JLabel (the tenth JLabel created earlier) to indicate the result of the guess.<br>Show

Extracted text: Set the first Font object as the font setting of the nine (9) JLabel objects. Set the second Font object nameofJLabe10bj.setFont (nameofFontobj); • Add the JLabel objects to the JFrame. Ex. add(nameofJLabel0bj); • Set nameofJLabe10bj.addMouselistener (this); the font setting of the tenth JLabel object. Ex. as the nine (9) JLabel objects as mouse listeners. Ex. The JFrame should look like this once the program is executed: Number Finder 123456789 6.5 Construct the five (5) required methods of the Mouselistener interface. The program will not execute if these methods are not complete. mouseClicked mousePressed • mouseReleased • mouseEntered mouseExited Ex. public void mouseClicked(MouseEvent e) { } The program shall: • allow the user to click a number until the secret number is found display a JLabel (the tenth JLabel created earlier) to indicate the result of the guess. Show "Try again." if the guess is wrong. Otherwise, show "Correct!" and the number of guess attempts. See screenshots below. Number Finder 123456789 Try again.
Number Finder<br>123456789<br>Correct! 9 attempt(s)<br>6.6 In the mouseClicked method, create multiple if-else statements to accomplish the program flow.<br>See example below.<br>if (e.getSource()==name0fLabel0bj)<br>{<br>//events that will occur when the JLabel object is clicked<br>}<br>Here are some of the methods which you may find useful:<br>• getText() – to retrieve the current text of the JLabel<br>Syntax: nameofJLabel0bj.getText().equals(name0fAnother);<br>• setEnabled() – to enable or disable the JLabel<br>Syntax: nameofJLabel0bj.setEnabled(booleanValue);<br>• tostring() - to convert an integer to String<br>Syntax: Integer.tostring(name0fIntVar);<br>

Extracted text: Number Finder 123456789 Correct! 9 attempt(s) 6.6 In the mouseClicked method, create multiple if-else statements to accomplish the program flow. See example below. if (e.getSource()==name0fLabel0bj) { //events that will occur when the JLabel object is clicked } Here are some of the methods which you may find useful: • getText() – to retrieve the current text of the JLabel Syntax: nameofJLabel0bj.getText().equals(name0fAnother); • setEnabled() – to enable or disable the JLabel Syntax: nameofJLabel0bj.setEnabled(booleanValue); • tostring() - to convert an integer to String Syntax: Integer.tostring(name0fIntVar);
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here