package GPClient; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.net.InetAddress; /** *
Title:
*Description:
*Copyright: Copyright (c) 2000
*Company:
* @author not attributable * @version 1.0 */ public class ConnectDialog extends JDialog { Game game; JPanel panel1 = new JPanel(); BorderLayout borderLayout2 = new BorderLayout(); FlowLayout flowLayout1 = new FlowLayout(); JLabel jLabel1 = new JLabel(); JFormattedTextField jFormattedTextField1 = new JFormattedTextField(new IPaddressFormatter()); JPanel Panel2 = new JPanel(); FlowLayout flowLayout2 = new FlowLayout(); JLabel jLabel2 = new JLabel(); JFormattedTextField jFormattedTextField2 = new JFormattedTextField(); JPanel Panel3 = new JPanel(); FlowLayout flowLayout3 = new FlowLayout(); JButton ConnectButton = new JButton(); public ConnectDialog(Frame frame, String title, boolean modal) { super(frame, title, modal); game = (Game) frame; try { jbInit(); pack(); } catch(Exception ex) { ex.printStackTrace(); } } public ConnectDialog() { this(null, "", false); } private void jbInit() throws Exception { panel1.setLayout(flowLayout1); this.getContentPane().setLayout(borderLayout2); jLabel1.setText("Server IP Address:"); Panel2.setLayout(flowLayout2); jLabel2.setRequestFocusEnabled(true); jLabel2.setText("Server Port nr:"); jFormattedTextField2.setPreferredSize(new Dimension(128, 19)); jFormattedTextField2.setText(""); Panel3.setLayout(flowLayout3); ConnectButton.setActionCommand("ConnectButton"); ConnectButton.setText("Connect"); ConnectButton.addActionListener(new ConnectDialog_ConnectButton_actionAdapter(this)); jFormattedTextField1.setText(""); getContentPane().add(panel1, BorderLayout.NORTH); panel1.add(jLabel1, null); panel1.add(jFormattedTextField1, null); this.getContentPane().add(Panel2, BorderLayout.CENTER); Panel2.add(jLabel2, null); Panel2.add(jFormattedTextField2, null); this.getContentPane().add(Panel3, BorderLayout.SOUTH); Panel3.add(ConnectButton, null); } void ConnectButton_actionPerformed(ActionEvent e) { game.setServerIP((InetAddress)jFormattedTextField1.getValue()); } } class ConnectDialog_ConnectButton_actionAdapter implements java.awt.event.ActionListener { ConnectDialog adaptee; ConnectDialog_ConnectButton_actionAdapter(ConnectDialog adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.ConnectButton_actionPerformed(e); } }