mirror of
https://github.com/Maschell/StreamingPluginClient.git
synced 2025-02-21 15:07:13 +01:00
Bug Fix
This commit is contained in:
parent
dbf404cd88
commit
0a7af5411a
@ -22,9 +22,11 @@
|
|||||||
|
|
||||||
package de.mas.wiiu.streaming;
|
package de.mas.wiiu.streaming;
|
||||||
|
|
||||||
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.net.BindException;
|
import java.net.BindException;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
|
|
||||||
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
@ -50,15 +52,47 @@ public class Main {
|
|||||||
if (line.hasOption("ip")) {
|
if (line.hasOption("ip")) {
|
||||||
ip = line.getOptionValue("ip");
|
ip = line.getOptionValue("ip");
|
||||||
} else {
|
} else {
|
||||||
|
//Check if this is being run in cmd to prevent headless exceptions
|
||||||
|
if(GraphicsEnvironment.isHeadless()) {
|
||||||
HelpFormatter formatter = new HelpFormatter();
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
formatter.printHelp("streamingTool", options);
|
formatter.printHelp("streamingTool", options);
|
||||||
ip = JOptionPane.showInputDialog(null, "Please enter the local IP address of your Wii U", "Wii U streaming client", JOptionPane.PLAIN_MESSAGE);
|
}else {
|
||||||
|
|
||||||
|
//Create a JFrame to show the icon in the taskbar
|
||||||
|
final JFrame frame = new JFrame("Wii U Streaming Client - Enter IP...");
|
||||||
|
frame.setUndecorated( true );
|
||||||
|
frame.setVisible( true );
|
||||||
|
frame.setLocationRelativeTo( null );
|
||||||
|
|
||||||
|
//Display the IP Dialog
|
||||||
|
ip = JOptionPane.showInputDialog(frame, "Please enter the local IP address of your Wii U", "Wii U streaming client", JOptionPane.PLAIN_MESSAGE);
|
||||||
|
|
||||||
|
//Check if user clicked "Cancel"
|
||||||
|
if(ip == null) {
|
||||||
|
System.out.println("Cancelled. Exiting program");
|
||||||
|
frame.dispose();
|
||||||
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
//Close the JFrame again
|
||||||
|
frame.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new Main(ip);
|
new Main(ip);
|
||||||
} catch (BindException e) {
|
} catch (BindException e) {
|
||||||
JOptionPane.showMessageDialog(null, "Can't bind socket. The client is probably already running.", e.getClass().getName(),
|
//Create a JFrame to show the icon in the taskbar
|
||||||
|
final JFrame frame = new JFrame("Wii U Streaming Client - "+e.getClass().getName());
|
||||||
|
frame.setUndecorated( true );
|
||||||
|
frame.setVisible( true );
|
||||||
|
frame.setLocationRelativeTo( null );
|
||||||
|
|
||||||
|
//Display the Message
|
||||||
|
JOptionPane.showMessageDialog(frame, "Can't bind socket. The client is probably already running.", e.getClass().getName(),
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
|
//Close the JFrame again
|
||||||
|
frame.dispose();
|
||||||
|
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user