Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

Applet

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:
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);
        }
        }
    }
Create a Label at the bottom which changes to whether or not the mouse is inside or outside the box. The pop-up window is annoying as hell.

What grade are you in?

Click position also is "Null". Might wanna look into that !
(Apr 11, 2013 02:19 PM)Arete Wrote:  Create a Label at the bottom which changes to whether or not the mouse is inside or outside the box. The pop-up window is annoying as hell?

What grade are you in? I'm in grade 12. Although I program at high university levels I think you can do a lot more to "wow" the teachers.

Click position also is "Null". Might wanna look into that !

1/2 of the time it is null other half it works. IDK what is wrong.
I am in 9th grade. 😁
Thanks for the advice. 🤝
(Apr 11, 2013 02:28 PM)Johndoe27328 Wrote:  1/2 of the time it is null other half it works. IDK what is wrong.
I am in 9th grade. 😁
Thanks for the advice. 🤝

Bahahahhahahaahah
Okay, do all of the above 3.... When I was in 9th grade it was assumed that you could do this within 3 minutes on a piece of paper....
[Image: OLA3irL.gif]

OMC: oP6nQvkNjw913rnj5aYMJk1cJxRMMhcvw3
BTC: 1Hga28EVqVgmJmgjhawZvcrnQEWxgAKyqz
I'm doing the same project. Do you happen to have option 1 available? I'm having so much trouble with this project😟
0 "wows" will be given, maybe if you're from Kazahstan or something and computers are rarity, so writing some bullshit Java code will make your teachers drop their jaws and masturbate to your IDE successfully running that shit.
[Image: 4f2d8e8a917f4be2a829a0405325e880.png]
(May 9, 2017 09:49 AM)Bri813 Wrote:  I'm doing the same project. Do you happen to have option 1 available? I'm having so much trouble with this project😟

You're asking a question to a closed account, kappa.

(May 9, 2017 10:20 AM)SIM-429621 Wrote:  0 "wows" will be given, maybe if you're from Kazahstan or something and computers are rarity, so writing some bullshit Java code will make your teachers drop their jaws and masturbate to your IDE successfully running that shit.

This is from 2013 lol
(May 9, 2017 12:31 PM)Stealth™ Wrote:  You're asking a question to a closed account, kappa.


This is from 2013 lol

And here I was thinking that applets just became a thing somewhere in some jungle village in Cambodia after they discovered brand new browser called Internet Explorer 6. I need to start paying attention to dates.
[Image: 4f2d8e8a917f4be2a829a0405325e880.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by Quality_k1nGMay 26, 2018 09:20 AM 1 120 May 26, 2018 09:20 AM
Last Post: .kr.
[C#] by passwordsApr 19, 2018 07:30 PM 2 168 Apr 19, 2018 07:30 PM
Last Post: gigajew
[Java] by mariusz79132Jul 12, 2016 11:34 PM 4 197 Jul 12, 2016 11:34 PM
Last Post: jimbell1954