annotate src/VncCanvas2.java @ 0:30bb7074acb1

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