|
@@ -5,10 +5,8 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import javax.swing.*;
|
|
|
-import java.awt.event.ActionEvent;
|
|
|
-import java.awt.event.ActionListener;
|
|
|
-import java.awt.event.InputEvent;
|
|
|
-import java.awt.event.KeyEvent;
|
|
|
+import java.awt.*;
|
|
|
+import java.awt.event.*;
|
|
|
import java.io.File;
|
|
|
|
|
|
public class Frame extends JFrame {
|
|
@@ -41,21 +39,63 @@ public class Frame extends JFrame {
|
|
|
public static File excelSource;
|
|
|
public static File imgDir;
|
|
|
|
|
|
- public Frame(int width, int height, int panelOperatorWidth) {
|
|
|
+ /**
|
|
|
+ * 操作面板的宽度
|
|
|
+ */
|
|
|
+ private int panelOperatorWidth;
|
|
|
+ private Panel panel;
|
|
|
+ /**
|
|
|
+ * 操作面板
|
|
|
+ */
|
|
|
+ private PanelOperator panelOperator;
|
|
|
|
|
|
+ public Panel getPanel() {
|
|
|
+ return panel;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PanelOperator getPanelOperator() {
|
|
|
+ return panelOperator;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Frame(int width, int height, int panelOperatorWidth) {
|
|
|
+ this.panelOperatorWidth = panelOperatorWidth;
|
|
|
this.WIDTH = width;
|
|
|
this.HEIGHT = height;
|
|
|
|
|
|
- this.setTitle("EXCEL");
|
|
|
+ this.setTitle("Winbot");
|
|
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
this.setSize(width, height);
|
|
|
this.setResizable(false);
|
|
|
this.setLayout(null);
|
|
|
setLocationRelativeTo(null);
|
|
|
this.initMenuBar();
|
|
|
+ this.initPanel(width, height);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 初始化面板
|
|
|
+ * @param width
|
|
|
+ * @param height
|
|
|
+ */
|
|
|
+ private void initPanel(int width, int height) {
|
|
|
+ int panelWidth = width - panelOperatorWidth;
|
|
|
+ int panelHeight = height - menuBarHeight;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ panel = new Panel();
|
|
|
+ panel.setBounds(0, 0, panelWidth, panelHeight);
|
|
|
+
|
|
|
+ panelOperator = new PanelOperator(panelWidth, 0, panelOperatorWidth, panelHeight, this);
|
|
|
+
|
|
|
+ this.add(panelOperator);
|
|
|
+ this.add(panel);
|
|
|
+
|
|
|
+ this.setVisible(true);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 初始化菜单
|
|
|
*/
|
|
|
private void initMenuBar() {
|