diff options
author | Ronald Veldema <rveldema@cs.vu.nl> | 2002-03-11 15:48:06 +0000 |
---|---|---|
committer | Ronald Veldema <rveldema@cs.vu.nl> | 2002-03-11 15:48:06 +0000 |
commit | 5158e5cd020ca88753de8793a40dcda66f3ea8ae (patch) | |
tree | e8ff44926abd1e1fd9f058139dc1476c54d24f9c /javax/swing/text/View.java | |
parent | eed4707c499f072d7e36d8499638b859a370fc57 (diff) | |
download | classpath-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/text/View.java')
-rw-r--r-- | javax/swing/text/View.java | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/javax/swing/text/View.java b/javax/swing/text/View.java new file mode 100644 index 000000000..249a1e6e9 --- /dev/null +++ b/javax/swing/text/View.java @@ -0,0 +1,97 @@ +package javax.swing.text; + +import java.awt.*; +import javax.swing.*; +import java.util.*; + +public abstract class View implements SwingConstants +{ + static int BadBreakWeight; + static int ExcellentBreakWeight; + static int ForcedBreakWeight; + static int GoodBreakWeight; + + final static int X_AXIS = 0; + final static int Y_AXIS = 1; + + float width, height; + Element elt; + View parent; + + + Vector v = new Vector(); + + int getViewCount() + { + return v.size(); + } + + View getView(int a) + { + return (View) v.get(a); + } + + void remove(int i) + { + v.removeElementAt(i); + } + + void insert(int off, View view) + { + v.insertElementAt(view, off); + } + void append(View view) + { + v.addElement(view); + } + + void paint(Graphics g, Shape allocation) + { + System.out.println("view.paint() !!!!"); + } + + void setParent(View a) + { + parent = a; + } + View getParent() + { + return parent; + } + + void setSize(int w, int h) + { + width = w; + height = h; + } + + View(Element elem) + { + elt = elem; + } + + Document getDocument() + { + return getElement().getDocument(); + } + + Element getElement() + { + return elt; + } + + float getPreferredSpan(int a) + { + switch (a) + { + case X_AXIS: return width; + case Y_AXIS: return height; + default: + { + System.err.println("I sure wish Java had enums !!! "); + return 0; + } + } + } +} + |