import java.awt.*
import java.awt.geom.*
import javax.swing.JFrame
public class picture extends JFrame {
public picture(){
//如果你想让标题栏消失你可以不注释这条语句
// this.setUndecorated(true)
setLocation(50, 50)
setResizable(false)
setSize(535, 412)
setVisible(true)
}
public void paint(Graphics g) {
//把背景设成白色
setBackground(Color.WHITE)
//把画笔设成2D的这样画笔的粗细可以改变
Graphics2D g_2d =(Graphics2D)g
//设置画笔大小
BasicStroke bs = new BasicStroke(4,BasicStroke.CAP_SQUARE,BasicStroke.JOIN_ROUND)
g_2d.setStroke(bs)
//画圆
g_2d.setColor(Color.ORANGE)
Ellipse2D oval = new Ellipse2D.Double(430, 50, 80, 80)
g_2d.draw(oval)
//握答画房子
g_2d.setColor(Color.BLACK)
Line2D line1=new Line2D.Double(120,140,40,220)
Line2D line2=new Line2D.Double(120,140,200,220)
Line2D line3=new Line2D.Double(40,222,200,222)
g_2d.draw(line1)
g_2d.draw(line2)
g_2d.draw(line3)
Rectangle2D rect = new Rectangle2D.Double(40,222,162,100)
g_2d.draw(rect)
//花小草
g_2d.setColor(Color.green)
Line2D line4=new Line2D.Double(240,270,220,320)
Line2D line5=new Line2D.Double(240,270,250,315)
Line2D line6=new Line2D.Double(250,315,260,270)
Line2D line7=new Line2D.Double(260,270,275,320)
Line2D line8=new Line2D.Double(275,320,280,270)
Line2D line9=new Line2D.Double(280,270,300,314)
Line2D line10=new Line2D.Double(300,314,315,270)
Line2D line11=new Line2D.Double(315,270,325,330)
g_2d.draw(line4)
g_2d.draw(line5)
g_2d.draw(line6)
g_2d.draw(line7)
g_2d.draw(line8)
g_2d.draw(line9)
g_2d.draw(line10)
g_2d.draw(line11)
}
public static void main(String[] args) {
new picture()
}
}
//你自己对这座标改段弯慧改由于时间有限只能这样了不闹芦如你的图好看哪弄不懂可以密我896182794
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)