comparison src/myVncClient/VncViewer.java @ 18:4881586aead9

succeed drawFirstimage()!!
author e085711
date Tue, 26 Apr 2011 09:08:14 +0900
parents f9ecb0315303
children 965360af5f0b
comparison
equal deleted inserted replaced
17:f9ecb0315303 18:4881586aead9
1 package myVncClient; 1 package myVncClient;
2 //
3 // Copyright (C) 2001-2004 HorizonLive.com, Inc. All Rights Reserved.
4 // Copyright (C) 2002 Constantin Kaplinsky. All Rights Reserved.
5 // Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
6 //
7 // This is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this software; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 // USA.
21 //
22
23 //
24 // VncViewer.java - the VNC viewer applet. This class mainly just sets up the
25 // user interface, leaving it to the VncCanvas to do the actual rendering of
26 // a VNC desktop.
27 //
28 2
29 import java.awt.*; 3 import java.awt.*;
30 import java.awt.event.*; 4 import java.awt.event.*;
31 import java.io.*; 5 import java.io.*;
32 import java.net.*; 6 import java.net.*;
45 public static void main(String[] argv) { 19 public static void main(String[] argv) {
46 VncViewer v = new VncViewer(); 20 VncViewer v = new VncViewer();
47 v.mainArgs = argv; 21 v.mainArgs = argv;
48 v.inAnApplet = false; 22 v.inAnApplet = false;
49 v.inSeparateFrame = true; 23 v.inSeparateFrame = true;
50 /* 24
51 * if(argv.length > 1){ v.host = argv[0]; v.port =
52 * Integer.parseInt(argv[1]); }
53 */
54 v.init(); 25 v.init();
55 v.start(); 26 v.start();
56 } 27 }
57 28
58 String[] mainArgs; 29 String[] mainArgs;
157 gridbag.setConstraints(buttonPanel, gbc); 128 gridbag.setConstraints(buttonPanel, gbc);
158 vncContainer.add(buttonPanel); 129 vncContainer.add(buttonPanel);
159 } 130 }
160 131
161 /*****************************************************************************/ 132 /*****************************************************************************/
162 vncFrame.pack(); 133 if(inSeparateFrame) {
163 vncFrame.setVisible(true); 134 vncFrame.pack();
135 vncFrame.setVisible(true);
136 } else {
137 validate();
138 }
164 try { 139 try {
165
166 140
167 rfb = new MyRfbProto(host, port, this); 141 rfb = new MyRfbProto(host, port, this);
168 rfb.readServerInit(); 142 rfb.readServerInit();
169 143
170 createCanvas(0, 0); 144 createCanvas(0, 0);
684 // param_name/param_value pairs where the names and values correspond to 658 // param_name/param_value pairs where the names and values correspond to
685 // those expected in the html applet tag source. 659 // those expected in the html applet tag source.
686 // 660 //
687 661
688 void readParameters() { 662 void readParameters() {
689 // host = readParameter("HOST", !inAnApplet); 663 host = readParameter("HOST", !inAnApplet);
690 if (mainArgs.length > 0) 664
691 host = mainArgs[0]; 665 if (host == null) { host = getCodeBase().getHost(); if
692 else 666 (host.equals("")) { fatalError("HOST parameter not specified"); } }
693 host = "hades.cr.ie.u-ryukyu.ac.jp"; 667
694 /* 668 port = readIntParameter("PORT", 5550);
695 * if (host == null) { host = getCodeBase().getHost(); if 669
696 * (host.equals("")) { fatalError("HOST parameter not specified"); } }
697 */
698
699 // port = readIntParameter("PORT", 5550);
700 if (mainArgs.length > 1)
701 port = Integer.parseInt(mainArgs[1]);
702 else
703 port = 5550;
704 // Read "ENCPASSWORD" or "PASSWORD" parameter if specified. 670 // Read "ENCPASSWORD" or "PASSWORD" parameter if specified.
705 readPasswordParameters(); 671 readPasswordParameters();
706 672
707 String str; 673 String str;
708 if (inAnApplet) { 674 if (inAnApplet) {