annotate src/myVncProxy/VncCanvas2.java @ 0:3cb9db416529

create MulticastVncProxy repository
author Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
date Wed, 07 Sep 2011 04:20:32 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package myVncProxy;
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 // Copyright (C) 2006 Constantin Kaplinsky. All Rights Reserved.
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // This is free software; you can redistribute it and/or modify
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 // it under the terms of the GNU General Public License as published by
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // the Free Software Foundation; either version 2 of the License, or
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 // (at your option) any later version.
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 // This software is distributed in the hope that it will be useful,
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 // GNU General Public License for more details.
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 // You should have received a copy of the GNU General Public License
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 // along with this software; if not, write to the Free Software
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 // USA.
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 import java.awt.*;
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 import java.io.*;
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 // VncCanvas2 is a special version of VncCanvas which may use Java 2 API.
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 class VncCanvas2 extends VncCanvas {
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 public VncCanvas2(VncViewer v) throws IOException {
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 super(v);
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 disableFocusTraversalKeys();
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 public VncCanvas2(VncViewer v, int maxWidth_, int maxHeight_)
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 throws IOException {
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 super(v, maxWidth_, maxHeight_);
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 disableFocusTraversalKeys();
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 }
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 public void paintScaledFrameBuffer(Graphics g) {
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 Graphics2D g2d = (Graphics2D)g;
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 RenderingHints.VALUE_RENDER_QUALITY);
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 g2d.drawImage(memImage, 0, 0, scaledWidth, scaledHeight, null);
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 }
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 // Try to disable focus traversal keys (JVMs 1.4 and higher).
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 //
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 private void disableFocusTraversalKeys() {
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 try {
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 Class[] argClasses = { Boolean.TYPE };
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 java.lang.reflect.Method method =
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 getClass().getMethod("setFocusTraversalKeysEnabled", argClasses);
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 Object[] argObjects = { new Boolean(false) };
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 method.invoke(this, argObjects);
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 } catch (Exception e) {}
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 }
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 }
3cb9db416529 create MulticastVncProxy repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64