This commit is contained in:
2022-05-01 23:24:00 +08:00
parent 0b354c7561
commit 053113577f
16 changed files with 493 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
public class MyPanel extends JPanel {
@Override
protected void paintComponent(Graphics g) {
// clean the panel
super.paintComponent(g);
// draw
g.setColor(Color.RED);
g.drawString("hello", (int) Math.round(Math.random() * this.getWidth()),
(int) Math.round(Math.random() * this.getHeight()));
}
}