fixed reconnection. Added definitive close.
git-svn-id: http://wiiusej.googlecode.com/svn/trunk@156 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
@@ -47,6 +47,8 @@ public class WiiUseApiManager extends Thread {
|
|||||||
|
|
||||||
private AtomicBoolean running = new AtomicBoolean(false);
|
private AtomicBoolean running = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
private boolean leave = false;
|
||||||
|
|
||||||
public static int WIIUSE_STACK_UNKNOWN = 0;
|
public static int WIIUSE_STACK_UNKNOWN = 0;
|
||||||
public static int WIIUSE_STACK_MS = 1;
|
public static int WIIUSE_STACK_MS = 1;
|
||||||
public static int WIIUSE_STACK_BLUESOLEIL = 2;
|
public static int WIIUSE_STACK_BLUESOLEIL = 2;
|
||||||
@@ -247,6 +249,14 @@ public class WiiUseApiManager extends Thread {
|
|||||||
wiiuse.cleanUp();
|
wiiuse.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop wiiuseJ definitively for this program.
|
||||||
|
*/
|
||||||
|
public void definitiveShutdown(){
|
||||||
|
leave = true;
|
||||||
|
shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate the rumble for the wiimote with the given id.
|
* Activate the rumble for the wiimote with the given id.
|
||||||
*
|
*
|
||||||
@@ -548,7 +558,7 @@ public class WiiUseApiManager extends Thread {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
while (true) {
|
while (!leave) {
|
||||||
try {
|
try {
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|||||||
@@ -30,11 +30,14 @@ public class Main {
|
|||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true);
|
Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true);
|
||||||
|
WiiuseJGuiTest gui = null;
|
||||||
if (wiimotes.length > 0) {
|
if (wiimotes.length > 0) {
|
||||||
WiiuseJGuiTest gui = new WiiuseJGuiTest(wiimotes[0]);
|
gui = new WiiuseJGuiTest(wiimotes[0]);
|
||||||
|
} else {
|
||||||
|
gui = new WiiuseJGuiTest();
|
||||||
|
}
|
||||||
gui.setDefaultCloseOperation(gui.EXIT_ON_CLOSE);
|
gui.setDefaultCloseOperation(gui.EXIT_ON_CLOSE);
|
||||||
gui.setVisible(true);
|
gui.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,11 @@ import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gui class to test WiiuseJ.
|
* Gui class to test WiiuseJ.
|
||||||
|
*
|
||||||
* @author guiguito
|
* @author guiguito
|
||||||
*/
|
*/
|
||||||
public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListener {
|
public class WiiuseJGuiTest extends javax.swing.JFrame implements
|
||||||
|
WiimoteListener {
|
||||||
|
|
||||||
private Wiimote wiimote;
|
private Wiimote wiimote;
|
||||||
private Robot robot = null;
|
private Robot robot = null;
|
||||||
@@ -89,16 +91,28 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Creates new form WiiuseJGuiTest */
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public WiiuseJGuiTest() {
|
||||||
|
initComponents();
|
||||||
|
this.addWindowListener(new CloseGuiTestCleanly());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new form WiiuseJGuiTest
|
||||||
|
*/
|
||||||
public WiiuseJGuiTest(Wiimote wiimote) {
|
public WiiuseJGuiTest(Wiimote wiimote) {
|
||||||
initComponents();
|
initComponents();
|
||||||
this.addWindowListener(new CloseGuiTestCleanly());
|
this.addWindowListener(new CloseGuiTestCleanly());
|
||||||
|
if (wiimote != null) {
|
||||||
this.wiimote = wiimote;
|
this.wiimote = wiimote;
|
||||||
registerListeners();
|
registerListeners();
|
||||||
initWiimote();
|
initWiimote();
|
||||||
isFirstStatusGot = false;
|
isFirstStatusGot = false;
|
||||||
getStatusButtonMousePressed(null);
|
getStatusButtonMousePressed(null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all views
|
* Clear all views
|
||||||
@@ -117,9 +131,11 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
private void unregisterListeners() {
|
private void unregisterListeners() {
|
||||||
wiimote.removeWiiMoteEventListeners((IRPanel) irViewPanel);
|
wiimote.removeWiiMoteEventListeners((IRPanel) irViewPanel);
|
||||||
wiimote.removeWiiMoteEventListeners((ButtonsEventPanel) buttonsPanel);
|
wiimote.removeWiiMoteEventListeners((ButtonsEventPanel) buttonsPanel);
|
||||||
wiimote.removeWiiMoteEventListeners((OrientationPanel) motionSensingPanel);
|
wiimote
|
||||||
|
.removeWiiMoteEventListeners((OrientationPanel) motionSensingPanel);
|
||||||
wiimote.removeWiiMoteEventListeners((GForcePanel) gForcePanel);
|
wiimote.removeWiiMoteEventListeners((GForcePanel) gForcePanel);
|
||||||
wiimote.removeWiiMoteEventListeners((AccelerationPanel) accelerationPanel);
|
wiimote
|
||||||
|
.removeWiiMoteEventListeners((AccelerationPanel) accelerationPanel);
|
||||||
wiimote.removeWiiMoteEventListeners(this);
|
wiimote.removeWiiMoteEventListeners(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,8 +211,10 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
|
|
||||||
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
public void onMotionSensingEvent(MotionSensingEvent arg0) {
|
||||||
if (statusMotionRequested) {// Status requested
|
if (statusMotionRequested) {// Status requested
|
||||||
accelerationThresholdTextField.setText("" + arg0.getAccelerationThreshold());
|
accelerationThresholdTextField.setText(""
|
||||||
orientationThresholdTextField.setText("" + arg0.getOrientationThreshold());
|
+ arg0.getAccelerationThreshold());
|
||||||
|
orientationThresholdTextField.setText(""
|
||||||
|
+ arg0.getOrientationThreshold());
|
||||||
alphaSmoothingTextField.setText("" + arg0.getAlphaSmoothing());
|
alphaSmoothingTextField.setText("" + arg0.getAlphaSmoothing());
|
||||||
statusMotionRequested = false;
|
statusMotionRequested = false;
|
||||||
}
|
}
|
||||||
@@ -212,7 +230,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
showExpansionWiimoteButton.setEnabled(true);
|
showExpansionWiimoteButton.setEnabled(true);
|
||||||
showExpansionWiimoteButton.setText("Show Nunchuk");
|
showExpansionWiimoteButton.setText("Show Nunchuk");
|
||||||
expansionFrame = new NunchukGuiTest(wiimote);
|
expansionFrame = new NunchukGuiTest(wiimote);
|
||||||
expansionFrame.setDefaultCloseOperation(expansionFrame.HIDE_ON_CLOSE);
|
expansionFrame
|
||||||
|
.setDefaultCloseOperation(expansionFrame.HIDE_ON_CLOSE);
|
||||||
expansionFrame.addWindowListener(buttonSetter);
|
expansionFrame.addWindowListener(buttonSetter);
|
||||||
isFirstStatusGot = true;
|
isFirstStatusGot = true;
|
||||||
}
|
}
|
||||||
@@ -275,12 +294,13 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/**
|
||||||
* initialize the form.
|
* This method is called from within the constructor to initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
* always regenerated by the Form Editor.
|
* regenerated by the Form Editor.
|
||||||
*/
|
*/
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||||
|
// Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
leftPanel = new javax.swing.JPanel();
|
leftPanel = new javax.swing.JPanel();
|
||||||
@@ -356,80 +376,100 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
leftPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
leftPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
|
|
||||||
irViewPanel.setBackground(new java.awt.Color(0, 0, 0));
|
irViewPanel.setBackground(new java.awt.Color(0, 0, 0));
|
||||||
irViewPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 153, 153), 2, true), "IR View", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(255, 0, 51)));
|
irViewPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
||||||
|
new javax.swing.border.LineBorder(new java.awt.Color(0, 153,
|
||||||
|
153), 2, true), "IR View",
|
||||||
|
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
|
||||||
|
javax.swing.border.TitledBorder.DEFAULT_POSITION,
|
||||||
|
new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(255, 0,
|
||||||
|
51)));
|
||||||
irViewPanel.setToolTipText("IREvent");
|
irViewPanel.setToolTipText("IREvent");
|
||||||
|
|
||||||
javax.swing.GroupLayout irViewPanelLayout = new javax.swing.GroupLayout(irViewPanel);
|
javax.swing.GroupLayout irViewPanelLayout = new javax.swing.GroupLayout(
|
||||||
|
irViewPanel);
|
||||||
irViewPanel.setLayout(irViewPanelLayout);
|
irViewPanel.setLayout(irViewPanelLayout);
|
||||||
irViewPanelLayout.setHorizontalGroup(
|
irViewPanelLayout.setHorizontalGroup(irViewPanelLayout
|
||||||
irViewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 272, Short.MAX_VALUE)
|
.addGap(0, 272, Short.MAX_VALUE));
|
||||||
);
|
irViewPanelLayout.setVerticalGroup(irViewPanelLayout
|
||||||
irViewPanelLayout.setVerticalGroup(
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
irViewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGap(0, 299, Short.MAX_VALUE));
|
||||||
.addGap(0, 299, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
accelerationPanel.setToolTipText("MotionSensingEvent");
|
accelerationPanel.setToolTipText("MotionSensingEvent");
|
||||||
|
|
||||||
javax.swing.GroupLayout accelerationPanelLayout = new javax.swing.GroupLayout(accelerationPanel);
|
javax.swing.GroupLayout accelerationPanelLayout = new javax.swing.GroupLayout(
|
||||||
|
accelerationPanel);
|
||||||
accelerationPanel.setLayout(accelerationPanelLayout);
|
accelerationPanel.setLayout(accelerationPanelLayout);
|
||||||
accelerationPanelLayout.setHorizontalGroup(
|
accelerationPanelLayout.setHorizontalGroup(accelerationPanelLayout
|
||||||
accelerationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 279, Short.MAX_VALUE)
|
.addGap(0, 279, Short.MAX_VALUE));
|
||||||
);
|
accelerationPanelLayout.setVerticalGroup(accelerationPanelLayout
|
||||||
accelerationPanelLayout.setVerticalGroup(
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
accelerationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGap(0, 213, Short.MAX_VALUE));
|
||||||
.addGap(0, 213, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jTabbedPane1.addTab("Acceleration", accelerationPanel);
|
jTabbedPane1.addTab("Acceleration", accelerationPanel);
|
||||||
|
|
||||||
javax.swing.GroupLayout motionSensingPanelLayout = new javax.swing.GroupLayout(motionSensingPanel);
|
javax.swing.GroupLayout motionSensingPanelLayout = new javax.swing.GroupLayout(
|
||||||
|
motionSensingPanel);
|
||||||
motionSensingPanel.setLayout(motionSensingPanelLayout);
|
motionSensingPanel.setLayout(motionSensingPanelLayout);
|
||||||
motionSensingPanelLayout.setHorizontalGroup(
|
motionSensingPanelLayout.setHorizontalGroup(motionSensingPanelLayout
|
||||||
motionSensingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 279, Short.MAX_VALUE)
|
.addGap(0, 279, Short.MAX_VALUE));
|
||||||
);
|
motionSensingPanelLayout.setVerticalGroup(motionSensingPanelLayout
|
||||||
motionSensingPanelLayout.setVerticalGroup(
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
motionSensingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGap(0, 213, Short.MAX_VALUE));
|
||||||
.addGap(0, 213, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jTabbedPane1.addTab("Orientation", motionSensingPanel);
|
jTabbedPane1.addTab("Orientation", motionSensingPanel);
|
||||||
|
|
||||||
javax.swing.GroupLayout gForcePanelLayout = new javax.swing.GroupLayout(gForcePanel);
|
javax.swing.GroupLayout gForcePanelLayout = new javax.swing.GroupLayout(
|
||||||
|
gForcePanel);
|
||||||
gForcePanel.setLayout(gForcePanelLayout);
|
gForcePanel.setLayout(gForcePanelLayout);
|
||||||
gForcePanelLayout.setHorizontalGroup(
|
gForcePanelLayout.setHorizontalGroup(gForcePanelLayout
|
||||||
gForcePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 279, Short.MAX_VALUE)
|
.addGap(0, 279, Short.MAX_VALUE));
|
||||||
);
|
gForcePanelLayout.setVerticalGroup(gForcePanelLayout
|
||||||
gForcePanelLayout.setVerticalGroup(
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
gForcePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGap(0, 213, Short.MAX_VALUE));
|
||||||
.addGap(0, 213, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jTabbedPane1.addTab("GForce", gForcePanel);
|
jTabbedPane1.addTab("GForce", gForcePanel);
|
||||||
|
|
||||||
javax.swing.GroupLayout leftPanelLayout = new javax.swing.GroupLayout(leftPanel);
|
javax.swing.GroupLayout leftPanelLayout = new javax.swing.GroupLayout(
|
||||||
|
leftPanel);
|
||||||
leftPanel.setLayout(leftPanelLayout);
|
leftPanel.setLayout(leftPanelLayout);
|
||||||
leftPanelLayout.setHorizontalGroup(
|
leftPanelLayout.setHorizontalGroup(leftPanelLayout.createParallelGroup(
|
||||||
leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
javax.swing.GroupLayout.Alignment.LEADING).addComponent(
|
||||||
.addComponent(irViewPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
irViewPanel, javax.swing.GroupLayout.Alignment.TRAILING,
|
||||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
);
|
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
leftPanelLayout.setVerticalGroup(
|
.addComponent(jTabbedPane1,
|
||||||
leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
javax.swing.GroupLayout.DEFAULT_SIZE, 284,
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, leftPanelLayout.createSequentialGroup()
|
Short.MAX_VALUE));
|
||||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
|
leftPanelLayout
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.setVerticalGroup(leftPanelLayout
|
||||||
.addComponent(irViewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.createParallelGroup(
|
||||||
);
|
javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(
|
||||||
|
javax.swing.GroupLayout.Alignment.TRAILING,
|
||||||
|
leftPanelLayout
|
||||||
|
.createSequentialGroup()
|
||||||
|
.addComponent(
|
||||||
|
jTabbedPane1,
|
||||||
|
javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
|
238,
|
||||||
|
javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(
|
||||||
|
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(
|
||||||
|
irViewPanel,
|
||||||
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
|
Short.MAX_VALUE)));
|
||||||
|
|
||||||
jTabbedPane1.getAccessibleContext().setAccessibleName("Orientation");
|
jTabbedPane1.getAccessibleContext().setAccessibleName("Orientation");
|
||||||
|
|
||||||
rightPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
rightPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
rightPanel.setLayout(new javax.swing.BoxLayout(rightPanel, javax.swing.BoxLayout.LINE_AXIS));
|
rightPanel.setLayout(new javax.swing.BoxLayout(rightPanel,
|
||||||
|
javax.swing.BoxLayout.LINE_AXIS));
|
||||||
|
|
||||||
fixedWiimotePanel.setMaximumSize(new java.awt.Dimension(120, 32767));
|
fixedWiimotePanel.setMaximumSize(new java.awt.Dimension(120, 32767));
|
||||||
fixedWiimotePanel.setMinimumSize(new java.awt.Dimension(120, 100));
|
fixedWiimotePanel.setMinimumSize(new java.awt.Dimension(120, 100));
|
||||||
@@ -442,16 +482,15 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
buttonsPanel.setOpaque(false);
|
buttonsPanel.setOpaque(false);
|
||||||
buttonsPanel.setPreferredSize(new java.awt.Dimension(120, 484));
|
buttonsPanel.setPreferredSize(new java.awt.Dimension(120, 484));
|
||||||
|
|
||||||
javax.swing.GroupLayout buttonsPanelLayout = new javax.swing.GroupLayout(buttonsPanel);
|
javax.swing.GroupLayout buttonsPanelLayout = new javax.swing.GroupLayout(
|
||||||
|
buttonsPanel);
|
||||||
buttonsPanel.setLayout(buttonsPanelLayout);
|
buttonsPanel.setLayout(buttonsPanelLayout);
|
||||||
buttonsPanelLayout.setHorizontalGroup(
|
buttonsPanelLayout.setHorizontalGroup(buttonsPanelLayout
|
||||||
buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 120, Short.MAX_VALUE)
|
.addGap(0, 120, Short.MAX_VALUE));
|
||||||
);
|
buttonsPanelLayout.setVerticalGroup(buttonsPanelLayout
|
||||||
buttonsPanelLayout.setVerticalGroup(
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGap(0, 484, Short.MAX_VALUE));
|
||||||
.addGap(0, 484, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
fixedWiimotePanel.add(buttonsPanel);
|
fixedWiimotePanel.add(buttonsPanel);
|
||||||
buttonsPanel.setBounds(0, 0, 120, 484);
|
buttonsPanel.setBounds(0, 0, 120, 484);
|
||||||
@@ -471,7 +510,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
activateRumbleIRPanel.add(toggleRumbleButton);
|
activateRumbleIRPanel.add(toggleRumbleButton);
|
||||||
|
|
||||||
toggleIRTrackingButton.setText("Activate IR Tracking");
|
toggleIRTrackingButton.setText("Activate IR Tracking");
|
||||||
toggleIRTrackingButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
toggleIRTrackingButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
toggleIRTrackingButtonMousePressed(evt);
|
toggleIRTrackingButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -480,8 +520,10 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
|
|
||||||
controlsPanel.add(activateRumbleIRPanel);
|
controlsPanel.add(activateRumbleIRPanel);
|
||||||
|
|
||||||
toggleMotionSensingTrackingButton.setText("Activate motion sensing Tracking");
|
toggleMotionSensingTrackingButton
|
||||||
toggleMotionSensingTrackingButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
.setText("Activate motion sensing Tracking");
|
||||||
|
toggleMotionSensingTrackingButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
toggleMotionSensingTrackingButtonMousePressed(evt);
|
toggleMotionSensingTrackingButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -491,7 +533,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
controlsPanel.add(activateMotionSensingPanel);
|
controlsPanel.add(activateMotionSensingPanel);
|
||||||
|
|
||||||
toggleSmoothingButton.setText("Activate Smoothing");
|
toggleSmoothingButton.setText("Activate Smoothing");
|
||||||
toggleSmoothingButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
toggleSmoothingButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
toggleSmoothingButtonMousePressed(evt);
|
toggleSmoothingButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -499,7 +542,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
activateSmoothingContinuousPanel.add(toggleSmoothingButton);
|
activateSmoothingContinuousPanel.add(toggleSmoothingButton);
|
||||||
|
|
||||||
toggleContinuousButton.setText("Activate Continuous");
|
toggleContinuousButton.setText("Activate Continuous");
|
||||||
toggleContinuousButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
toggleContinuousButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
toggleContinuousButtonMousePressed(evt);
|
toggleContinuousButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -551,11 +595,13 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
controlsPanel.add(setLedsPanel);
|
controlsPanel.add(setLedsPanel);
|
||||||
|
|
||||||
alphaSmoothingTextField.setMinimumSize(new java.awt.Dimension(100, 20));
|
alphaSmoothingTextField.setMinimumSize(new java.awt.Dimension(100, 20));
|
||||||
alphaSmoothingTextField.setPreferredSize(new java.awt.Dimension(100, 20));
|
alphaSmoothingTextField
|
||||||
|
.setPreferredSize(new java.awt.Dimension(100, 20));
|
||||||
setAlphaSmoothingPanel.add(alphaSmoothingTextField);
|
setAlphaSmoothingPanel.add(alphaSmoothingTextField);
|
||||||
|
|
||||||
alphaSmoothingButton.setText("Set alpha smoothing");
|
alphaSmoothingButton.setText("Set alpha smoothing");
|
||||||
alphaSmoothingButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
alphaSmoothingButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
alphaSmoothingButtonMousePressed(evt);
|
alphaSmoothingButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -564,12 +610,15 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
|
|
||||||
controlsPanel.add(setAlphaSmoothingPanel);
|
controlsPanel.add(setAlphaSmoothingPanel);
|
||||||
|
|
||||||
orientationThresholdTextField.setMinimumSize(new java.awt.Dimension(100, 20));
|
orientationThresholdTextField.setMinimumSize(new java.awt.Dimension(
|
||||||
orientationThresholdTextField.setPreferredSize(new java.awt.Dimension(100, 20));
|
100, 20));
|
||||||
|
orientationThresholdTextField.setPreferredSize(new java.awt.Dimension(
|
||||||
|
100, 20));
|
||||||
setOrientationThresholdPanel.add(orientationThresholdTextField);
|
setOrientationThresholdPanel.add(orientationThresholdTextField);
|
||||||
|
|
||||||
orientationThresholdButton.setText("Set orientation threshold");
|
orientationThresholdButton.setText("Set orientation threshold");
|
||||||
orientationThresholdButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
orientationThresholdButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
orientationThresholdButtonMousePressed(evt);
|
orientationThresholdButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -578,11 +627,13 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
|
|
||||||
controlsPanel.add(setOrientationThresholdPanel);
|
controlsPanel.add(setOrientationThresholdPanel);
|
||||||
|
|
||||||
accelerationThresholdTextField.setPreferredSize(new java.awt.Dimension(100, 20));
|
accelerationThresholdTextField.setPreferredSize(new java.awt.Dimension(
|
||||||
|
100, 20));
|
||||||
setAccelerationThresholdPanel.add(accelerationThresholdTextField);
|
setAccelerationThresholdPanel.add(accelerationThresholdTextField);
|
||||||
|
|
||||||
accelerationThresholdButton.setText("Set acceleration threshold");
|
accelerationThresholdButton.setText("Set acceleration threshold");
|
||||||
accelerationThresholdButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
accelerationThresholdButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
accelerationThresholdButtonMousePressed(evt);
|
accelerationThresholdButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -610,7 +661,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
controlsPanel.add(getStatusPanel);
|
controlsPanel.add(getStatusPanel);
|
||||||
|
|
||||||
setIrSensitivySpinner.setPreferredSize(new java.awt.Dimension(50, 18));
|
setIrSensitivySpinner.setPreferredSize(new java.awt.Dimension(50, 18));
|
||||||
setIrSensitivySpinner.addChangeListener(new javax.swing.event.ChangeListener() {
|
setIrSensitivySpinner
|
||||||
|
.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||||
setIrSensitivySpinnerStateChanged(evt);
|
setIrSensitivySpinnerStateChanged(evt);
|
||||||
}
|
}
|
||||||
@@ -618,7 +670,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
setIrSensitivyPanel.add(setIrSensitivySpinner);
|
setIrSensitivyPanel.add(setIrSensitivySpinner);
|
||||||
|
|
||||||
setIrSensitivyButton.setText("SetIrSensivity");
|
setIrSensitivyButton.setText("SetIrSensivity");
|
||||||
setIrSensitivyButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
setIrSensitivyButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
setIrSensitivyButtonMousePressed(evt);
|
setIrSensitivyButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -636,7 +689,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
controlsPanel.add(setIrSensitivyPanel);
|
controlsPanel.add(setIrSensitivyPanel);
|
||||||
|
|
||||||
normalTimeoutSpinner.setPreferredSize(new java.awt.Dimension(40, 18));
|
normalTimeoutSpinner.setPreferredSize(new java.awt.Dimension(40, 18));
|
||||||
normalTimeoutSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
|
normalTimeoutSpinner
|
||||||
|
.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||||
normalTimeoutSpinnerStateChanged(evt);
|
normalTimeoutSpinnerStateChanged(evt);
|
||||||
}
|
}
|
||||||
@@ -646,8 +700,10 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
normalTimeoutText.setText("Normal timeout");
|
normalTimeoutText.setText("Normal timeout");
|
||||||
setTimeoutPanel.add(normalTimeoutText);
|
setTimeoutPanel.add(normalTimeoutText);
|
||||||
|
|
||||||
expansionHandshakeTimeoutSpinner.setPreferredSize(new java.awt.Dimension(40, 18));
|
expansionHandshakeTimeoutSpinner
|
||||||
expansionHandshakeTimeoutSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
|
.setPreferredSize(new java.awt.Dimension(40, 18));
|
||||||
|
expansionHandshakeTimeoutSpinner
|
||||||
|
.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||||
expansionHandshakeTimeoutSpinnerStateChanged(evt);
|
expansionHandshakeTimeoutSpinnerStateChanged(evt);
|
||||||
}
|
}
|
||||||
@@ -660,7 +716,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
controlsPanel.add(setTimeoutPanel);
|
controlsPanel.add(setTimeoutPanel);
|
||||||
|
|
||||||
toggleSensorBarPositionButton.setText("Set sensor bar above");
|
toggleSensorBarPositionButton.setText("Set sensor bar above");
|
||||||
toggleSensorBarPositionButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
toggleSensorBarPositionButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
toggleSensorBarPositionButtonMousePressed(evt);
|
toggleSensorBarPositionButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -668,7 +725,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
setIRConfPanel.add(toggleSensorBarPositionButton);
|
setIRConfPanel.add(toggleSensorBarPositionButton);
|
||||||
|
|
||||||
toggleScreenAspectRatioButton.setText("Set screen aspect ratio 4/3");
|
toggleScreenAspectRatioButton.setText("Set screen aspect ratio 4/3");
|
||||||
toggleScreenAspectRatioButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
toggleScreenAspectRatioButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
toggleScreenAspectRatioButtonMousePressed(evt);
|
toggleScreenAspectRatioButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -693,7 +751,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
setVirtualResolutionPanel.add(yResolutionTextField);
|
setVirtualResolutionPanel.add(yResolutionTextField);
|
||||||
|
|
||||||
setVirtualResolutionButton.setText("Set virtual resolution");
|
setVirtualResolutionButton.setText("Set virtual resolution");
|
||||||
setVirtualResolutionButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
setVirtualResolutionButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
setVirtualResolutionButtonMousePressed(evt);
|
setVirtualResolutionButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -703,7 +762,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
controlsPanel.add(setVirtualResolutionPanel);
|
controlsPanel.add(setVirtualResolutionPanel);
|
||||||
|
|
||||||
mouseIRControlButton.setText("Start infrared mouse control");
|
mouseIRControlButton.setText("Start infrared mouse control");
|
||||||
mouseIRControlButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
mouseIRControlButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
mouseIRControlButtonMousePressed(evt);
|
mouseIRControlButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -716,7 +776,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
exPansionPanel.add(expansionText);
|
exPansionPanel.add(expansionText);
|
||||||
|
|
||||||
showExpansionWiimoteButton.setText("No expansion connected");
|
showExpansionWiimoteButton.setText("No expansion connected");
|
||||||
showExpansionWiimoteButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
showExpansionWiimoteButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
showExpansionWiimoteButtonMousePressed(evt);
|
showExpansionWiimoteButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -726,7 +787,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
controlsPanel.add(exPansionPanel);
|
controlsPanel.add(exPansionPanel);
|
||||||
|
|
||||||
reconnectWiimotesButton.setText("Reconnect wiimote");
|
reconnectWiimotesButton.setText("Reconnect wiimote");
|
||||||
reconnectWiimotesButton.addMouseListener(new java.awt.event.MouseAdapter() {
|
reconnectWiimotesButton
|
||||||
|
.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
public void mousePressed(java.awt.event.MouseEvent evt) {
|
||||||
reconnectWiimotesButtonMousePressed(evt);
|
reconnectWiimotesButtonMousePressed(evt);
|
||||||
}
|
}
|
||||||
@@ -745,24 +807,40 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
|
|
||||||
rightPanel.add(controlsPanel);
|
rightPanel.add(controlsPanel);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
|
||||||
|
getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.setHorizontalGroup(layout
|
||||||
.addGroup(layout.createSequentialGroup()
|
.createParallelGroup(
|
||||||
.addComponent(leftPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addGroup(
|
||||||
.addComponent(rightPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 498, Short.MAX_VALUE))
|
layout
|
||||||
);
|
.createSequentialGroup()
|
||||||
layout.setVerticalGroup(
|
.addComponent(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
leftPanel,
|
||||||
.addComponent(leftPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
.addComponent(rightPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 573, Short.MAX_VALUE)
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
);
|
Short.MAX_VALUE)
|
||||||
|
.addPreferredGap(
|
||||||
|
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(
|
||||||
|
rightPanel,
|
||||||
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
|
498, Short.MAX_VALUE)));
|
||||||
|
layout.setVerticalGroup(layout.createParallelGroup(
|
||||||
|
javax.swing.GroupLayout.Alignment.LEADING).addComponent(
|
||||||
|
leftPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
|
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(rightPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
|
573, Short.MAX_VALUE));
|
||||||
|
|
||||||
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
|
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit()
|
||||||
setBounds((screenSize.width-800)/2, (screenSize.height-600)/2, 800, 600);
|
.getScreenSize();
|
||||||
|
setBounds((screenSize.width - 800) / 2, (screenSize.height - 600) / 2,
|
||||||
|
800, 600);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void toggleRumbleButtonMousePressed(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_toggleRumbleButtonMousePressed
|
private void toggleRumbleButtonMousePressed(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_toggleRumbleButtonMousePressed
|
||||||
if (toggleRumbleButton.isEnabled()) {
|
if (toggleRumbleButton.isEnabled()) {
|
||||||
wiimote.activateRumble();
|
wiimote.activateRumble();
|
||||||
@@ -777,7 +855,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_toggleRumbleButtonMousePressed
|
}// GEN-LAST:event_toggleRumbleButtonMousePressed
|
||||||
|
|
||||||
private void toggleIRTrackingButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toggleIRTrackingButtonMousePressed
|
private void toggleIRTrackingButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_toggleIRTrackingButtonMousePressed
|
||||||
if (toggleIRTrackingButton.isEnabled()) {
|
if (toggleIRTrackingButton.isEnabled()) {
|
||||||
wiimote.activateIRTRacking();
|
wiimote.activateIRTRacking();
|
||||||
toggleIRTrackingButton.setEnabled(false);
|
toggleIRTrackingButton.setEnabled(false);
|
||||||
@@ -792,16 +871,19 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_toggleIRTrackingButtonMousePressed
|
}// GEN-LAST:event_toggleIRTrackingButtonMousePressed
|
||||||
|
|
||||||
private void toggleMotionSensingTrackingButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toggleMotionSensingTrackingButtonMousePressed
|
private void toggleMotionSensingTrackingButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_toggleMotionSensingTrackingButtonMousePressed
|
||||||
if (toggleMotionSensingTrackingButton.isEnabled()) {
|
if (toggleMotionSensingTrackingButton.isEnabled()) {
|
||||||
wiimote.activateMotionSensing();
|
wiimote.activateMotionSensing();
|
||||||
toggleMotionSensingTrackingButton.setEnabled(false);
|
toggleMotionSensingTrackingButton.setEnabled(false);
|
||||||
toggleMotionSensingTrackingButton.setText("Deactivate Motion Sensing");
|
toggleMotionSensingTrackingButton
|
||||||
|
.setText("Deactivate Motion Sensing");
|
||||||
messageText.setText("Motion Sensing activated");
|
messageText.setText("Motion Sensing activated");
|
||||||
} else {
|
} else {
|
||||||
wiimote.deactivateMotionSensing();
|
wiimote.deactivateMotionSensing();
|
||||||
toggleMotionSensingTrackingButton.setEnabled(true);
|
toggleMotionSensingTrackingButton.setEnabled(true);
|
||||||
toggleMotionSensingTrackingButton.setText("Activate Motion Sensing");
|
toggleMotionSensingTrackingButton
|
||||||
|
.setText("Activate Motion Sensing");
|
||||||
((OrientationPanel) motionSensingPanel).onDisconnectionEvent(null);
|
((OrientationPanel) motionSensingPanel).onDisconnectionEvent(null);
|
||||||
((GForcePanel) gForcePanel).onDisconnectionEvent(null);
|
((GForcePanel) gForcePanel).onDisconnectionEvent(null);
|
||||||
messageText.setText("Motion Sensing deactivated");
|
messageText.setText("Motion Sensing deactivated");
|
||||||
@@ -822,7 +904,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_toggleSmoothingButtonMousePressed
|
}// GEN-LAST:event_toggleSmoothingButtonMousePressed
|
||||||
|
|
||||||
private void toggleContinuousButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toggleContinuousButtonMousePressed
|
private void toggleContinuousButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_toggleContinuousButtonMousePressed
|
||||||
if (toggleContinuousButton.isEnabled()) {
|
if (toggleContinuousButton.isEnabled()) {
|
||||||
wiimote.activateContinuous();
|
wiimote.activateContinuous();
|
||||||
toggleContinuousButton.setEnabled(false);
|
toggleContinuousButton.setEnabled(false);
|
||||||
@@ -880,27 +963,33 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
wiimote.setAlphaSmoothingValue(nb);
|
wiimote.setAlphaSmoothingValue(nb);
|
||||||
messageText.setText("Alpha smoothing set to " + nb);
|
messageText.setText("Alpha smoothing set to " + nb);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
messageText.setText("Number is not a float, alpha smoothing not set !");
|
messageText
|
||||||
|
.setText("Number is not a float, alpha smoothing not set !");
|
||||||
}
|
}
|
||||||
}// GEN-LAST:event_alphaSmoothingButtonMousePressed
|
}// GEN-LAST:event_alphaSmoothingButtonMousePressed
|
||||||
|
|
||||||
private void orientationThresholdButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_orientationThresholdButtonMousePressed
|
private void orientationThresholdButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_orientationThresholdButtonMousePressed
|
||||||
try {
|
try {
|
||||||
float nb = Float.parseFloat(orientationThresholdTextField.getText());
|
float nb = Float
|
||||||
|
.parseFloat(orientationThresholdTextField.getText());
|
||||||
wiimote.setOrientationThreshold(nb);
|
wiimote.setOrientationThreshold(nb);
|
||||||
messageText.setText("Orientation threshold set to " + nb);
|
messageText.setText("Orientation threshold set to " + nb);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
messageText.setText("Number is not a float, orientation threshold not set !");
|
messageText
|
||||||
|
.setText("Number is not a float, orientation threshold not set !");
|
||||||
}
|
}
|
||||||
}// GEN-LAST:event_orientationThresholdButtonMousePressed
|
}// GEN-LAST:event_orientationThresholdButtonMousePressed
|
||||||
|
|
||||||
private void accelerationThresholdButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_accelerationThresholdButtonMousePressed
|
private void accelerationThresholdButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_accelerationThresholdButtonMousePressed
|
||||||
try {
|
try {
|
||||||
int nb = Integer.parseInt(accelerationThresholdTextField.getText());
|
int nb = Integer.parseInt(accelerationThresholdTextField.getText());
|
||||||
wiimote.setAccelerationThreshold(nb);
|
wiimote.setAccelerationThreshold(nb);
|
||||||
messageText.setText("Acceleration threshold set to " + nb);
|
messageText.setText("Acceleration threshold set to " + nb);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
messageText.setText("Number is not an integer, acceleration threshold not set !");
|
messageText
|
||||||
|
.setText("Number is not an integer, acceleration threshold not set !");
|
||||||
}
|
}
|
||||||
}// GEN-LAST:event_accelerationThresholdButtonMousePressed
|
}// GEN-LAST:event_accelerationThresholdButtonMousePressed
|
||||||
|
|
||||||
@@ -913,7 +1002,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_getStatusButtonMousePressed
|
}// GEN-LAST:event_getStatusButtonMousePressed
|
||||||
|
|
||||||
private void toggleSensorBarPositionButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toggleSensorBarPositionButtonMousePressed
|
private void toggleSensorBarPositionButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_toggleSensorBarPositionButtonMousePressed
|
||||||
if (toggleSensorBarPositionButton.isEnabled()) {
|
if (toggleSensorBarPositionButton.isEnabled()) {
|
||||||
wiimote.setSensorBarBelowScreen();
|
wiimote.setSensorBarBelowScreen();
|
||||||
toggleSensorBarPositionButton.setEnabled(false);
|
toggleSensorBarPositionButton.setEnabled(false);
|
||||||
@@ -927,28 +1017,34 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_toggleSensorBarPositionButtonMousePressed
|
}// GEN-LAST:event_toggleSensorBarPositionButtonMousePressed
|
||||||
|
|
||||||
private void toggleScreenAspectRatioButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_toggleScreenAspectRatioButtonMousePressed
|
private void toggleScreenAspectRatioButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_toggleScreenAspectRatioButtonMousePressed
|
||||||
if (toggleScreenAspectRatioButton.isEnabled()) {
|
if (toggleScreenAspectRatioButton.isEnabled()) {
|
||||||
wiimote.setScreenAspectRatio43();
|
wiimote.setScreenAspectRatio43();
|
||||||
toggleScreenAspectRatioButton.setEnabled(false);
|
toggleScreenAspectRatioButton.setEnabled(false);
|
||||||
toggleScreenAspectRatioButton.setText("Set screen aspect ratio 16/9");
|
toggleScreenAspectRatioButton
|
||||||
|
.setText("Set screen aspect ratio 16/9");
|
||||||
messageText.setText("creen aspect ratio to 4/3");
|
messageText.setText("creen aspect ratio to 4/3");
|
||||||
} else {
|
} else {
|
||||||
wiimote.setScreenAspectRatio169();
|
wiimote.setScreenAspectRatio169();
|
||||||
toggleScreenAspectRatioButton.setEnabled(true);
|
toggleScreenAspectRatioButton.setEnabled(true);
|
||||||
toggleScreenAspectRatioButton.setText("Set screen aspect ratio 4/3");
|
toggleScreenAspectRatioButton
|
||||||
|
.setText("Set screen aspect ratio 4/3");
|
||||||
messageText.setText("Screen aspect ratio to 16/9");
|
messageText.setText("Screen aspect ratio to 16/9");
|
||||||
}
|
}
|
||||||
}// GEN-LAST:event_toggleScreenAspectRatioButtonMousePressed
|
}// GEN-LAST:event_toggleScreenAspectRatioButtonMousePressed
|
||||||
|
|
||||||
private void setVirtualResolutionButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_setVirtualResolutionButtonMousePressed
|
private void setVirtualResolutionButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_setVirtualResolutionButtonMousePressed
|
||||||
try {
|
try {
|
||||||
int xres = Integer.parseInt(xResolutionTextField.getText());
|
int xres = Integer.parseInt(xResolutionTextField.getText());
|
||||||
int yres = Integer.parseInt(yResolutionTextField.getText());
|
int yres = Integer.parseInt(yResolutionTextField.getText());
|
||||||
wiimote.setVirtualResolution(xres, yres);
|
wiimote.setVirtualResolution(xres, yres);
|
||||||
messageText.setText("Virtual resolution set to " + xres + "X" + yres);
|
messageText.setText("Virtual resolution set to " + xres + "X"
|
||||||
|
+ yres);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
messageText.setText("A number in the virtual resolution is not an integer. Virtual resolution not set!");
|
messageText
|
||||||
|
.setText("A number in the virtual resolution is not an integer. Virtual resolution not set!");
|
||||||
}
|
}
|
||||||
}// GEN-LAST:event_setVirtualResolutionButtonMousePressed
|
}// GEN-LAST:event_setVirtualResolutionButtonMousePressed
|
||||||
|
|
||||||
@@ -960,7 +1056,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
robot = new Robot();
|
robot = new Robot();
|
||||||
messageText.setText("Infrared mouse control started");
|
messageText.setText("Infrared mouse control started");
|
||||||
} catch (AWTException ex) {
|
} catch (AWTException ex) {
|
||||||
Logger.getLogger(WiiuseJGuiTest.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(WiiuseJGuiTest.class.getName()).log(
|
||||||
|
Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mouseIRControlButton.setEnabled(true);
|
mouseIRControlButton.setEnabled(true);
|
||||||
@@ -970,7 +1067,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_mouseIRControlButtonMousePressed
|
}// GEN-LAST:event_mouseIRControlButtonMousePressed
|
||||||
|
|
||||||
private void normalTimeoutSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_normalTimeoutSpinnerStateChanged
|
private void normalTimeoutSpinnerStateChanged(
|
||||||
|
javax.swing.event.ChangeEvent evt) {// GEN-FIRST:event_normalTimeoutSpinnerStateChanged
|
||||||
String value = normalTimeoutSpinner.getValue().toString();
|
String value = normalTimeoutSpinner.getValue().toString();
|
||||||
boolean isInt = true;
|
boolean isInt = true;
|
||||||
int valueInt = 0;
|
int valueInt = 0;
|
||||||
@@ -989,7 +1087,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_normalTimeoutSpinnerStateChanged
|
}// GEN-LAST:event_normalTimeoutSpinnerStateChanged
|
||||||
|
|
||||||
private void expansionHandshakeTimeoutSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_expansionHandshakeTimeoutSpinnerStateChanged
|
private void expansionHandshakeTimeoutSpinnerStateChanged(
|
||||||
|
javax.swing.event.ChangeEvent evt) {// GEN-FIRST:event_expansionHandshakeTimeoutSpinnerStateChanged
|
||||||
String value = expansionHandshakeTimeoutSpinner.getValue().toString();
|
String value = expansionHandshakeTimeoutSpinner.getValue().toString();
|
||||||
boolean isInt = true;
|
boolean isInt = true;
|
||||||
int valueInt = 0;
|
int valueInt = 0;
|
||||||
@@ -1008,7 +1107,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_expansionHandshakeTimeoutSpinnerStateChanged
|
}// GEN-LAST:event_expansionHandshakeTimeoutSpinnerStateChanged
|
||||||
|
|
||||||
private void setIrSensitivySpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_setIrSensitivySpinnerStateChanged
|
private void setIrSensitivySpinnerStateChanged(
|
||||||
|
javax.swing.event.ChangeEvent evt) {// GEN-FIRST:event_setIrSensitivySpinnerStateChanged
|
||||||
String value = setIrSensitivySpinner.getValue().toString();
|
String value = setIrSensitivySpinner.getValue().toString();
|
||||||
boolean isInt = true;
|
boolean isInt = true;
|
||||||
int valueInt = 0;
|
int valueInt = 0;
|
||||||
@@ -1035,14 +1135,16 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
valueInt = Integer.parseInt(value);
|
valueInt = Integer.parseInt(value);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
isInt = false;
|
isInt = false;
|
||||||
messageText.setText("Wrong value for IR sensitivity. It must be an int !");
|
messageText
|
||||||
|
.setText("Wrong value for IR sensitivity. It must be an int !");
|
||||||
}
|
}
|
||||||
if (isInt) {
|
if (isInt) {
|
||||||
if (valueInt >= 1 && valueInt <= 5) {
|
if (valueInt >= 1 && valueInt <= 5) {
|
||||||
wiimote.setIrSensitivity(valueInt);
|
wiimote.setIrSensitivity(valueInt);
|
||||||
messageText.setText("IR senstivity set to: " + valueInt + ".");
|
messageText.setText("IR senstivity set to: " + valueInt + ".");
|
||||||
} else {
|
} else {
|
||||||
messageText.setText("Wrong value for IR senstivity. It muset be between 1 and 5 !");
|
messageText
|
||||||
|
.setText("Wrong value for IR senstivity. It muset be between 1 and 5 !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}// GEN-LAST:event_setIrSensitivyButtonMousePressed
|
}// GEN-LAST:event_setIrSensitivyButtonMousePressed
|
||||||
@@ -1056,7 +1158,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
valueInt = Short.parseShort(value);
|
valueInt = Short.parseShort(value);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
isInt = false;
|
isInt = false;
|
||||||
messageText.setText("Wrong value for normal timeout. It must be an int !");
|
messageText
|
||||||
|
.setText("Wrong value for normal timeout. It must be an int !");
|
||||||
}
|
}
|
||||||
// get expansion handshake timeout
|
// get expansion handshake timeout
|
||||||
String value2 = expansionHandshakeTimeoutSpinner.getValue().toString();
|
String value2 = expansionHandshakeTimeoutSpinner.getValue().toString();
|
||||||
@@ -1066,22 +1169,27 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
valueInt2 = Short.parseShort(value2);
|
valueInt2 = Short.parseShort(value2);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
isInt2 = false;
|
isInt2 = false;
|
||||||
messageText.setText("Wrong value for expansion handshake timeout. It must be an int !");
|
messageText
|
||||||
|
.setText("Wrong value for expansion handshake timeout. It must be an int !");
|
||||||
}
|
}
|
||||||
if (isInt && isInt2) {
|
if (isInt && isInt2) {
|
||||||
if (valueInt > 0 && valueInt2 > 0) {
|
if (valueInt > 0 && valueInt2 > 0) {
|
||||||
wiimote.setTimeout(valueInt, valueInt2);
|
wiimote.setTimeout(valueInt, valueInt2);
|
||||||
messageText.setText("Normal timeout set to: " + valueInt + " and expansion handshake timeout set to: " + valueInt2 + "!");
|
messageText.setText("Normal timeout set to: " + valueInt
|
||||||
|
+ " and expansion handshake timeout set to: "
|
||||||
|
+ valueInt2 + "!");
|
||||||
} else {
|
} else {
|
||||||
messageText.setText("Wrong value for one of the timeout value. It must be an integer > 0 !");
|
messageText
|
||||||
|
.setText("Wrong value for one of the timeout value. It must be an integer > 0 !");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}// GEN-LAST:event_setTimeoutButtonMousePressed
|
}// GEN-LAST:event_setTimeoutButtonMousePressed
|
||||||
|
|
||||||
private void reconnectWiimotesButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reconnectWiimotesButtonMousePressed
|
private void reconnectWiimotesButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_reconnectWiimotesButtonMousePressed
|
||||||
// stop manager
|
// stop manager
|
||||||
WiiUseApiManager manager = WiiUseApiManager.getInstance();
|
WiiUseApiManager manager = WiiUseApiManager.getInstance();
|
||||||
manager.shutdown();
|
manager.definitiveShutdown();
|
||||||
|
|
||||||
// unregister previous wiimote
|
// unregister previous wiimote
|
||||||
if (wiimote != null) {
|
if (wiimote != null) {
|
||||||
@@ -1102,7 +1210,8 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
// setup buttons In first state
|
// setup buttons In first state
|
||||||
toggleRumbleButton.setText("Activate Rumble");
|
toggleRumbleButton.setText("Activate Rumble");
|
||||||
toggleRumbleButton.setEnabled(true);
|
toggleRumbleButton.setEnabled(true);
|
||||||
toggleMotionSensingTrackingButton.setText("Activate motion sensing Tracking");
|
toggleMotionSensingTrackingButton
|
||||||
|
.setText("Activate motion sensing Tracking");
|
||||||
toggleMotionSensingTrackingButton.setEnabled(true);
|
toggleMotionSensingTrackingButton.setEnabled(true);
|
||||||
toggleIRTrackingButton.setText("Activate IR Tracking");
|
toggleIRTrackingButton.setText("Activate IR Tracking");
|
||||||
toggleIRTrackingButton.setEnabled(true);
|
toggleIRTrackingButton.setEnabled(true);
|
||||||
@@ -1131,9 +1240,11 @@ public class WiiuseJGuiTest extends javax.swing.JFrame implements WiimoteListene
|
|||||||
}
|
}
|
||||||
}// GEN-LAST:event_reconnectWiimotesButtonMousePressed
|
}// GEN-LAST:event_reconnectWiimotesButtonMousePressed
|
||||||
|
|
||||||
private void showExpansionWiimoteButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_showExpansionWiimoteButtonMousePressed
|
private void showExpansionWiimoteButtonMousePressed(
|
||||||
|
java.awt.event.MouseEvent evt) {// GEN-FIRST:event_showExpansionWiimoteButtonMousePressed
|
||||||
if (expansionFrame != null) {
|
if (expansionFrame != null) {
|
||||||
if (showExpansionWiimoteButton.isEnabled()) {//expansion frame not shown
|
if (showExpansionWiimoteButton.isEnabled()) {// expansion frame
|
||||||
|
// not shown
|
||||||
// show it
|
// show it
|
||||||
expansionFrame.setEnabled(true);
|
expansionFrame.setEnabled(true);
|
||||||
expansionFrame.setVisible(true);
|
expansionFrame.setVisible(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user