黑马程序员技术交流社区

标题: 模拟CAD的页面 [打印本页]

作者: 15044393192    时间: 2016-3-28 23:00
标题: 模拟CAD的页面
package com.qdmmy6.cad;

import java.awt.*;
import javax.swing.*;

public class CadCanvas extends JPanel {
        private static final long serialVersionUID = -2012509915952260613L;
        private OperateService os;
        private JToolBar tBar = new JToolBar();
       
        public CadCanvas() {
                os = new OperateService(this, tBar);
                this.init();
        }
       
        public void paintComponent(Graphics g) {
                super.paintComponent(g);
                Graphics2D g2 = (Graphics2D)g;
                g2.setPaint(Color.WHITE);
                os.paint(g2);
        }
       
        public void init() {
                this.setLayout(new BorderLayout());
                this.add(tBar, BorderLayout.WEST);
                this.tBar.setOrientation(JToolBar.VERTICAL);
                this.setBackground(new Color(20, 20, 20));
                this.setFocusable(true);
        }
}




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2