shichongfu
2023-10-08 6f83c8971714e2384df45706e364ed45a0cd1183
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.product.device.test;
 
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.HashMap;
import java.util.Map;
 
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
 
 
public class DeviceDataGatherTest extends JFrame {
 
    JPanel current = null;
 // 得到显示器屏幕的宽高
    public int width = Toolkit.getDefaultToolkit().getScreenSize().width;
    public int height = Toolkit.getDefaultToolkit().getScreenSize().height - 40;
    // 定义窗体的宽高
    public int windowsWedth = 1500;
    public int windowsHeight = 700;
    private Map<String, JPanel> panel = new HashMap<String, JPanel>();
    DeviceGatherPanel mp = new DeviceGatherPanel(this);
    public JPanel getPanel(String name) {
        return panel.get(name);
    }
    public void setPanel(String name, JPanel panel) {
        this.panel.put(name, panel);
    }
   
    JPanel mpanel = new JPanel(new BorderLayout());
 
    public JPanel getMpanel() {
        return mpanel;
    }
 
    public void setMpanel(JPanel mpanel) {
        this.mpanel = mpanel;
    }
    public  DeviceDataGatherTest() {
        this.setTitle("设备管理数据采集测试");
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        // 设置窗体位置和大小
        this.setBounds((width - windowsWedth) / 2, (height - windowsHeight) / 2, windowsWedth, windowsHeight);
       
        try {
            this.setContentPane(mp);
            this.setResizable(false);
            this.setVisible(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void main(String args[]) {
        DeviceDataGatherTest master = new DeviceDataGatherTest();
    } 
}