📄 shapespanel.java
字号:
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.awt.event.*;
public class ShapesPanel extends JPanel
{
public void paintComponent(Graphics g) {
super.paintComponent(g);
int width = getWidth();
int height = getHeight();
g.setColor(Color.white);
g.fillRect(0, 0, width, height);
//draw the ciclier
int radius = width/10;
g.setColor(Color.green);
g.fillOval(3*width/10, 3*height/10, radius, radius);
//draw the Rect
g.setColor(Color.orange);
g.fillRect(6*width/10, 7*height/10, width/10, 2*height/10);
//draw the line
g.setColor(Color.black);
g.drawLine(40,40,200,40) ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -