combo box for connection speeds
git-svn-id: svn://anubis/gvsu@26 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
a7152d51ed
commit
4dd4e8b47b
@ -2,6 +2,7 @@
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class KaZaGUI extends JFrame
|
public class KaZaGUI extends JFrame
|
||||||
{
|
{
|
||||||
@ -12,6 +13,7 @@ public class KaZaGUI extends JFrame
|
|||||||
private JTextField m_statusField;
|
private JTextField m_statusField;
|
||||||
private JTextField m_serverField;
|
private JTextField m_serverField;
|
||||||
private ActionEventHandler m_handler;
|
private ActionEventHandler m_handler;
|
||||||
|
private JComboBox m_speedCombo;
|
||||||
|
|
||||||
public KaZaGUI()
|
public KaZaGUI()
|
||||||
{
|
{
|
||||||
@ -30,10 +32,10 @@ public class KaZaGUI extends JFrame
|
|||||||
JPanel clientPanel = getClientPanel();
|
JPanel clientPanel = getClientPanel();
|
||||||
pane.add("Client", clientPanel);
|
pane.add("Client", clientPanel);
|
||||||
|
|
||||||
JPanel transferPanel = new JPanel(new BorderLayout());
|
JPanel transferPanel = getTransferPanel();
|
||||||
pane.add("Transfers", transferPanel);
|
pane.add("Transfers", transferPanel);
|
||||||
|
|
||||||
JPanel serverPanel = new JPanel(new BorderLayout());
|
JPanel serverPanel = getServerPanel();
|
||||||
pane.add("Server", serverPanel);
|
pane.add("Server", serverPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,8 +64,47 @@ public class KaZaGUI extends JFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ConnectionSpeed
|
||||||
|
{
|
||||||
|
String m_caption;
|
||||||
|
int m_kbps;
|
||||||
|
|
||||||
|
public ConnectionSpeed(String caption, int kbps)
|
||||||
|
{
|
||||||
|
m_caption = caption;
|
||||||
|
m_kbps = kbps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return m_caption;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private JPanel getClientPanel()
|
private JPanel getClientPanel()
|
||||||
{
|
{
|
||||||
|
m_shareFolderField = new JTextField();
|
||||||
|
m_browseButton = new JButton("...");
|
||||||
|
m_browseButton.addActionListener(m_handler);
|
||||||
|
m_serverField = new JTextField();
|
||||||
|
m_statusField = new JTextField();
|
||||||
|
m_connectButton = new JButton("Connect");
|
||||||
|
m_connectButton.addActionListener(m_handler);
|
||||||
|
m_closeButton = new JButton("Close");
|
||||||
|
m_closeButton.addActionListener(m_handler);
|
||||||
|
Vector<ConnectionSpeed> speeds = new Vector<ConnectionSpeed>();
|
||||||
|
speeds.add(new ConnectionSpeed("Modem", 50));
|
||||||
|
speeds.add(new ConnectionSpeed("768 Kbps", 768));
|
||||||
|
speeds.add(new ConnectionSpeed("1.5 Mbps", 1500));
|
||||||
|
speeds.add(new ConnectionSpeed("3 Mbps", 3000));
|
||||||
|
speeds.add(new ConnectionSpeed("6 Mbps", 6000));
|
||||||
|
speeds.add(new ConnectionSpeed("10 Mbps", 10000));
|
||||||
|
speeds.add(new ConnectionSpeed("100 Mbps", 100000));
|
||||||
|
speeds.add(new ConnectionSpeed("1 Gbps", 1000000));
|
||||||
|
speeds.add(new ConnectionSpeed("10 Gbps", 10000000));
|
||||||
|
m_speedCombo = new JComboBox(speeds);
|
||||||
|
m_speedCombo.setSelectedIndex(3);
|
||||||
|
|
||||||
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();
|
||||||
@ -74,21 +115,17 @@ public class KaZaGUI extends JFrame
|
|||||||
p = new JPanel();
|
p = new JPanel();
|
||||||
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
|
||||||
p.add(new JLabel("Connection speed: "));
|
p.add(new JLabel("Connection speed: "));
|
||||||
p.add(new JTextField());
|
p.add(m_speedCombo);
|
||||||
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));
|
||||||
p.add(new JLabel("Shared folder: "));
|
p.add(new JLabel("Shared folder: "));
|
||||||
m_shareFolderField = new JTextField();
|
|
||||||
p.add(m_shareFolderField);
|
p.add(m_shareFolderField);
|
||||||
m_browseButton = new JButton("...");
|
|
||||||
m_browseButton.addActionListener(m_handler);
|
|
||||||
p.add(m_browseButton);
|
p.add(m_browseButton);
|
||||||
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));
|
||||||
p.add(new JLabel("Server: "));
|
p.add(new JLabel("Server: "));
|
||||||
m_serverField = new JTextField();
|
|
||||||
p.add(m_serverField);
|
p.add(m_serverField);
|
||||||
clientPanel.add(p);
|
clientPanel.add(p);
|
||||||
clientPanel.add(new Box.Filler(new Dimension(0, 0),
|
clientPanel.add(new Box.Filler(new Dimension(0, 0),
|
||||||
@ -97,22 +134,33 @@ public class KaZaGUI extends JFrame
|
|||||||
Short.MAX_VALUE)));
|
Short.MAX_VALUE)));
|
||||||
p = new JPanel();
|
p = new JPanel();
|
||||||
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
|
||||||
m_statusField = new JTextField();
|
|
||||||
p.add(m_statusField);
|
p.add(m_statusField);
|
||||||
p.add(new Box.Filler(new Dimension(0, 0),
|
p.add(new Box.Filler(new Dimension(0, 0),
|
||||||
new Dimension(Short.MAX_VALUE, 0),
|
new Dimension(Short.MAX_VALUE, 0),
|
||||||
new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)));
|
new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)));
|
||||||
m_connectButton = new JButton("Connect");
|
|
||||||
m_connectButton.addActionListener(m_handler);
|
|
||||||
p.add(m_connectButton);
|
p.add(m_connectButton);
|
||||||
p.add(new Box.Filler(new Dimension(8, 0),
|
p.add(new Box.Filler(new Dimension(8, 0),
|
||||||
new Dimension(8, 0),
|
new Dimension(8, 0),
|
||||||
new Dimension(8, Short.MAX_VALUE)));
|
new Dimension(8, Short.MAX_VALUE)));
|
||||||
m_closeButton = new JButton("Close");
|
|
||||||
m_closeButton.addActionListener(m_handler);
|
|
||||||
p.add(m_closeButton);
|
p.add(m_closeButton);
|
||||||
clientPanel.add(p);
|
clientPanel.add(p);
|
||||||
|
|
||||||
return clientPanel;
|
return clientPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private JPanel getTransferPanel()
|
||||||
|
{
|
||||||
|
JPanel transferPanel = new JPanel();
|
||||||
|
transferPanel.setLayout(new BoxLayout(transferPanel, BoxLayout.Y_AXIS));
|
||||||
|
transferPanel.add(new JLabel("Transfers:"));
|
||||||
|
transferPanel.add(new Box.Filler(new Dimension(0, 0),
|
||||||
|
new Dimension(0, Short.MAX_VALUE),
|
||||||
|
new Dimension(0, Short.MAX_VALUE)));
|
||||||
|
return transferPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel getServerPanel()
|
||||||
|
{
|
||||||
|
return new JPanel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user