# HG changeset patch # User Yu Taninari # Date 1319472349 -32400 # Node ID 0f0d3193017ccaf8d8e26412512459b1e6c75f90 # Parent ce03da701bcb1dcdca041b1cf479ad6adcadb0f0# Parent 2a9dd76dde5f75061eb718f96e6d7f34cef97cfc merge 178 diff -r 2a9dd76dde5f -r 0f0d3193017c src/myVncProxy/TextBox.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/myVncProxy/TextBox.java Tue Oct 25 01:05:49 2011 +0900 @@ -0,0 +1,81 @@ +package myVncProxy; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +public class TextBox extends JFrame implements ActionListener { + + JPanel panel = new JPanel(); + JButton button = new JButton("Connect"); + TextField t1; + TextField t2; + JPasswordField pw; + double width; + double height; + JLabel label; + boolean flag; + + public void ipRegister() { + setSize(); + setText(); + visible(); + } + + public TextBox() { + setTitle("Informatin Connection Address"); + setResizable(false); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + void setSize() { + Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); + width = (d.getWidth() / 2); + height = (d.getHeight() / 2); + } + + void visible() { + Point point = new Point(); + point.setLocation(width - 250, height - 80); + setLocation(point.getLocation()); + pack(); + setVisible(true); + } + + void setText() { + t1 = new TextField("you.st.ie.u-ryukyu.ac.jp", 30); + t2 = new TextField("5900", 5); + pw = new JPasswordField("kakiku"); + panel.add(t1); + panel.add(t2); + panel.add(pw); + panel.add(button); + button.addActionListener(this); + label = new JLabel(); + Container contentPane = getContentPane(); + contentPane.add(panel, BorderLayout.CENTER); + contentPane.add(label, BorderLayout.SOUTH); + } + + public String getAddress() { + while(!(flag)) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + return t1.getText(); + } + public String getPort() { + return t2.getText(); + } + + public String getPassword() { + return String.valueOf(pw.getPassword()); + } + + public void actionPerformed(ActionEvent e) { + flag = true; + } +} \ No newline at end of file