aboutsummaryrefslogtreecommitdiff
path: root/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java')
-rw-r--r--PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java29
1 files changed, 11 insertions, 18 deletions
diff --git a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java
index 5cbc3f5..d71a6c6 100644
--- a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java
+++ b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java
@@ -67,7 +67,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener,
JFrame frame;
JPanel bagDebugingPanel = new JPanel();
- JPanel programOptionsPanel = new JPanel();
+ JPanel programOptionsPanel = new JPanel(new GridBagLayout());
// Contact
public enum Direction {
@@ -140,12 +140,13 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener,
bagDebugingPanel.add(bottomTopSplitPane, BorderLayout.CENTER);
- programOptionsPanel.add(new DisplayPanel());
+ programOptionsPanel.add(new JButton("Debug"));
- //frame.add(bagDebugingPanel);
- frame.add(programOptionsPanel);
+ frame.add(bagDebugingPanel);
+ frame.add(new DisplayPanel(), BorderLayout.CENTER);
+ frame.add(programOptionsPanel, BorderLayout.SOUTH);
- //setMode(currentMode);
+ setMode(currentMode);
GraphicsDevice device;
device = GraphicsEnvironment.getLocalGraphicsEnvironment()
@@ -197,33 +198,25 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener,
}
}
- class DisplayPanel extends JPanel implements Runnable {
+ class DisplayPanel extends ImagePanel implements Runnable {
ArrayList<File> files = new ArrayList<File>();
- ImagePanel imagePanel = new ImagePanel();
int image = 0;
DisplayPanel() {
- this.add(imagePanel);
+ super();
new Thread(this).start();
}
- /*public void paintComponent(Graphics g) {
- if (images.size() != 0) {
- if (debugImages)
- System.out.println("Displaying Image");
- g.drawImage(images.get(image), 0, 0, frame.getSize().width, frame.getSize().height, null);
- }
- }*/
-
public void run() {
loadImages();
while (true) {
try {
- imagePanel.loadImage(files.get(image));
+ this.loadImage(files.get(image));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
+ this.repaint();
if (image == (files.size() - 1)) {
image = 0;
} else {
@@ -232,7 +225,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener,
if (debugImages)
System.out.println("Moving to the next image ");
try {
- Thread.sleep(10000);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();