Fixed compile warnings

This commit is contained in:
Endolf 2018-05-31 20:36:30 +01:00
parent 67902800ab
commit 466e4a6bdb
7 changed files with 82 additions and 48 deletions

View file

@ -46,6 +46,7 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
import net.java.games.input.Component;
import net.java.games.input.Controller;
@ -55,7 +56,10 @@ import net.java.games.input.Event;
import net.java.games.input.Version;
public class ControllerEventTest extends JFrame{
private static final long serialVersionUID = -8266185848160199092L;
private static abstract class AxisPanel extends JPanel{
private static final long serialVersionUID = -6200599064870672000L;
Component axis;
float data;
@ -79,6 +83,7 @@ public class ControllerEventTest extends JFrame{
}
private static class DigitalAxisPanel extends AxisPanel {
private static final long serialVersionUID = -4729666037860134626L;
JLabel digitalState = new JLabel("<unread>");
public DigitalAxisPanel(Component ax) {
@ -102,6 +107,7 @@ public class ControllerEventTest extends JFrame{
}
private static class DigitalHatPanel extends AxisPanel {
private static final long serialVersionUID = -6582605379682496832L;
JLabel digitalState = new JLabel("<unread>");
public DigitalHatPanel(Component ax) {
@ -145,6 +151,7 @@ public class ControllerEventTest extends JFrame{
}
}
private static class AnalogAxisPanel extends AxisPanel {
private static final long serialVersionUID = 7536173405896285590L;
JLabel analogState = new JLabel("<unread>");
public AnalogAxisPanel(Component ax) {
@ -164,8 +171,9 @@ public class ControllerEventTest extends JFrame{
private static class ControllerWindow extends JFrame {
private static final long serialVersionUID = 8623977198558568961L;
Controller ca;
Map axes_to_panels = new HashMap();
Map<Component, AxisPanel> axes_to_panels = new HashMap<>();
boolean disabled = false;
public ControllerWindow(JFrame frame,Controller ca){
@ -207,7 +215,7 @@ public class ControllerEventTest extends JFrame{
}
private void addAxis(JPanel p, Component ax){
JPanel p2;
AxisPanel p2;
if (ax.isAnalog()) {
p2 = new AnalogAxisPanel(ax);
} else {
@ -234,14 +242,14 @@ public class ControllerEventTest extends JFrame{
EventQueue event_queue = ca.getEventQueue();
Event event = new Event();
while (event_queue.getNextEvent(event)) {
AxisPanel panel = (AxisPanel)axes_to_panels.get(event.getComponent());
AxisPanel panel = axes_to_panels.get(event.getComponent());
panel.setPollData(event.getValue());
}
}
}
static final long HEARTBEATMS =100; // 10th of a second
List controllers = new ArrayList();
List<ControllerWindow> controllers = new ArrayList<>();
public ControllerEventTest() {
super("Controller Event Test. Version: " + Version.getVersion());
@ -251,14 +259,12 @@ public class ControllerEventTest extends JFrame{
makeController(ca[i]);
}
new Thread(new Runnable() {
public void run(){
new Thread(() -> {
try {
while(true){
for(Iterator i=controllers.iterator();i.hasNext();){
for(Iterator<ControllerWindow> i=controllers.iterator();i.hasNext();){
try {
ControllerWindow cw = (ControllerWindow)i.next();
cw.poll();
i.next().poll();
} catch (Exception e) {
e.printStackTrace();
}
@ -268,11 +274,10 @@ public class ControllerEventTest extends JFrame{
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
pack();
setSize(400,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
}

View file

@ -49,13 +49,17 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
import net.java.games.input.Component;
import net.java.games.input.Controller;
import net.java.games.input.ControllerEnvironment;
public class ControllerReadTest extends JFrame{
private static final long serialVersionUID = -7129976919159465311L;
private abstract static class AxisPanel extends JPanel{
private static final long serialVersionUID = -2117191506803328790L;
Component axis;
float data;
@ -79,6 +83,7 @@ public class ControllerReadTest extends JFrame{
}
private static class DigitalAxisPanel extends AxisPanel {
private static final long serialVersionUID = -4006900519933869168L;
JLabel digitalState = new JLabel("<unread>");
public DigitalAxisPanel(Component ax) {
@ -102,6 +107,7 @@ public class ControllerReadTest extends JFrame{
}
private static class DigitalHatPanel extends AxisPanel {
private static final long serialVersionUID = -3293100130201231029L;
JLabel digitalState = new JLabel("<unread>");
public DigitalHatPanel(Component ax) {
@ -145,6 +151,7 @@ public class ControllerReadTest extends JFrame{
}
}
private static class AnalogAxisPanel extends AxisPanel {
private static final long serialVersionUID = -3220244985697453835L;
JLabel analogState = new JLabel("<unread>");
public AnalogAxisPanel(Component ax) {
@ -164,8 +171,9 @@ public class ControllerReadTest extends JFrame{
private static class ControllerWindow extends JFrame {
private static final long serialVersionUID = 5812903945250431578L;
Controller ca;
List axisList = new ArrayList();
List<AxisPanel> axisList = new ArrayList<>();
boolean disabled = false;
public ControllerWindow(JFrame frame,Controller ca){
@ -207,7 +215,7 @@ public class ControllerReadTest extends JFrame{
}
private void addAxis(JPanel p, Component ax){
JPanel p2;
AxisPanel p2;
if (ax.isAnalog()) {
p2 = new AnalogAxisPanel(ax);
} else {
@ -233,9 +241,9 @@ public class ControllerReadTest extends JFrame{
setDisabled(false);
}
//System.out.println("Polled "+ca.getName());
for(Iterator i =axisList.iterator();i.hasNext();){
for(Iterator<AxisPanel> i =axisList.iterator();i.hasNext();){
try {
((AxisPanel)i.next()).poll();
i.next().poll();
}catch (Exception e) {
e.printStackTrace();
}
@ -244,7 +252,7 @@ public class ControllerReadTest extends JFrame{
}
static final long HEARTBEATMS =100; // 10th of a second
List controllers = new ArrayList();
List<ControllerWindow> controllers = new ArrayList<>();
public ControllerReadTest() {
super("Controller Read Test. Version: " + Version.getVersion());
@ -254,13 +262,12 @@ public class ControllerReadTest extends JFrame{
makeController(ca[i]);
}
new Thread(new Runnable() {
public void run(){
new Thread(() ->{
try {
while(true){
for(Iterator i=controllers.iterator();i.hasNext();){
for(Iterator<ControllerWindow> i=controllers.iterator();i.hasNext();){
try {
ControllerWindow cw = (ControllerWindow)i.next();
ControllerWindow cw = i.next();
cw.poll();
} catch (Exception e) {
e.printStackTrace();
@ -271,11 +278,10 @@ public class ControllerReadTest extends JFrame{
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
pack();
setSize(400,400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
}

View file

@ -37,12 +37,6 @@
*****************************************************************************/
package net.java.games.input;
/**
*
* @author administrator
*/
import net.java.games.input.*;
public class ControllerTextTest {
ControllerEnvironment ce;
/** Creates a new instance of ControllerScanner */

View file

@ -1,19 +1,30 @@
/*
* RumbleTest.java
* Copyright (C) 2003 Jeremy Booth (jeremy@newdawnsoftware.com)
*
* Created on 01 December 2003, 23:02
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. Redistributions in binary
* form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided
* with the distribution.
* The name of the author may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
package net.java.games.input;
import net.java.games.input.ControllerEnvironment;
import net.java.games.input.Controller;
import net.java.games.input.Rumbler;
import net.java.games.input.Version;
/**
*
* @author Jeremy
*/
public class RumbleTest {
/** Creates a new instance of RumbleTest */

View file

@ -1,12 +1,32 @@
/*
* Copyright (C) 2003 Jeremy Booth (jeremy@newdawnsoftware.com)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. Redistributions in binary
* form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided
* with the distribution.
* The name of the author may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
package net.java.games.input;
import net.java.games.input.Version;
public class VersionTest {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println("JInput version: " + Version.getVersion());
}

View file

@ -25,13 +25,12 @@
*/
package net.java.games.input.applet;
import java.applet.Applet;
import java.io.IOException;
import net.java.games.input.ControllerEventTest;
@SuppressWarnings("deprecation")
public class ControllerEventTestApplet extends Applet {
public class ControllerEventTestApplet extends java.applet.Applet {
private static final long serialVersionUID = 4250817143444220400L;

View file

@ -25,13 +25,12 @@
*/
package net.java.games.input.applet;
import java.applet.Applet;
import java.io.IOException;
import net.java.games.input.ControllerReadTest;
@SuppressWarnings("deprecation")
public class ControllerReadTestApplet extends Applet {
public class ControllerReadTestApplet extends java.applet.Applet {
private static final long serialVersionUID = -2558493887683964119L;