mirror of
https://github.com/Maschell/StreamingPluginClient.git
synced 2025-02-20 06:42:45 +01:00
Bug Fix
This commit is contained in:
parent
dbf404cd88
commit
0a7af5411a
@ -22,9 +22,11 @@
|
||||
|
||||
package de.mas.wiiu.streaming;
|
||||
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.net.BindException;
|
||||
import java.net.SocketException;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
@ -50,15 +52,47 @@ public class Main {
|
||||
if (line.hasOption("ip")) {
|
||||
ip = line.getOptionValue("ip");
|
||||
} else {
|
||||
//Check if this is being run in cmd to prevent headless exceptions
|
||||
if(GraphicsEnvironment.isHeadless()) {
|
||||
HelpFormatter formatter = new HelpFormatter();
|
||||
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 {
|
||||
new Main(ip);
|
||||
} 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);
|
||||
//Close the JFrame again
|
||||
frame.dispose();
|
||||
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user