source: trunk/gcc/libjava/javax/swing/JEditorPane.java

Last change on this file was 1389, checked in by bird, 21 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.6 KB
Line 
1/* JEditorPane.java --
2 Copyright (C) 2002 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38package javax.swing;
39
40import java.io.*;
41import java.net.*;
42import javax.swing.text.*;
43import javax.swing.event.*;
44import java.awt.event.*;
45import java.awt.*;
46import javax.accessibility.*;
47
48public class JEditorPane extends JTextComponent
49{
50 URL page_url;
51 EditorKit kit;
52 String ctype = "text/plain";
53 boolean focus_root;
54 boolean manages_focus;
55
56
57 public JEditorPane()
58 {
59 }
60
61 public JEditorPane(String url)
62 {
63 this();
64 setPage(url);
65 }
66
67 public JEditorPane(String type, String text)
68 {
69 ctype = text;
70 setText(text);
71 }
72
73 public JEditorPane(URL url)
74 {
75 setPage(url);
76 }
77
78 void addHyperlinkListener(HyperlinkListener listener)
79 { }
80
81 protected EditorKit createDefaultEditorKit()
82 { return new PlainEditorKit(); }
83
84 static EditorKit createEditorKitForContentType(String type)
85 { return new PlainEditorKit(); }
86
87 void fireHyperlinkUpdate(HyperlinkEvent e)
88 {
89 }
90
91 public AccessibleContext getAccessibleContext()
92 { return null; }
93
94 String getContentType()
95 { return ctype; }
96
97 EditorKit getEditorKit()
98 { return kit; }
99
100 static String getEditorKitClassNameForContentType(String type)
101 { return "text/plain"; }
102
103 EditorKit getEditorKitForContentType(String type)
104 { return kit; }
105
106 public Dimension getPreferredSize()
107 {
108 //Returns the preferred size for the JEditorPane.
109 return super.getPreferredSize();
110 }
111
112 public boolean getScrollableTracksViewportHeight()
113 { return false; }
114 public boolean getScrollableTracksViewportWidth()
115 { return false; }
116
117 URL getPage()
118 { return page_url; }
119
120 protected InputStream getStream(URL page)
121 {
122 try {
123 return page.openStream();
124 } catch (Exception e) {
125 System.out.println("Hhmmm, failed to open stream: " + e);
126 }
127 return null;
128 }
129
130 public String getText()
131 { return super.getText(); }
132
133 public String getUIClassID()
134 { return "JEditorPane"; }
135
136 public boolean isFocusCycleRoot()
137 { return focus_root; }
138
139 public boolean isManagingFocus()
140 { return manages_focus; }
141
142 protected String paramString()
143 { return "JEditorPane"; }
144
145 protected void processComponentKeyEvent(KeyEvent e)
146 {
147 //Overridden to handle processing of tab/shift tab.
148 }
149
150 protected void processKeyEvent(KeyEvent e)
151 {
152 //Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal.
153 }
154
155 void read(InputStream in, Object desc)
156 {
157 //This method initializes from a stream.
158 }
159
160 static void registerEditorKitForContentType(String type, String classname)
161 {
162 //Establishes the default bindings of type to classname.
163 }
164
165 static void registerEditorKitForContentType(String type, String classname, ClassLoader loader)
166 {
167 //Establishes the default bindings of type to classname.
168 }
169
170 void removeHyperlinkListener(HyperlinkListener listener)
171 {
172 //Removes a hyperlink listener.
173 }
174
175 void replaceSelection(String content)
176 {
177 //Replaces the currently selected content with new content represented by the given string.
178 }
179
180 protected void scrollToReference(String reference)
181 {
182 //Scrolls the view to the given reference location (that is, the value returned by the UL.getRef method for the URL being displayed).
183 }
184
185 void setContentType(String type)
186 {
187 ctype = type;
188 invalidate();
189 repaint();
190 }
191
192 void setEditorKit(EditorKit kit)
193 {
194 this.kit = kit;
195 invalidate();
196 repaint();
197 }
198
199 void setEditorKitForContentType(String type, EditorKit k)
200 {
201 ctype = type;
202 setEditorKit(k);
203 }
204
205 void setPage(String url)
206 {
207 // Sets the current URL being displayed.
208 }
209
210 void setPage(URL page)
211 {
212 // Sets the current URL being displayed.
213 }
214
215 public void setText(String t)
216 {
217 super.setText(t);
218 }
219} // class JEditorPane
Note: See TracBrowser for help on using the repository browser.