⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shape.java~5~

📁 java jsp编程源代码
💻 JAVA~5~
字号:
import java.awt.*;import java.awt.event.*;import java.awt.geom.*;import java.awt.image.*;import javax.swing.*;public class shape extends JFrame {    public shape() {      super("drawing 2d shapes");    }    public void paint (Graphics g ){      super.paint(g);      Graphics2D graphics2d = (Graphics2D) g;      graphics2d.setPaint(new GradientPaint(5,30,Color.blue,35,100,Color.yellow,true));      graphics2d.fill(new Ellipse2D.Double(5,30,65,100));      graphics2d.setPaint(Color.red);      graphics2d.setStroke(new BasicStroke(10.0f));      graphics2d.draw(new Rectangle2D.Double(80,30,65,100));      BufferedImage bufferedimage = new BufferedImage(10,10,BufferedImage.TYPE_INT_REB);     Graphics2D graphics =bufferedimage.createGraphics();     graphics.setColor(Color.yellow);     graphics.setfillRect(0,0,10,10);     graphics.setColor(color.black);     graphics.drawRect(1,1,6,6);     graphics.setColor(color.blue);     graphics.fillRect(1,1,3,3);     graphics.setColor(color.red);     graphics.fillRect(4,4,3,3);     graphics2d.setPaint(new TexturePaint(bufferedimage,new Rectangle(10,10)));     graphics2d.fill(new RoundRectangle2D.Double(155,30,75,50,50));     graphics2d.setPaint(color.white);     graphics2d.setStroke(new BasicStroke(6.0f));     graphics2d.draw(new Arc2D.Double(240,30,75,100,0,270,Arc2D.PIE));     graphics2d.setPaint(color.green);     graphics2d.draw(new Line2D.Double(395,30,320,150));     float dashes[]= {10,2};     graphics2d.setPaint(color.yellow);     graphics2d.setStroke(new BasicStroke(4,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,10,dashes,0));    graphics2d.draw(new Line2D.Double(320,30,395,150));    }    public static void main(String args[]) {        shape app= new shape();        app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        app.setSize(425,160);        app.setVisible(true);    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -