diff --git a/java/.classpath b/java/.classpath
index e4b5e09..3a15169 100644
--- a/java/.classpath
+++ b/java/.classpath
@@ -8,5 +8,6 @@
+
diff --git a/java/lib/TableLayout.jar b/java/lib/TableLayout.jar
new file mode 100644
index 0000000..23519b0
Binary files /dev/null and b/java/lib/TableLayout.jar differ
diff --git a/java/src/pm/Main.java b/java/src/pm/Main.java
index 5c6211e..8d9b07b 100644
--- a/java/src/pm/Main.java
+++ b/java/src/pm/Main.java
@@ -7,7 +7,7 @@ import pm.action.ActionProvider;
import pm.application.Winamp.WinampApplication;
import pm.application.iTunes.iTunesApplication;
import pm.device.Device;
-import pm.device.javainput.rumblepad.RumblepadDevice;
+import pm.device.gui.GUIDevice;
import pm.device.jintellitype.JIntellitypeDevice;
import pm.exception.action.TargetNotSetException;
import pm.exception.application.ApplicationExitException;
@@ -34,12 +34,13 @@ public class Main extends ActionListener {
public void initialise() throws DeviceInitialiseException {
add(new JIntellitypeDevice());
- add(new RumblepadDevice());
+ //add(new RumblepadDevice());
+ add(new GUIDevice());
for (Device device : deviceList) {
device.initialise();
}
//add(new ExampleApplication());
- add(new WinampApplication());
+ //add(new WinampApplication());
add(new iTunesApplication());
//applicationCycle.next();
diff --git a/java/src/pm/device/gui/GUIDevice.java b/java/src/pm/device/gui/GUIDevice.java
new file mode 100644
index 0000000..b306694
--- /dev/null
+++ b/java/src/pm/device/gui/GUIDevice.java
@@ -0,0 +1,12 @@
+package pm.device.gui;
+
+import pm.device.Device;
+
+public class GUIDevice extends Device {
+
+ protected GUIDeviceUI gui;
+
+ public GUIDevice() {
+ gui = new GUIDeviceUI();
+ }
+}
diff --git a/java/src/pm/device/gui/GUIDeviceUI.java b/java/src/pm/device/gui/GUIDeviceUI.java
new file mode 100644
index 0000000..2b668c6
--- /dev/null
+++ b/java/src/pm/device/gui/GUIDeviceUI.java
@@ -0,0 +1,197 @@
+package pm.device.gui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import pm.Action;
+import pm.Target;
+import pm.action.ActionProvider;
+
+import layout.TableLayout;
+import layout.TableLayoutConstraints;
+
+public class GUIDeviceUI extends JFrame {
+
+ private static final long serialVersionUID = 1L;
+
+ private JButton play;
+ private JButton pause;
+ private JButton resume;
+ private JButton next;
+ private JButton previous;
+ private JButton forward;
+ private JButton rewind;
+ private JButton mute;
+ private JButton volumeUp;
+ private JButton volumeDown;
+
+ //ActionProvider.add
+ public GUIDeviceUI() {
+ initComponents();
+ setSize(30, 300);
+ setVisible(true);
+ }
+
+ public void initComponents() {
+ play = new JButton();
+ pause = new JButton();
+ resume = new JButton();
+ next = new JButton();
+ previous = new JButton();
+ forward = new JButton();
+ rewind = new JButton();
+ mute = new JButton();
+ volumeUp = new JButton();
+ volumeDown = new JButton();
+
+
+ setLayout(
+ new TableLayout(new double[][] {
+ {TableLayout.PREFERRED},
+ {TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED,
+ TableLayout.PREFERRED}
+ })
+ );
+
+ //---- play ----
+ play.setText("play");
+ play.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ playAction(e);
+ }
+ });
+ add(play, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- pause ----
+ pause.setText("pause");
+ pause.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ pauseAction(e);
+ }
+ });
+ add(pause, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- resume ----
+ resume.setText("resume");
+ resume.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ resumeAction(e);
+ }
+ });
+ add(resume, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- next ----
+ next.setText("next");
+ next.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ nextAction(e);
+ }
+ });
+ add(next, new TableLayoutConstraints(0, 3, 0, 3, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- previous ----
+ previous.setText("previous");
+ previous.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ previousAction(e);
+ }
+ });
+ add(previous, new TableLayoutConstraints(0, 4, 0, 4, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- forward ----
+ forward.setText("forward");
+ forward.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ forwardAction(e);
+ }
+ });
+ add(forward, new TableLayoutConstraints(0, 5, 0, 5, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- rewind ----
+ rewind.setText("rewind");
+ rewind.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ rewindAction(e);
+ }
+ });
+ add(rewind, new TableLayoutConstraints(0, 6, 0, 6, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- mute ----
+ mute.setText("mute");
+ mute.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ muteAction(e);
+ }
+ });
+ add(mute, new TableLayoutConstraints(0, 7, 0, 7, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- volumeUp ----
+ volumeUp.setText("volume up");
+ volumeUp.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ volumeUpAction(e);
+ }
+ });
+ add(volumeUp, new TableLayoutConstraints(0, 8, 0, 8, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+
+ //---- volumeDown ----
+ volumeDown.setText("volume down");
+ volumeDown.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ volumeDownAction(e);
+ }
+ });
+ add(volumeDown, new TableLayoutConstraints(0, 9, 0, 9, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
+ }
+
+ private void playAction(ActionEvent e) {
+ ActionProvider.add(Action.PLAY.setTarget(Target.APPLICATION));
+ }
+
+ private void pauseAction(ActionEvent e) {
+ ActionProvider.add(Action.PAUSE.setTarget(Target.APPLICATION));
+ }
+
+ private void resumeAction(ActionEvent e) {
+ ActionProvider.add(Action.RESUME.setTarget(Target.APPLICATION));
+ }
+
+ private void nextAction(ActionEvent e) {
+ ActionProvider.add(Action.NEXT.setTarget(Target.APPLICATION));
+ }
+
+ private void previousAction(ActionEvent e) {
+ ActionProvider.add(Action.PREVIOUS.setTarget(Target.APPLICATION));
+ }
+
+ private void forwardAction(ActionEvent e) {
+ ActionProvider.add(Action.FORWARD.setTarget(Target.APPLICATION));
+ }
+
+ private void rewindAction(ActionEvent e) {
+ ActionProvider.add(Action.REWIND.setTarget(Target.APPLICATION));
+ }
+
+ private void muteAction(ActionEvent e) {
+ ActionProvider.add(Action.MUTE.setTarget(Target.APPLICATION));
+ }
+
+ private void volumeUpAction(ActionEvent e) {
+ ActionProvider.add(Action.VOLUME_UP.setTarget(Target.APPLICATION));
+ }
+
+ private void volumeDownAction(ActionEvent e) {
+ ActionProvider.add(Action.VOLUME_DOWN.setTarget(Target.APPLICATION));
+ }
+}