I have an applet and I want you guys to tell me what I should add/improve. You see I want to get into this AP Computer Science class guaranteed. This is my final project (already finished everything else) and I know I will get 100% but I want to wow the teachers. I have a 98% in the class but I just want to be sure to get into AP Computer Science.
Project:
-Option 1
Write a program to count the number of mouse clicks on a button within a frame. (For an extra challenge, have a yes or no question on the screen and have it count the votes.)
-Option 2
Write a program that will print the position of the mouse when it is clicked within a frame. (For an extra challenge, have the mouse click event cause a change in color of the applet screen.)
-Option 3
Write a program that has three buttons, each displaying a different text that when pressed will display the text on the button in a text box. (For an extra challenge, have the user choose the color of the displayed text as well).
Applet:
Project:
-Option 1
Write a program to count the number of mouse clicks on a button within a frame. (For an extra challenge, have a yes or no question on the screen and have it count the votes.)
-Option 2
Write a program that will print the position of the mouse when it is clicked within a frame. (For an extra challenge, have the mouse click event cause a change in color of the applet screen.)
-Option 3
Write a program that has three buttons, each displaying a different text that when pressed will display the text on the button in a text box. (For an extra challenge, have the user choose the color of the displayed text as well).
Applet:
Code
/*
* This is Option two for this project
* It changes color when clicked and displays the location of where the mouse clicked
*/
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.JOptionPane;
public class Music extends Applet implements MouseListener{
public void mouseReleased(MouseEvent le){
//do nothing
}
public void mouseEntered(MouseEvent le){
//do nothing
}
public void mousePressed(MouseEvent le){
//do nothing
}
public void mouseExited(MouseEvent le){
JOptionPane.showMessageDialog(null, "Mouse Exited",
"Message", JOptionPane.PLAIN_MESSAGE);
getMouseMotionListeners(); //warn user
}
public void init(){
addMouseListener(this); //start getting mouse input
setBackground(Color.yellow); //set background color
}
public void paint(Graphics g){
if(getBackground()==Color.yellow){
g.drawString("Click to change color!",20,20); //tells user what to do
Image img = getImage(getDocumentBase(), "pic.png");
g.drawImage(img, 20, 40, this);
}
if(getBackground()==Color.RED){
g.drawString("Mouse Click Position: "+getMousePosition(), 20, 20); //change text when mouse is clicked
Image img2 = getImage(getDocumentBase(), "pic2.png");
g.drawImage(img2, 20, 40, this);
}
}
public void mouseClicked(MouseEvent e){
if(getBackground()==Color.yellow){ //only display message if it changed from yellow.
setBackground(Color.RED);
JOptionPane.showMessageDialog(null, "Color Changed",
"Message", JOptionPane.INFORMATION_MESSAGE);
}
}
}

![[Image: OLA3irL.gif]](https://i.imgur.com/OLA3irL.gif)


![[Image: 4f2d8e8a917f4be2a829a0405325e880.png]](https://imgh.us/4f2d8e8a917f4be2a829a0405325e880.png)