From: ThorstenB Date: Tue, 27 Mar 2012 19:06:29 +0000 (+0200) Subject: #718: java client example not compiling X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=02b160c5ffda5d9b37c30bf318e3c028ad3c64e2;p=flightgear.git #718: java client example not compiling Util.java was added to the repo commenting "Half-finished utility class.". No more progress since (10 years!), so just exclude the file from the java build by changing its extension. --- diff --git a/scripts/java/FGClient/src/org/flightgear/fgfsclient/Util._java_ b/scripts/java/FGClient/src/org/flightgear/fgfsclient/Util._java_ new file mode 100644 index 000000000..684b76299 --- /dev/null +++ b/scripts/java/FGClient/src/org/flightgear/fgfsclient/Util._java_ @@ -0,0 +1,70 @@ +package org.flightgear.fgfsclient; + +import java.io.IOException; + +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JTextField; + + +public final class Util +{ + + public static void forceConnection (JFrame frame, final FGFSConnection fgfs) + { + while (!fgfs.isConnected()) { + final JDialog dialog = + new JDialog(frame, "Connect to FlightGear", true); + dialog.getContentPane().setLayout(new GridLayout(3, 2)); + dialog.getContentPane().add(new JLabel("Host:")); + + final JTextField hostField = new JTextField(20); + hostField.setText(fgfs.getHost()); + dialog.getContentPane().add(hostField); + + dialog.getContentPane().add(new JLabel("Port:")); + + final JTextField portField = new JTextField(5); + portField.setText(Integer.toString(fgfs.getPort())); + dialog.getContentPane().add(portField); + + JButton connectButton = new JButton("Connect"); + connectButton.addActionListener(new ActionListener() { + public void actionPerformed (ActionEvent ev) + { + try { + fgfs.open(hostField.getText(), + Integer.parseInt(portField.getText())); + } catch (IOException ex) { + JOptionPane.showMessageDialog(dialog, ex.getMessage(), + "Alert", JOptionPane.ERROR_MESSAGE); + } + dialog.hide(); + } + }); + dialog.getContentPane().add(connectButton); + dialog.getRootPane().setDefaultButton(connectButton); + + JButton quitButton = new JButton("Quit"); + quitButton.addActionListener(new ActionListener() { + public void actionPerformed (ActionEvent ev) + { + System.exit(0); // FIXME + } + }); + dialog.getContentPane().add(quitButton); + + dialog.pack(); + dialog.show(); + + } + } + +} diff --git a/scripts/java/FGClient/src/org/flightgear/fgfsclient/Util.java b/scripts/java/FGClient/src/org/flightgear/fgfsclient/Util.java deleted file mode 100644 index 684b76299..000000000 --- a/scripts/java/FGClient/src/org/flightgear/fgfsclient/Util.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.flightgear.fgfsclient; - -import java.io.IOException; - -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTextField; - - -public final class Util -{ - - public static void forceConnection (JFrame frame, final FGFSConnection fgfs) - { - while (!fgfs.isConnected()) { - final JDialog dialog = - new JDialog(frame, "Connect to FlightGear", true); - dialog.getContentPane().setLayout(new GridLayout(3, 2)); - dialog.getContentPane().add(new JLabel("Host:")); - - final JTextField hostField = new JTextField(20); - hostField.setText(fgfs.getHost()); - dialog.getContentPane().add(hostField); - - dialog.getContentPane().add(new JLabel("Port:")); - - final JTextField portField = new JTextField(5); - portField.setText(Integer.toString(fgfs.getPort())); - dialog.getContentPane().add(portField); - - JButton connectButton = new JButton("Connect"); - connectButton.addActionListener(new ActionListener() { - public void actionPerformed (ActionEvent ev) - { - try { - fgfs.open(hostField.getText(), - Integer.parseInt(portField.getText())); - } catch (IOException ex) { - JOptionPane.showMessageDialog(dialog, ex.getMessage(), - "Alert", JOptionPane.ERROR_MESSAGE); - } - dialog.hide(); - } - }); - dialog.getContentPane().add(connectButton); - dialog.getRootPane().setDefaultButton(connectButton); - - JButton quitButton = new JButton("Quit"); - quitButton.addActionListener(new ActionListener() { - public void actionPerformed (ActionEvent ev) - { - System.exit(0); // FIXME - } - }); - dialog.getContentPane().add(quitButton); - - dialog.pack(); - dialog.show(); - - } - } - -}