From b8f704b160637f00eacf91f563273ad2aafee589 Mon Sep 17 00:00:00 2001 From: tonyinfos Date: Thu, 24 Mar 2016 17:01:28 +0800 Subject: [PATCH 1/5] test --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d61737d..dcc6fde 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ SoftwareStudio Lab4 2016 # 組員二 -姓名: +姓名:潘麗文 -學號: +學號:103062111 #Screenshot From 41366b206ccf25d3c6ff508da8324ea62a75b071 Mon Sep 17 00:00:00 2001 From: SaberYhm Date: Thu, 24 Mar 2016 17:17:06 +0800 Subject: [PATCH 2/5] Added files via upload --- README.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 README.txt diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..8ff6259 --- /dev/null +++ b/README.txt @@ -0,0 +1,18 @@ +# SoftwareStudioLab4 +SoftwareStudio Lab4 2016 + +# 組員一 + +姓名:潘麗文 + +學號:103062111 + +# 組員二 + +姓名:楊翔閔 + +學號:103062124 + +#Screenshot + +![alt tag](/csc.png) \ No newline at end of file From 3faf15c4369fa8450a82ecec96eef4e6942e9c7a Mon Sep 17 00:00:00 2001 From: tonyinfos Date: Thu, 24 Mar 2016 17:18:23 +0800 Subject: [PATCH 3/5] readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dcc6fde..8578632 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ SoftwareStudio Lab4 2016 # 組員一 -姓名: +姓名:楊翔閔 -學號: +學號:103062111 # 組員二 From c82f279653a43bb9aae4356908522422fd6c0a9d Mon Sep 17 00:00:00 2001 From: tonyinfos Date: Thu, 24 Mar 2016 18:27:27 +0800 Subject: [PATCH 4/5] MyJPanel --- bin/MyJPanel.class | Bin 850 -> 1397 bytes src/MyJPanel.java | 62 +++++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/bin/MyJPanel.class b/bin/MyJPanel.class index 12bb52981f027235457453275030034643f8b5a1..d4016f410f1dea18567c41f84fef0ce2f43cc957 100644 GIT binary patch literal 1397 zcmb7D>r&G|7(EMxLR^#Nw-rnP#(JPR=>swhtF&eLj@~zlk)Y^Q1&nNS za%}Tt#d6$W&MQ|umkrZShw74VRfPt6LsiyiD?ZTXhOFgJ182sfm>1B6o|FDZR$!M_8p#z?OTT%Do@sE zYK1>-Cx&|x_wk@Ey z#8XY(N2_677oSVK2<^OgN~O9TQ4knvYc+jyuClCyHt$=7g0clJbO?0>aY1J?obEDK zqhQcRT0{5~Ch<~FFG5T23@jrjvDPf?=s>MYyv6`$p`5 zn>04PeLt@j9i5y2FNhdgar3`WINhVxy0@#OOW}Cao+Tu?w!*Bl@r5Ra>e)pi7+j v7{@eD(TNU;L`x!p4Qz%IZ(0&}Nv|bDo357-!0e!4KEoLk)}nYDzPR-Zi0>W? delta 441 zcmaivy-EW?6otRpT{mX3`PC%;8~>BF5yVc?Xrmw&Lc~&tMVg4Bb)F&QHEb+&LBR*G z6nqq0@$4p;N^I`TJ#)@??|j)0-@bppyaBs}ecL|u_dDIrUDM#!8!dx(aNWMLxMTy; z*c5q#e|B?!c`G$XF;+{m)sGsjG=}Mb6q8oBN7g1%1mP>Wi$Xi1@WfOYK2v^_#bH*pBqL;1GZeK%g*r8tWt2ooPVk Date: Thu, 24 Mar 2016 18:39:37 +0800 Subject: [PATCH 5/5] Added files via upload --- src/Square.java | 117 +++++++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/src/Square.java b/src/Square.java index 96e07a8..bcf7bbf 100644 --- a/src/Square.java +++ b/src/Square.java @@ -1,50 +1,67 @@ -import java.awt.Color; -import java.util.Random; - -public class Square extends Shape { - - private int shapeWidth; - - public Square(int shapeWidth){ - // TODO Constructor - this.shapeWidth = shapeWidth; - } - - - @Override - public Color getRandomColor() { - // TODO Return random color produce from java.util.Random; - // Java 'Color' class takes 3 floats, from 0 to 1. - - // TODO Return color produced by three rgb floats. - return new Color(r, g, b); - } - - @Override - public int getShapeWidth(){ - // TODO Return Square width - return 0; - } - - @Override - public int getShapeHeight(){ - // TODO Return Square height - return 0; - } - - - @Override - public int getCenterX(int mouseX) { - // TODO Input mouse X position and return center X of square - return mouseX - shapeWidth/2; - } - - - @Override - public int getCenterY(int mouseY) { - // TODO Input mouse Y position and return center Y of square - return mouseY - shapeWidth/2; - } - - -} \ No newline at end of file +import java.awt.Color; +//import java.util.Random; + +public class Square extends Shape +{ + + private int shapeWidth; + //private int shapeHeight; + //private int mouseX; + //private int mouseY; + + public Square(int shapeWidth) + { + // TODO Constructor + this.shapeWidth = shapeWidth; + //this.shapeHeight = shapeHeight; + } + + + @Override + public Color getRandomColor() + { + float r, g, b;// TODO Return random color produce from java.util.Random; + //Random ran = new Random(); + + //r = ran.nextFloat(); + //g = ran.nextFloat(); + //b = ran.nextFloat(); + r = (float)Math.random(); + g = (float)Math.random(); + b = (float)Math.random(); + // Java 'Color' class takes 3 floats, from 0 to 1. + + // TODO Return color produced by three rgb floats. + return new Color(r, g, b); + } + + @Override + public int getShapeWidth() + { + // TODO Return Square width + return shapeWidth; + } + + @Override + public int getShapeHeight(){ + // TODO Return Square height + return shapeWidth; + } + + + @Override + public int getCenterX(int mouseX) + { + //this.mouseX = mouseX; + return mouseX - shapeWidth/2; + } + + + @Override + public int getCenterY(int mouseY) + { + //this.mouseY = mouseY; + // TODO Input mouse Y position and return center Y of square + return mouseY - shapeWidth/2; + } +}