blob: b60b9ec796f8b8e4bab167aef59529fc6c071ba0 (
plain)
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
|
package org.manzerbredes.open_klm.client;
import java.awt.EventQueue;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import org.manzerbredes.open_klm.drivers.DriverTypeA.*;
import org.manzerbredes.open_klm.drivers.*;
public class MainWindow extends JFrame {
private JComboBox<Color> left;
private JComboBox<Color> middle;
private JComboBox<Color> right;
private JButton apply=new JButton("Apply");
private DriverTypeA keyboard;
public MainWindow() throws InstantiationException{
this.initUI();
this.keyboard=new Device_1770_ff00();
this.left=new JComboBox<>(Color.values());
this.middle=new JComboBox<>(Color.values());
this.right=new JComboBox<>(Color.values());
this.apply.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Color leftRegion=(Color) left.getSelectedItem();
Color middleRegion=(Color) middle.getSelectedItem();
Color rightRegion=(Color) right.getSelectedItem();
keyboard.setRegionColor(Region.LEFT, leftRegion, Intensity.HIGH);
keyboard.setRegionColor(Region.MIDDLE, middleRegion, Intensity.HIGH);
keyboard.setRegionColor(Region.RIGHT, rightRegion, Intensity.HIGH);
}
});
JPanel container = new JPanel();
BoxLayout gridLayout=new BoxLayout(container, BoxLayout.Y_AXIS);
container.add(new Label("Test interface"));
container.add(left);
container.add(middle);
container.add(right);
container.add(this.apply);
this.add(container);
this.setVisible(true);
}
private void initUI(){
this.setTitle("Open KLM");
this.setSize(700, 500);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
|