Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fill in all 20 blanks of the following program. You only have to write the numbe

ID: 3917928 • Letter: F

Question

Fill in all 20 blanks of the following program. You only have to write the number and your answer. The program is implemented to get a character from keyboard and display the character where the mouse points.

import java.awt.*;
import java.awt.event.*; import javax.___1________.*;

public class Question5 extends ______2_________ { private DisplayPanel panel = new _____3___________();

public Question5() {
add(______4____, BorderLayout.CENTER); panel.setFocusable(
true);

}

/** Main method */

public static void main(String[] args) {
JFrame frame =
new _____5_____________(); frame.setTitle("Question5 ");
frame._____6_______(
300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(__7_____); // Center the frame frame.setVisible(___8________);

}

class DisplayPanel extends _____9________ { private int x = 20;
private int y = 20;
private char keyChar = ' '; // Default key

public DisplayPanel() {
// Add key listener using key adapter this.addKeyListener(new _______10_____________ () {

public void keyPressed(_____11________ e) { keyChar = e.getKeyChar();
____12_______();
//call paintComponent method

} });

// Add mouse motion listener using a mouse adapter

this.addMouseMotionListener(new _____13_________() { public void mouseMoved(____14_________ e) {

x = e.getX();
y = e.__15_____();
____16_______();
//call paintComponent method

} });

} //end of DisplayPanel constructor

@Override
protected void paintComponent(____17________ g) { ____18_____.paintComponent(____19____);

g.setFont(new Font("TimesRoman", Font.PLAIN, 24));

g.drawString(String.valueOf(____20_____), x, y); //draw the input character at new mouse location }

}
}
//end of DisplayPanel class

Explanation / Answer

Answer:------------

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote