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);
}
} |
|