From 8d6c55d9433dc7c4abd3e0f1a2a51da9c9897597 Mon Sep 17 00:00:00 2001 From: Joe Ross Date: Fri, 20 Mar 2015 22:35:02 -0700 Subject: Fix restoring of saved camera resolution. The values were not available when the XML file was read, so the default was used. Added values in constructor. Change-Id: Id8d2ac9dfdccf316301ad190f01b0ec23e9516cc --- .../gui/elements/WebcamViewerExtension.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/smartdashboard/src/edu/wpi/first/smartdashboard/gui/elements/WebcamViewerExtension.java b/smartdashboard/src/edu/wpi/first/smartdashboard/gui/elements/WebcamViewerExtension.java index a2258cf..f9ba47d 100644 --- a/smartdashboard/src/edu/wpi/first/smartdashboard/gui/elements/WebcamViewerExtension.java +++ b/smartdashboard/src/edu/wpi/first/smartdashboard/gui/elements/WebcamViewerExtension.java @@ -30,7 +30,7 @@ public class WebcamViewerExtension extends StaticWidget implements Runnable { public static final String NAME = "USB Webcam Viewer"; public final IntegerProperty fpsProperty = new IntegerProperty(this, "FPS", 30); - public final MultiProperty sizeProperty = new MultiProperty(this, "Size"); + public final MultiProperty sizeProperty; private final static int PORT = 1180; private final static byte[] MAGIC_NUMBERS = { 0x01, 0x00, 0x00, 0x00 }; @@ -46,16 +46,19 @@ public class WebcamViewerExtension extends StaticWidget implements Runnable { private Socket socket; private Thread thread; - - /** {@inheritDoc} */ - @Override - public void init() { - setPreferredSize(new Dimension(320, 240)); - + public WebcamViewerExtension() { + super(); + sizeProperty = new MultiProperty(this, "Size"); sizeProperty.add("640x480", SIZE_640x480); sizeProperty.add("320x240", SIZE_320x240); sizeProperty.add("160x120", SIZE_160x120); sizeProperty.setDefault("640x480"); + } + + /** {@inheritDoc} */ + @Override + public void init() { + setPreferredSize(new Dimension(320, 240)); this.thread = new Thread(this); this.thread.start(); -- cgit v1.2.3-54-g00ecf