summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-27 17:15:14 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-27 17:15:14 +0200
commitfdd622f4e0b09b08a4e54ab5976b43c6edd031be (patch)
tree0993c038a2ae0930815dd435847b2826a0b703e2
parent5d8eafe9e8c36c86f9b4c33f32305866dd898f3e (diff)
Add easy interface
-rw-r--r--src/client/MainWindow.java60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/client/MainWindow.java b/src/client/MainWindow.java
index b6020d2..b98cca1 100644
--- a/src/client/MainWindow.java
+++ b/src/client/MainWindow.java
@@ -1,14 +1,72 @@
package org.manzerbredes.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.device.Driver.Color;
+import org.manzerbredes.open_klm.device.Driver.Intensity;
+import org.manzerbredes.open_klm.device.Driver.Region;
+import org.manzerbredes.open_klm.device.Keyboard;
public class MainWindow extends JFrame {
+ private JComboBox<Color> left;
+ private JComboBox<Color> middle;
+ private JComboBox<Color> right;
+ private JButton apply=new JButton("Apply");
- public MainWindow(){
+ private Keyboard keyboard;
+
+ public MainWindow() throws InstantiationException{
this.initUI();
+ this.keyboard=new Keyboard();
+ 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);
}