Set the first Font object as the font setting of the nine (9) JLabel objects. Set the second Font object as the nameOfJLabe10bj.setFont (nameofFontobj); font setting of the tenth JLabel object. Ex. Add the JLabel objects to the JFrame. Ex. add(nameofJLabel0bj); JLabel (9) nameOfJLabe10bj.addMouselistener(this); Set the nine objects as mouse listeners. Ex. The JFrame should look like this once the program is executed: Number Finder 123456789 struct the five (5) required methods of the Mouselistener interface. The program will not cute if these methods are not complete. • mouseClicked • mousePressed mouseReleased • mouseEntered • mouseExited public void mouseClicked(MouseEvent e) { } program shall:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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.
Transcribed Image 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
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);
Transcribed Image 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);
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY