Last active
August 29, 2015 14:02
-
-
Save teamvista/775192fa38c6dca1320b to your computer and use it in GitHub Desktop.
meh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package House; | |
import java.applet.Applet; | |
import java.awt.*; | |
import java.awt.event.MouseEvent; | |
import java.awt.event.MouseListener; | |
import static java.awt.Color.darkGray; | |
import static java.awt.Color.lightGray; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: DanielJ3 | |
* Date: 6/2/14 | |
* Time: 1:30 PM | |
*/ | |
@SuppressWarnings("unused") | |
public class ThisOldHouse extends Applet implements MouseListener { | |
private static final long serialVersionUID = 1L; | |
// Valid coordinates: (0,0) to (639,479) | |
public int displayWidth = 640; | |
public int displayHeight = 480; | |
int xLoc, yLoc; | |
Color skyBlue = new Color(135, 206, 235); | |
Color lightSpruce = new Color(114, 84, 51); //unused | |
Color medSpruce = new Color(89, 66, 41); //unused | |
Color darkSpruce = new Color(64, 48, 31); //unused | |
Color iridium = new Color(61, 60, 58); | |
Color slateGray = new Color(99, 103, 108); //unused | |
Color basalt = new Color(109, 109, 111); | |
Color shale = new Color(189, 191, 186); | |
Color lightForestGreen = new Color(108,178,108); | |
Color forestGreen = new Color(34,139,34); //unused | |
Color forestGreenDark = new Color(23,93,23); //unused | |
Color cerulean = new Color(5,184,204); //unused | |
Color sunshineYellow = new Color(254,237,55); | |
public void init() { | |
resize(displayWidth, displayHeight); | |
setBackground(skyBlue); | |
addMouseListener(this); | |
} | |
@Override | |
public void mouseClicked(MouseEvent mouseEvent) { | |
xLoc = mouseEvent.getX(); | |
yLoc = mouseEvent.getY(); | |
System.out.println("Coordinates: "+xLoc+", "+yLoc); | |
} | |
@Override | |
public void mousePressed(MouseEvent mouseEvent) {} | |
@Override | |
public void mouseReleased(MouseEvent mouseEvent) {} | |
@Override | |
public void mouseEntered(MouseEvent mouseEvent) {} | |
@Override | |
public void mouseExited(MouseEvent mouseEvent) {} | |
public void paint (Graphics g) { | |
g.setColor(darkGray); | |
g.drawLine(displayWidth/2,0,displayWidth/2,displayHeight); | |
g.drawLine(0,displayHeight/2,displayWidth,displayHeight/2); | |
g.setColor(lightGray); | |
g.drawLine(displayWidth/3,0,displayWidth/3,displayHeight); | |
g.drawLine((displayWidth*2)/3,0,(displayWidth*2)/3,displayHeight); | |
g.drawLine(0,displayHeight/3,displayWidth,displayHeight/3); | |
g.drawLine(0,(displayHeight*2)/3,displayWidth,(displayHeight*2)/3); | |
g.setColor(lightForestGreen); | |
g.fillRect(0, 120, displayWidth, 320); | |
g.setColor(sunshineYellow); | |
g.fillOval(534,-80,160,160); | |
g.setColor(basalt); | |
g.fillRect(0,379,displayWidth,displayHeight-1); | |
g.fillRect(280,280,80,100); | |
g.setColor(shale); | |
for (int i=5; i<=displayWidth; i+=50) { | |
g.fillRect(i,425,30,10); | |
} | |
g.setColor(lightSpruce); | |
g.fillRect(213,160,214,160); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment