package csu;
import java.awt.Checkbox;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import javax.swing.JSplitPane;
import java.awt.Rectangle;
import javax.swing.JPanel;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import javax.swing.ImageIcon;
import java.awt.event.KeyEvent;
import javax.swing.JSlider;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.Font;
import javax.swing.JTabbedPane;
import javax.swing.JCheckBox;
import javax.swing.JTextArea;
import javax.swing.JComboBox;
public class GraphicsMain extends Frame {
//变量
private int size=1; //像素大小
private Color color = Color.RED; //笔触颜色 // @jve:decl-index=0:
private Color DDAcolor=Color.yellow; // DDA算法颜色 // @jve:decl-index=0:
private Color BresColor=Color.blue; // Bresenhomn算法颜色 // @jve:decl-index=0:
private int lineStyle=0; // 线型
private boolean showGrid=false; // 是否显示网格
private String colorName="红色"; //颜色名称 // @jve:decl-index=0:
//
private static final long serialVersionUID = 1L;
private JPanel jPanel_pen = null;
private PaintBoard Print_jPanel =null;
private JPanel jPanel_paint = null;
private JButton jButton_line = null;
private JButton jButton_Arc = null;
private JButton jButton_duobian = null;
private JButton jButton_cut = null;
private JButton jButton_undo = null;
private JButton jButton_redo = null;
private JButton jButton_curve = null;
private JPanel jPanel_set = null;
private JLabel jLabel_set = null;
private JLabel jLabel_size = null;
private JTextField jTextField_size = null;
private JLabel jLabel_selectsize = null;
private JSlider jSlider_size = null;
private JLabel jLabel_sizenumber = null;
private JLabel jLabel_style = null;
private JButton jButton_trueline = null;
private JButton jButton_Smallline = null;
private JButton jButton_Bigline = null;
private JLabel jLabel_selectstyle = null;
private JTextField jTextField_style = null;
private JLabel jLabel_selectstyle2 = null;
private JLabel jLabel_color = null;
private JButton jButton_red = null;
private JButton jButton_yallow = null;
private JButton jButton_green = null;
private JButton jButton_blue = null;
private JButton jButton_gray = null;
private JButton jButton_black = null;
private JLabel jLabel_selectcolor = null;
private JTextField jTextField_color = null;
private JLabel jLabel_showGrid = null;
private JButton jButton_show = null;
private JTabbedPane jTabbedPane_Algorithm = null;
private JPanel jPanel_line = null;
private JPanel jPanel_Arc = null;
private JPanel jPanel_fiiled = null;
private JLabel jLabel_algorithm = null;
private JPanel jPanel_analysis = null;
private Checkbox jCheckBox_DDA = null;
private Checkbox jCheckBox_Bresenhom = null;
private JLabel jLabel_DDAcolor = null;
private JLabel jLabel_Brescolor = null;
private JButton jButton_delete = null;
private JLabel jLabel_logo = null;
private JLabel jLabel_aother = null;
private Checkbox jCheckBox_DDAArc = null;
private Checkbox jCheckBox_BresenhomArc = null;
private Checkbox jCheckBox_MidpointArc = null;
private JLabel jLabel_DDAArccolor = null;
private JLabel jLabel_BresArccollor = null;
private JLabel jLabel_MidpArccolor = null;
private JButton jButton_filledc = null;
private JLabel jLabel_duobianColor = null;
private JComboBox jComboBox_duobianColor = null;
private JLabel jLabel_filledColor = null;
private JComboBox jComboBox_filledColor = null;
private JButton jButton_erase = null;
/**
* This is the default constructor
*/
public GraphicsMain() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setLayout(null);
this.setSize(1200, 750);
this.setTitle("Computer Graphics");
this.add(getJPanel_pen(), null);
this.add(getJPanel_paint(), null);
this.add(getJPanel_set(), null);
this.add(getJTabbedPane_Algorithm(), null);
this.add(getJPanel_analysis(), null);
}
/**
* This method initializes jPanel_pen
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel_pen() {
if (jPanel_pen == null) {
jPanel_pen = new JPanel();
jPanel_pen.setLayout(null);
jPanel_pen.setBounds(new Rectangle(4, 30, 37, 715));
jPanel_pen.add(getJButton_line(), null);
jPanel_pen.add(getJButton_Arc(), null);
jPanel_pen.add(getJButton_duobian(), null);
jPanel_pen.add(getJButton_cut(), null);
jPanel_pen.add(getJButton_curve(), null);
jPanel_pen.add(getJButton_undo(), null);
jPanel_pen.add(getJButton_redo(), null);
jPanel_pen.add(getJButton_delete(), null);
jPanel_pen.add(getJButton_filledc(), null);
jPanel_pen.add(getJButton_erase(), null);
}
return jPanel_pen;
}
private PaintBoard getPrint_jPanel() {
if (Print_jPanel == null) {
Print_jPanel = new PaintBoard();
Print_jPanel.setSize(new Dimension(845, 712));
}
return Print_jPanel;
}
/**
* This method initializes jPanel_paint
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel_paint() {
if (jPanel_paint == null) {
jPanel_paint = new JPanel();
jPanel_paint.setLayout(null);
jPanel_paint.setBounds(new Rectangle(41, 30, 848, 716));
jPanel_paint.add(getPrint_jPanel(), null);
}
return jPanel_paint;
}
/**
* This method initializes jButton_line
*
* @return javax.swing.JButton
*/
private JButton getJButton_line() {
if (jButton_line == null) {
jButton_line = new JButton();
jButton_line.setBounds(new Rectangle(4, 4, 30, 30));
jButton_line.setMnemonic(KeyEvent.VK_UNDEFINED);
jButton_line.setIcon(new ImageIcon(getClass().getResource("/image/line.jpg")));
jButton_line.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if(jCheckBox_DDA.getState()&&jCheckBox_Bresenhom.getState()){
Print_jPanel.setCommand(Command.LINE);
}else if(jCheckBox_DDA.getState()){
Print_jPanel.setCommand(Command.DDALINE);
}else if(jCheckBox_Bresenhom.getState()){
Print_jPanel.setCommand(Command.BresLINE);
}else{
Print_jPanel.setCommand(Command.noLINE);
}
}
});
}
return jButton_line;
}
/**
* This method initializes jButton_Arc
*
* @return javax.swing.JButton
*/
private JButton getJButton_Arc() {
if (jButton_Arc == null) {
jButton_Arc = new JButton();
jButton_Arc.setBounds(new Rectangle(4, 34, 30, 30));
jButton_Arc.setIcon(new ImageIcon(getClass().getResource("/image/Arc.jpg")));
jButton_Arc.setMnemonic(KeyEvent.VK_UNDEFINED);
jButton_Arc.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if(jCheckBox_DDAArc.getState()&&jCheckBox_BresenhomArc.getState()&&jCheckBox_MidpointArc.getState()){
Print_jPanel.setCommand(Command.thiCIRCLE);
}else if(jCheckBox_DDAArc.getState()&&jCheckBox_BresenhomArc.getState()){
Print_jPanel.setCommand(Command.dbCIRCLE);
}else if(jCheckBox_BresenhomArc.getState()&&jCheckBox_MidpointArc.getState()){
Print_jPanel.setCommand(Command.bmCIRCLE);
}else if(jCheckBox_DDAArc.getState()&&jCheckBox_MidpointArc.getState()){
Print_jPanel.setCommand(Command.dmCIRCLE);
}else if(jCheckBox_DDAArc.getState()){
Print_jPanel.setCommand(Command.ddaCIRCLE);
}else if(jCheckBox_BresenhomArc.getState()){
Print_jPanel.setCommand(Command.breCIRCLE);
}else if(jCheckBox_MidpointArc.getState()){
Print_jPanel.setCommand(Command.midCIRCLE);
}else{
Print_jPanel.setCommand(Command.nothing);
没有合适的资源?快使用搜索试试~ 我知道了~
图形图像实验java代码
共87个文件
class:40个
jpg:29个
java:12个
需积分: 10 17 下载量 97 浏览量
2008-12-13
22:10:04
上传
评论
收藏 110KB RAR 举报
温馨提示
用java实现了图形图像实验。实现了各种算法,通过自己的算法制作了绘图板
资源推荐
资源详情
资源评论
收起资源包目录
Graphics.rar (87个子文件)
Graphics
.project 504B
image
5.jpg 895B
red.jpg 646B
back.jpg 643B
delete.jpg 852B
play.jpg 819B
3.jpg 697B
trueLine.jpg 805B
Oval.jpg 897B
Juggler2.gif 3KB
4.jpg 770B
bigLine.jpg 983B
Juggler1.gif 3KB
line.jpg 876B
Grid.jpg 923B
duobian.jpg 990B
2.jpg 697B
SmallLine.jpg 1KB
blue.jpg 646B
Arc.jpg 916B
redo.jpg 801B
yellow.jpg 646B
undo.jpg 797B
cut.jpg 922B
logo.gif 9KB
curve.jpg 890B
1.jpg 696B
Thumbs.db 44KB
filled.jpg 916B
green.jpg 646B
erase.jpg 890B
gray.jpg 641B
Analysis.jpg 851B
black.jpg 643B
.classpath 226B
csu
GraphicsMain$25.class 1KB
GraphicsMain$5.class 800B
GraphicsMain.java 38KB
GraphicsMain$12.class 1KB
FilledColor.java 4KB
Line.class 5KB
Circle.class 5KB
Duobian.class 2KB
Duobian.java 2KB
GraphicsMain$27.class 1KB
GraphicsMain$21.class 2KB
Cut.java 2KB
GraphicsMain$1.class 1KB
GraphicsMain$10.class 804B
GraphicsMain$28.class 1KB
PaintBoard.class 10KB
Point.java 702B
GraphicsMain$24.class 1KB
BitMap.class 625B
GraphicsMain$15.class 1KB
Bezier.java 3KB
GraphicsMain$26.class 1KB
GraphicsMain.class 19KB
BitMap.java 375B
GraphicsMain$4.class 804B
GraphicsMain$9.class 836B
Line.java 7KB
GraphicsMain$23.class 1KB
PaintBoard.java 13KB
GraphicsMain$14.class 1KB
GraphicsMain$13.class 1KB
GraphicsMain$17.class 1KB
GraphicsMain$18.class 1KB
Point.class 1KB
GraphicsMain$22.class 1KB
Command.java 902B
Bezier.class 3KB
GraphicsMain$19.class 1KB
GraphicsMain$3.class 846B
GraphicsMain$11.class 2KB
GraphicsMain$20.class 1KB
Shape.java 205B
Shape.class 161B
Circle.java 5KB
GraphicsMain$2.class 1KB
GraphicsMain$16.class 1KB
GraphicsMain$6.class 912B
GraphicsMain$7.class 786B
Command.class 647B
GraphicsMain$8.class 1KB
FilledColor.class 3KB
Cut.class 2KB
共 87 条
- 1
资源评论
scarletty
- 粉丝: 36
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功