没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
//#8.15
//#filename: ShapeMain.java
import java.awt.image.*;
import java.awt.Frame;
import java.io.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.Component;
public class ShapeMain extends Frame implements ActionListener,MouseListener,MouseMotionListener{
int x,y,x1,y1,x2,y2,width,height;
boolean isFirstPoint = true;
//初始化开始画的是线
int drawType = PaintingGround.LINE;
//初始化开始不是填充
boolean isFill = false;
//添加控件
ButtonGroup btg = new ButtonGroup();
Button btLine = new Button("线",true);
Button btRectangle = new Button("矩形");
Button btRound = new Button("圆");
Button btEllipse = new Button("椭圆");
Button tbFillState = new Button("填充");
Button button3 = new Button("文本操作");
Button button2 = new Button("清除");
Button button1 = new Button("选择颜色");
Panel buttonPanel = new Panel();
//#filename: ShapeMain.java
import java.awt.image.*;
import java.awt.Frame;
import java.io.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.Component;
public class ShapeMain extends Frame implements ActionListener,MouseListener,MouseMotionListener{
int x,y,x1,y1,x2,y2,width,height;
boolean isFirstPoint = true;
//初始化开始画的是线
int drawType = PaintingGround.LINE;
//初始化开始不是填充
boolean isFill = false;
//添加控件
ButtonGroup btg = new ButtonGroup();
Button btLine = new Button("线",true);
Button btRectangle = new Button("矩形");
Button btRound = new Button("圆");
Button btEllipse = new Button("椭圆");
Button tbFillState = new Button("填充");
Button button3 = new Button("文本操作");
Button button2 = new Button("清除");
Button button1 = new Button("选择颜色");
Panel buttonPanel = new Panel();
PaintingGround paintingGround = new PaintingGround();
//Main Method
public static void main(String[] args) {
//设置显示外观
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception e) {
e.printStackTrace();
}
new ShapeMain();
}
//构造函数
public ShapeMain() {
//控件添加到控件组中
btg.add(btLine);
btg.add(btRectangle);
btg.add(btRound);
btg.add(btEllipse);
buttonPanel.add(btLine);
buttonPanel.add(btRectangle);
buttonPanel.add(btRound);
buttonPanel.add(btEllipse);
buttonPanel.add(tbFillState);
//设置容器及容器的整体布局
Container cp = this.getContentPane();
//Main Method
public static void main(String[] args) {
//设置显示外观
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception e) {
e.printStackTrace();
}
new ShapeMain();
}
//构造函数
public ShapeMain() {
//控件添加到控件组中
btg.add(btLine);
btg.add(btRectangle);
btg.add(btRound);
btg.add(btEllipse);
buttonPanel.add(btLine);
buttonPanel.add(btRectangle);
buttonPanel.add(btRound);
buttonPanel.add(btEllipse);
buttonPanel.add(tbFillState);
//设置容器及容器的整体布局
Container cp = this.getContentPane();
剩余8页未读,继续阅读
资源评论
- 屌丝中的程序猿2013-10-25不能发射炮弹啊。。
- thyhates2014-11-27看不懂,是我太笨了吗
- qq_205662092015-06-14还行,不过没有我要的功能
- meemooon2014-10-10应该有用哦多谢了~
- h2689652020-06-24太不行了,全是报错
tuyingjietutututut
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功