📄 sillybasketball.java
字号:
import objectdraw.*;// program that displays how many times the mouse has been clickedpublic class SillyBasketBall extends WindowController{ // the Text object which displays the count private Text display; // the oval that represent the hoop private FramedOval hoop; // the number of points private int score; // initialize the counter and the text message public void begin() { score = 0; display = new Text("Take a shot.", 0, 350, canvas); display.setFontSize(16); display.move( (canvas.getWidth()-display.getWidth())/2, 0 ); hoop = new FramedOval( (canvas.getWidth()-100)/2, 50, 100, 60, canvas); } // increment the counter and update the text if player scores public void onMouseRelease(Location point) { score = score + 2; display.setText("You have scored " + score + " points."); display.moveTo( (canvas.getWidth()-display.getWidth())/2, 350 ); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -