summaryrefslogtreecommitdiff
path: root/javax/swing/plaf/basic/BasicTextUI.java
diff options
context:
space:
mode:
authorRonald Veldema <rveldema@cs.vu.nl>2002-03-11 15:48:06 +0000
committerRonald Veldema <rveldema@cs.vu.nl>2002-03-11 15:48:06 +0000
commit5158e5cd020ca88753de8793a40dcda66f3ea8ae (patch)
treee8ff44926abd1e1fd9f058139dc1476c54d24f9c /javax/swing/plaf/basic/BasicTextUI.java
parenteed4707c499f072d7e36d8499638b859a370fc57 (diff)
downloadclasspath-5158e5cd020ca88753de8793a40dcda66f3ea8ae.tar.gz
Added my embryonic javax.swing implementation,
since there are no makefiles for it yet nobody should notice its addition (it shouldn't break anything by adding it this early) R.
Diffstat (limited to 'javax/swing/plaf/basic/BasicTextUI.java')
-rw-r--r--javax/swing/plaf/basic/BasicTextUI.java126
1 files changed, 126 insertions, 0 deletions
diff --git a/javax/swing/plaf/basic/BasicTextUI.java b/javax/swing/plaf/basic/BasicTextUI.java
new file mode 100644
index 000000000..1a687f335
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicTextUI.java
@@ -0,0 +1,126 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.text.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+import javax.swing.*;
+
+public class BasicTextUI extends TextUI
+{
+ int gap = 3;
+ View view = new RootView();
+ Color textColor, disabledTextColor, normalBackgroundColor;
+ EditorKit kit = new DefaultEditorKit();
+
+ class RootView extends View
+ {
+ RootView()
+ {
+ super(null);
+ }
+ public void paint(Graphics g, Shape s)
+ {
+ if (view != null)
+ {
+ Rectangle r = s.getBounds();
+
+ view.setSize(r.width,
+ r.height);
+ view.paint(g, s);
+ }
+ }
+ }
+
+ BasicTextUI()
+ {
+ }
+
+ public static ComponentUI createUI(final JComponent c)
+ {
+ return new BasicTextUI();
+ }
+
+
+ public void installUI(final JComponent c)
+ {
+ super.installUI(c);
+
+ textColor = new Color(0,0,0);
+ disabledTextColor = new Color(130, 130, 130);
+ normalBackgroundColor = new Color(192,192,192);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ JTextComponent b = (JTextComponent) c;
+
+ View v = getRootView(b);
+
+ float w = v.getPreferredSpan(View.X_AXIS);
+ float h = v.getPreferredSpan(View.Y_AXIS);
+
+ return new Dimension(w, h);
+ }
+
+
+ void paint(Graphics g, JComponent c)
+ {
+ // view.paint(
+ }
+
+ void damageRange(JTextComponent t, int p0, int p1)
+ {
+ damageRange(t, p0, p1, null, null);
+ }
+
+ void damageRange(JTextComponent t,
+ int p0, int p1,
+ Position.Bias firstBias,
+ Position.Bias secondBias)
+ {
+ }
+
+ EditorKit getEditorKit(JTextComponent t)
+ {
+ return kit;
+ }
+
+ int getNextVisualPositionFrom(JTextComponent t,
+ int pos,
+ Position.Bias b,
+ int direction,
+ Position.Bias[] biasRet)
+ {
+ return 0;
+ }
+
+ View getRootView(JTextComponent t)
+ {
+ return view;
+ }
+
+ Rectangle modelToView(JTextComponent t, int pos)
+ {
+ return modelToView(t, pos, null);
+ }
+
+ Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias)
+ {
+ return null;
+ }
+
+ int viewToModel(JTextComponent t, Point pt)
+ {
+ return viewToModel(t, pt, null);
+ }
+
+ int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn)
+ {
+ return 0;
+ }
+}
+
+
+
+
+