can make a server and client object now

git-svn-id: svn://anubis/gvsu@28 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-03-08 18:09:50 +00:00
parent 7516e45391
commit c8a2a18afb
3 changed files with 28 additions and 8 deletions

View File

@ -1,4 +1,10 @@
public class KaZaClient public class KaZaClient
{
public static final int LISTEN_PORT = 3443;
public KaZaClient(String userName, int kbps,
String sharedFolder, String server)
{ {
} }
}

View File

@ -9,6 +9,7 @@ public class KaZaGUI extends JFrame
private JButton m_browseButton; private JButton m_browseButton;
private JButton m_connectButton; private JButton m_connectButton;
private JButton m_closeButton; private JButton m_closeButton;
private JTextField m_userNameField;
private JTextField m_shareFolderField; private JTextField m_shareFolderField;
private JTextField m_statusField; private JTextField m_statusField;
private JTextField m_serverField; private JTextField m_serverField;
@ -63,13 +64,21 @@ public class KaZaGUI extends JFrame
{ {
System.exit(0); System.exit(0);
} }
else if (e.getSource() == m_connectButton)
{
ConnectionSpeed cs = (ConnectionSpeed) m_speedCombo.getSelectedItem();
m_client = new KaZaClient(m_userNameField.getText(),
cs.getKbps(),
m_shareFolderField.getText(),
m_serverField.getText());
}
} }
} }
private class ConnectionSpeed private class ConnectionSpeed
{ {
String m_caption; private String m_caption;
int m_kbps; private int m_kbps;
public ConnectionSpeed(String caption, int kbps) public ConnectionSpeed(String caption, int kbps)
{ {
@ -77,10 +86,9 @@ public class KaZaGUI extends JFrame
m_kbps = kbps; m_kbps = kbps;
} }
public String toString() public String toString() { return m_caption; }
{
return m_caption; public int getKbps() { return m_kbps; }
}
} }
private JPanel getClientPanel() private JPanel getClientPanel()
@ -106,13 +114,14 @@ public class KaZaGUI extends JFrame
speeds.add(new ConnectionSpeed("10 Gbps", 10000000)); speeds.add(new ConnectionSpeed("10 Gbps", 10000000));
m_speedCombo = new JComboBox(speeds); m_speedCombo = new JComboBox(speeds);
m_speedCombo.setSelectedIndex(3); m_speedCombo.setSelectedIndex(3);
m_userNameField = new JTextField();
JPanel clientPanel = new JPanel(); JPanel clientPanel = new JPanel();
clientPanel.setLayout(new BoxLayout(clientPanel, BoxLayout.Y_AXIS)); clientPanel.setLayout(new BoxLayout(clientPanel, BoxLayout.Y_AXIS));
JPanel p = new JPanel(); JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("User name: ")); p.add(new JLabel("User name: "));
p.add(new JTextField()); p.add(m_userNameField);
clientPanel.add(p); clientPanel.add(p);
p = new JPanel(); p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
@ -165,7 +174,7 @@ public class KaZaGUI extends JFrame
{ {
JPanel serverPanel = new JPanel(); JPanel serverPanel = new JPanel();
serverPanel.setLayout(new BoxLayout(serverPanel, BoxLayout.Y_AXIS)); serverPanel.setLayout(new BoxLayout(serverPanel, BoxLayout.Y_AXIS));
serverPanel.add(new JLabel("Transfers:")); serverPanel.add(new JLabel("Clients:"));
serverPanel.add(new Box.Filler(new Dimension(0, 0), serverPanel.add(new Box.Filler(new Dimension(0, 0),
new Dimension(0, Short.MAX_VALUE), new Dimension(0, Short.MAX_VALUE),
new Dimension(0, Short.MAX_VALUE))); new Dimension(0, Short.MAX_VALUE)));

View File

@ -1,4 +1,9 @@
public class KaZaServer public class KaZaServer
{
public static final int LISTEN_PORT = 3442;
public KaZaServer()
{ {
} }
}