Permalink
Browse files

Go fuck yourself

  • Loading branch information...
tostangs committed Oct 11, 2017
1 parent e36cec3 commit 6aee9175abb4f7a69d86c48a2d54bfae8a118e28
View

This file was deleted.

Oops, something went wrong.
View
Binary file not shown.
@@ -0,0 +1,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252"/>
<body>
<applet code=Assignment7.class width="200" height="200" >
</applet>
</body>
</html>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
@@ -12,7 +12,7 @@
public class Assignment7 extends JApplet {
public static void main(String[] args) {}
// public static void main(String[] args) {}
public void init() {
// create a WholePanel object and add it to the applet
View
@@ -15,7 +15,7 @@
private Color currentColor;
private Shape shape;
private JRadioButton filled;
private int radius;
private int radius, selInd, count = 0;
private boolean fill;
private CanvasPanel canvas;
private JPanel topLower, topUpper, topPanel;
@@ -44,7 +44,7 @@ public WholePanel() {
undo.addActionListener(new ButtonListener());
// Breaking the Panels down into two separate parts
topUpper = new JPanel(new BorderLayout());
topUpper = new JPanel(new BorderLayout());
topUpper.add(tut, BorderLayout.WEST);
topUpper.add(undoWarn, BorderLayout.EAST);
topLower = new JPanel(new GridLayout(1,0));
@@ -59,6 +59,9 @@ public WholePanel() {
canvas = new CanvasPanel();
PointListener p = new PointListener();
canvas.addMouseListener(p);
JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, canvas);
setLayout(new BorderLayout());
@@ -77,7 +80,7 @@ public void paintComponent(Graphics page) {
shapeList.get(i).draw(page);
}
//to be filled
}
} //end of CanvasPanel class
@@ -89,11 +92,13 @@ public void paintComponent(Graphics page) {
public void actionPerformed(ActionEvent event) {
if(event.getSource() == undo) {
if(shapeList.size() != 0) {
System.out.println(shapeList.size());
undoWarn.setText("");
int toRemove = shapeList.size();
Shape removed = (Shape) shapeList.get(toRemove);
int toRemove = shapeList.size()-1;
Shape removed = shapeList.get(toRemove);
removeList.add(removed);
shapeList.remove(toRemove);
canvas.repaint();
} else {
undoWarn.setText("Nothing to undo");
}
@@ -117,13 +122,17 @@ public void actionPerformed(ActionEvent event) {
Object o = (Object) event.getSource();
StyleSheet s = new StyleSheet();
if(o == op) {
String sel = (String) op.getSelectedItem();
int sel = (Integer) op.getSelectedIndex();
switch(sel) {
case "Circle":
case 0:
shape = (Circle) shape;
selInd = sel;
System.out.println("Circle Selected");
break;
case "Square":
case 1:
shape = (Square) shape;
selInd = sel;
System.out.println("Square selected");
break;
}
@@ -144,27 +153,39 @@ public void actionPerformed(ActionEvent event) {
private int x, y;
//in case that a user presses using a mouse,
//record the point where it was pressed.
public void mousePressed(MouseEvent event) {
System.out.println("Here");
public void mousePressed(MouseEvent event) {}
public void mouseReleased(MouseEvent event) {}
public void mouseClicked(MouseEvent event) {
System.out.println("Here " + count);
x = event.getX();
y = event.getY();
canvas.repaint();
if(shape != null && currentColor != null) {
if(shape.getClass().getName() == "Circle") {
if(selInd == 0) {
System.out.println(shapeList.size());
System.out.println(shape.getClass().getName());
System.out.println("Circle");
shape = new Circle(x, y, radius, radius, currentColor, fill);
shapeList.add(shape);
} else if(shape.getClass().getName() == "Square") {
count++;
System.out.println("count: " + count);
} else if(selInd == 1) {
System.out.println("Square");
shape = new Square(x, y, radius, radius, currentColor, fill);
shapeList.add(shape);
count++;
System.out.println("count: " +count);
}
} else {
shape = new Circle(x, y, 10, 10, Color.BLACK, false);
count++;
System.out.println("count: " + count);
}
canvas.repaint();
}
public void mouseReleased(MouseEvent event) {}
public void mouseClicked(MouseEvent event) {}
public void mouseEntered(MouseEvent event) {}
public void mouseExited(MouseEvent event) {}

0 comments on commit 6aee917

Please sign in to comment.