/*
* App.java
*
* Created on __DATE__, __TIME__
*/
package cn.scuec;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import cn.scuec.handler.ComboBoxHandler;
import cn.scuec.model.paint.PaintG;
import cn.scuec.model.paint.PaintLine;
import cn.scuec.ui.DrawPanel;
/**
*
* @author __USER__
*/
public class App extends javax.swing.JFrame {
/** Creates new form App */
public App() {
initComponents();
}
// GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
cutBtGroup = new javax.swing.ButtonGroup();
rectLine = new javax.swing.JRadioButton();
lineRadio = new javax.swing.JRadioButton();
cutPanel = new javax.swing.JPanel();
cutPanel.setVisible(false);
comboBoxHandler = new ComboBoxHandler(this);
buttonGroup1 = new javax.swing.ButtonGroup();
ControlPanel = new javax.swing.JPanel();
experPanel = new javax.swing.JPanel();
experCombo = new javax.swing.JComboBox();
methodPanel = new javax.swing.JPanel();
methodCombo = new javax.swing.JComboBox();
jPanel1 = new javax.swing.JPanel();
infoLabel = new javax.swing.JLabel();
autoStartBt = new javax.swing.JButton();
autoStartBt.setEnabled(false);
clearBt = new javax.swing.JButton();
clearBt.setEnabled(false);
stepBt = new javax.swing.JButton();
stepBt.setEnabled(false);
setBt = new javax.swing.JButton();
setBt.setEnabled(false);
dataPanel = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
DataTable = new javax.swing.JTable();
jPanel4 = new javax.swing.JPanel();
GPanel = new DrawPanel();
PosLabel = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
/*********************************************/
paintG = new PaintLine(this);
/*********************************************/
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
ControlPanel.setBorder(javax.swing.BorderFactory
.createTitledBorder("\u63a7\u5236"));
experPanel.setBorder(javax.swing.BorderFactory
.createTitledBorder("\u5b9e\u9a8c"));
experCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
"请选择实验", "直线的扫描转换", "圆弧的扫描转换", "直线段的裁剪", "多边形的裁剪" }));
experCombo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
experComboActionPerformed(evt);
}
});
javax.swing.GroupLayout experPanelLayout = new javax.swing.GroupLayout(
experPanel);
experPanel.setLayout(experPanelLayout);
experPanelLayout.setHorizontalGroup(experPanelLayout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(experCombo,
javax.swing.GroupLayout.Alignment.TRAILING, 0, 152,
Short.MAX_VALUE));
experPanelLayout.setVerticalGroup(experPanelLayout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGroup(
experPanelLayout.createSequentialGroup().addContainerGap()
.addComponent(experCombo,
javax.swing.GroupLayout.PREFERRED_SIZE, 29,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(12, Short.MAX_VALUE)));
methodPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1,
new java.awt.Color(153, 153, 255)), "\u65b9\u6cd5"));
methodCombo.setModel(new javax.swing.DefaultComboBoxModel(
new String[] {}));
methodCombo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
methodComboActionPerformed(evt);
}
});
javax.swing.GroupLayout methodPanelLayout = new javax.swing.GroupLayout(
methodPanel);
methodPanel.setLayout(methodPanelLayout);
methodPanelLayout.setHorizontalGroup(methodPanelLayout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(methodCombo,
javax.swing.GroupLayout.Alignment.TRAILING, 0, 158,
Short.MAX_VALUE));
methodPanelLayout.setVerticalGroup(methodPanelLayout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
methodPanelLayout.createSequentialGroup()
.addContainerGap().addComponent(methodCombo,
javax.swing.GroupLayout.PREFERRED_SIZE,
29,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(18, Short.MAX_VALUE)));
jPanel1.setBorder(javax.swing.BorderFactory
.createTitledBorder("\u64cd\u4f5c"));
autoStartBt.setText("\u81ea\u52a8\u5f00\u59cb");
clearBt.setText("\u6e05\u9664");
stepBt.setText("\u4e0b\u4e00\u6b65");
setBt.setText("\u8bbe\u7f6e");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout
.setHorizontalGroup(jPanel1Layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
jPanel1Layout
.createSequentialGroup()
.addContainerGap()
.addGroup(
jPanel1Layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
jPanel1Layout
.createSequentialGroup()
.addComponent(
autoStartBt,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGap(
103,
103,
103))
.addGroup(
jPanel1Layout
.createSequentialGroup()
.addComponent(
clearBt,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGap(
127,
127,
127))
.addGroup(
jPanel1Layout
.createSequentialGroup()
.addComponent(
stepBt,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGap(
115,
115,
115))
.addGroup(
jPanel1Layout
.createSequentialGroup()
.addComponent(
setBt)
.addContainerGap(
127,
Short.MAX_VALUE)))));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGroup(
jPanel1Layout.createSequentialGroup().addComponent(autoStartBt)
.addGap(18, 18, 18).addComponent(clearBt).addGap(18,
18, 18).addComponent(stepBt).addGap(18, 18, 18)
.addComponent(setBt).addContainerGap(
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)));
jPanel2.setBorder(javax.swing.BorderFactory
.createTitledBorder("\u4fe1\u606f"));
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(
jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addComponent(
infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 194,
Short.MAX_VALUE));
jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGroup(
jPanel2Layout.createSequentialGroup().