comparison src/treeVnc/SelectType.java @ 0:756bfaf731f3

create new repository
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Feb 2012 04:10:12 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:756bfaf731f3
1 package treeVnc;
2
3 import javax.swing.*;
4
5 import java.awt.*;
6 import java.awt.event.*;
7
8 public class SelectType extends JFrame implements ActionListener {
9
10 /**
11 *
12 */
13 private static final long serialVersionUID = 1L;
14
15 private JPanel panel = new JPanel();
16 private JButton button = new JButton("Connect");
17 private double width;
18 private double height;
19 private Checkbox[] check = new Checkbox[2];
20 boolean type = false;
21 boolean wait = true;
22
23 public void selectType() {
24 setSize();
25 checkBox();
26 visible();
27 }
28
29 public SelectType() {
30 setTitle("Informatin Connection Address");
31 setResizable(false);
32 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
33 }
34
35 private void setSize() {
36 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
37 width = (d.getWidth() / 2);
38 height = (d.getHeight() / 2);
39 }
40
41 private void visible() {
42 Point point = new Point();
43 point.setLocation(width - 250, height - 80);
44 setLocation(point.getLocation());
45 pack();
46 setVisible(true);
47 }
48 /*
49 private void init(){
50 frameInit();
51 // panel = null;
52 // button = null;
53 // label = null;
54 setVisible(false);
55 }
56 */
57
58 private void setButton(){
59 panel.add(button);
60 panel.setBackground(Color.blue);
61 button.addActionListener(this);
62 Container contentPane = getContentPane();
63 contentPane.add(panel, BorderLayout.CENTER);
64 }
65
66
67 private void checkBox() {
68 CheckboxGroup ch = new CheckboxGroup();
69 check[0] = new Checkbox("Client",ch,false);
70 check[0].setBackground(new Color(0,153,255));
71 check[1] = new Checkbox("Proxy",ch,false);
72 check[1].setBackground(new Color(0,153,255));
73 panel.add(check[0]);
74 panel.add(check[1]);
75 panel.setLayout(new GridLayout(2, 0));
76 setButton();
77 }
78
79 public void actionPerformed(ActionEvent e) {
80 if(check[0].getState()){
81 System.out.println("Client");
82 type = true;
83 } else {
84 System.out.println("Proxy");
85 type = false;
86 }
87 setVisible(false);
88 wait = false;
89 }
90
91 }