Skip to content
Snippets Groups Projects
Commit 45627a40 authored by Chang Che Hao's avatar Chang Che Hao
Browse files

stroke description changed & eraser bug fixed

parent 121c616c
Branches
Tags
No related merge requests found
...@@ -357,7 +357,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis ...@@ -357,7 +357,7 @@ public class DrawingArea extends JPanel implements MouseMotionListener, MouseLis
/// Eraser is continuously drawing "small white circle" from current point to previous point /// /// Eraser is continuously drawing "small white circle" from current point to previous point ///
case ERASE: case ERASE:
((Ellipse2D) drawing).setFrame(currentPoint.getX(), currentPoint.getY(), 10, 10); ((Ellipse2D) drawing).setFrame(currentPoint.getX(), currentPoint.getY(), eraserSize, eraserSize);
g2.setColor(Color.WHITE); g2.setColor(Color.WHITE);
g2.fill(drawing); g2.fill(drawing);
g2.draw(drawing); g2.draw(drawing);
......
...@@ -21,7 +21,7 @@ public class PaintGUI extends JPanel { ...@@ -21,7 +21,7 @@ public class PaintGUI extends JPanel {
DrawingArea drawingArea; DrawingArea drawingArea;
String[] shapes = {"Freehand", "Line", "Circle", "Rectangle", "Oval", "Eraser", "Text"}; String[] shapes = {"Freehand", "Line", "Circle", "Rectangle", "Oval", "Eraser", "Text"};
String[] strokes = {"Small", "Medium", "Large"}; String[] strokes = {"Thin", "Medium", "Thick"};
String[] eraserSizes = {"Small", "Medium", "Large"}; String[] eraserSizes = {"Small", "Medium", "Large"};
JFrame frame; JFrame frame;
JButton clearBtn, newBtn, openBtn, saveBtn, saveAsBtn; JButton clearBtn, newBtn, openBtn, saveBtn, saveAsBtn;
...@@ -302,13 +302,13 @@ public class PaintGUI extends JPanel { ...@@ -302,13 +302,13 @@ public class PaintGUI extends JPanel {
String strokeChosen = (String) strokeOptions.getSelectedItem(); String strokeChosen = (String) strokeOptions.getSelectedItem();
switch (strokeChosen) { switch (strokeChosen) {
case "Small": case "Thin":
drawingArea.setStroke(3); drawingArea.setStroke(3);
break; break;
case "Medium": case "Medium":
drawingArea.setStroke(6); drawingArea.setStroke(6);
break; break;
case "Large": case "Thick":
drawingArea.setStroke(10); drawingArea.setStroke(10);
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment