📄 mypanel.java~4~
字号:
package coordinate;import java.awt.*;import javax.swing.JPanel;import java.awt.geom.*;/** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */public class MyPanel extends JPanel { BorderLayout borderLayout1 = new BorderLayout(); private Ellipse2D.Double circle = new Ellipse2D.Double(10, 10, 350, 350); private GradientPaint gradient = new GradientPaint(0, 0, Color.red, 175, 175, Color.yellow,true); public MyPanel() { try { jbInit(); } catch(Exception ex) { ex.printStackTrace(); } } void jbInit() throws Exception { this.setLayout(borderLayout1); } public void paintComponent(Graphics g) { clear(g); Graphics2D g2d = (Graphics2D)g; g2d.setPaint(gradient); g2d.fill(circle); g2d.setColor(Color.blue); g2d.draw(circle); g2d.translate(180.0 , 180.0); for (int i=0; i<1; i++) { // Rotate the coordinate system around current // origin, which is at the center of the circle. g2d.rotate(16*Math.PI/16.0); g2d.setFont(new Font("TimesRoman",Font.PLAIN,100-i*2)); if (i%2 == 0) g2d.setPaint(Color.black); else g2d.setPaint(Color.white); g2d.drawString("Java", 0, 0); } } protected void clear(Graphics g) { super.paintComponent(g); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -