1
zhanghua
2024-09-26 c775c6953d9759e70f08acbfa8f6d7490aaae3d1
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.netsdk.demo.customize.ptzNewDemo.frame.basic;
 
import com.netsdk.demo.customize.ptzNewDemo.frame.SwingUtil;
 
import javax.swing.*;
import java.awt.*;
 
/**
 * 变倍、变焦设置 面板
 *
 * @author 47040
 * @since Created in 2021/3/25 20:27
 */
public class PtzModifyPanel extends JPanel {
 
    private final JButton zoomAddBtn = new JButton("变倍+");
    private final JButton zoomDecBtn = new JButton("变倍-");
    private final JComboBox<String> speedComboBox;
    private final JButton focusAddBtn = new JButton("变焦+");
    private final JButton focusDecBtn = new JButton("变焦-");
 
    {
        speedComboBox = new JComboBox<String>(new String[]{
                "速率" + " 1", "速率" + " 2", "速率" + " 3", "速率" + " 4",
                "速率" + " 5", "速率" + " 6", "速率" + " 7", "速率" + " 8"
        });
        speedComboBox.setSelectedIndex(4);
        speedComboBox.setPreferredSize(new Dimension(74, 25));
    }
 
    public PtzModifyPanel() {
        SwingUtil.setBorderEx(this, "变倍、变焦设置", 2);
        setLayout(new GridLayout(3, 1));
        Dimension dim = getPreferredSize();
        dim.width = 240;
        dim.height = 160;
        setPreferredSize(dim);
 
        JPanel placeHolder01 = new JPanel();
        placeHolder01.setLayout(new FlowLayout());
        JPanel placeHolder02 = new JPanel();
        placeHolder02.setLayout(new FlowLayout());
        JPanel placeHolder03 = new JPanel();
        placeHolder03.setLayout(new FlowLayout());
 
        placeHolder01.add(zoomAddBtn);
        placeHolder01.add(zoomDecBtn);
 
        placeHolder02.add(speedComboBox);
 
        placeHolder03.add(focusAddBtn);
        placeHolder03.add(focusDecBtn);
 
        add(placeHolder01);
        add(placeHolder02);
        add(placeHolder03);
    }
 
    public int getSpeed() {
        return speedComboBox.getSelectedIndex() + 1;
    }
 
    public JButton getZoomAddBtn() {
        return zoomAddBtn;
    }
 
    public JButton getZoomDecBtn() {
        return zoomDecBtn;
    }
 
    public JButton getFocusAddBtn() {
        return focusAddBtn;
    }
 
    public JButton getFocusDecBtn() {
        return focusDecBtn;
    }
 
    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        SwingUtil.SetEnableAllInnerComponent(this, enabled);
    }
}