15 package com.neuronrobotics.sdk.ui;
17 import java.awt.event.ActionEvent;
18 import java.awt.event.ActionListener;
19 import java.net.InetAddress;
20 import java.util.ArrayList;
22 import javax.swing.JButton;
23 import javax.swing.JComboBox;
24 import javax.swing.JLabel;
25 import javax.swing.JOptionPane;
26 import javax.swing.JTextField;
28 import net.miginfocom.swing.MigLayout;
30 import com.neuronrobotics.sdk.common.BowlerAbstractConnection;
31 import com.neuronrobotics.sdk.network.UDPBowlerConnection;
32 import com.neuronrobotics.sdk.util.IMonitorable;
33 import com.neuronrobotics.sdk.util.IProgressMonitorListener;
34 import com.neuronrobotics.sdk.util.ProcessMonitor;
55 private JTextField
port =
new JTextField(8);
72 setLayout(
new MigLayout(
"",
77 add(
new JLabel(
"Server:"),
"cell 0 0");
82 refresh =
new JButton(
"Refresh");
83 refresh.addActionListener(
new ActionListener() {
85 public void actionPerformed(ActionEvent arg0) {
91 add(
new JLabel(
"Port:"),
"cell 0 1");
92 add(
port,
"cell 1 1");
103 int baud = Integer.parseInt(
port.getText());
105 throw new NumberFormatException();
107 String address =
connectionCbo.getSelectedItem().toString().trim();
111 }
catch(NumberFormatException e) {
112 JOptionPane.showMessageDialog(
null,
"Invalid port given.",
"Invalid port", JOptionPane.ERROR_MESSAGE);
113 }
catch(RuntimeException e) {
114 JOptionPane.showMessageDialog(
null,
"Invalid address given.",
"Invalid address", JOptionPane.ERROR_MESSAGE);
130 port.setEnabled(
false);
140 public void onUpdate(
double value) {
146 public void onComplete() {
148 port.setEnabled(
true);
170 setName(
"Bowler Platform UDP searcher");
175 prt=
new Integer(
port.getText());
176 }
catch (NumberFormatException e) {
185 for (InetAddress i:addrs) {
188 if(addrs.size() ==0 )
ArrayList< InetAddress > getAllAddresses()
void setAddress(InetAddress set)
ConnectionDialog getConnectionDialog()
ConnectionDialog connectionDialog
static ImageIcon getIcon(String path)
UDPConnectionPanel(ConnectionDialog connectionDialog)
BowlerAbstractConnection getConnection()
static final long serialVersionUID
static final int defaultPortNum
void addProcessMonitorListener(IProgressMonitorListener listener)