KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwtx > swing > JViewport


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: JViewport.java,v $
11    Revision 1.2 2004/05/05 13:24:32 bobintetley
12    Bugfixes and Laurent's patch for binary compatibility on Container.add()
13
14    Revision 1.1 2004/04/30 16:52:17 bobintetley
15    MenuListener support, JViewport support, TreeSelectionModel stubs, additional JTree methods
16
17 */

18
19 package swingwtx.swing;
20
21 import swingwt.awt.*;
22
23 /**
24  * Simple JViewport class. This could be expanded at a
25  * later date.
26  *
27  * @author Robin Rawson-Tetley
28  */

29 public class JViewport extends JComponent {
30     
31     JScrollPane friend = null;
32     
33     protected JViewport(JScrollPane friend) {
34         this.friend = friend;
35     }
36
37     public Component add(Component c) {
38         return friend.add(c);
39     }
40
41     public Component add(String JavaDoc name, Component c) {
42         return friend.add(name, c);
43     }
44
45     public Component getView() {
46         return friend.getComponents()[0];
47     }
48     
49     public Point getViewPosition() {
50         return friend.getLocation();
51     }
52     
53     public Rectangle getViewRect() {
54         return friend.getBounds();
55     }
56     
57     public Dimension getViewSize() {
58         return friend.getSize();
59     }
60 }
61
Popular Tags