summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--javax/swing/AbstractAction.java8
-rw-r--r--javax/swing/AbstractButton.java513
-rw-r--r--javax/swing/AbstractListModel.java87
-rw-r--r--javax/swing/AbstractSet.java62
-rw-r--r--javax/swing/Accessible.java7
-rw-r--r--javax/swing/AccessibleContext.java7
-rw-r--r--javax/swing/Action.java24
-rw-r--r--javax/swing/BorderFactory.java331
-rw-r--r--javax/swing/Box.java12
-rw-r--r--javax/swing/BoxLayout.java107
-rw-r--r--javax/swing/ButtonGroup.java100
-rw-r--r--javax/swing/ButtonModel.java54
-rw-r--r--javax/swing/ComponentInputMap.java6
-rw-r--r--javax/swing/DefaultButtonModel.java132
-rw-r--r--javax/swing/DefaultCellRenderer.java38
-rw-r--r--javax/swing/DefaultListModel.java8
-rw-r--r--javax/swing/DefaultListSelectionModel.java144
-rw-r--r--javax/swing/Icon.java13
-rw-r--r--javax/swing/ImageIcon.java58
-rw-r--r--javax/swing/InputMap.java6
-rw-r--r--javax/swing/JApplet.java170
-rw-r--r--javax/swing/JButton.java91
-rw-r--r--javax/swing/JCheckBox.java56
-rw-r--r--javax/swing/JComponent.java818
-rw-r--r--javax/swing/JDialog.java219
-rw-r--r--javax/swing/JEditorPane.java187
-rw-r--r--javax/swing/JFrame.java206
-rw-r--r--javax/swing/JLabel.java201
-rw-r--r--javax/swing/JLayeredPane.java21
-rw-r--r--javax/swing/JList.java196
-rw-r--r--javax/swing/JMenuBar.java8
-rw-r--r--javax/swing/JOptionPane.java353
-rw-r--r--javax/swing/JPanel.java73
-rw-r--r--javax/swing/JRadioButton.java54
-rw-r--r--javax/swing/JRootPane.java164
-rw-r--r--javax/swing/JScrollBar.java6
-rw-r--r--javax/swing/JScrollPane.java96
-rw-r--r--javax/swing/JTabbedPane.java88
-rw-r--r--javax/swing/JTextField.java28
-rw-r--r--javax/swing/JToggleButton.java72
-rw-r--r--javax/swing/JToolTip.java16
-rw-r--r--javax/swing/JTree.java71
-rw-r--r--javax/swing/JViewport.java99
-rw-r--r--javax/swing/JWindow.java189
-rw-r--r--javax/swing/KeyStroke.java8
-rw-r--r--javax/swing/ListCellRenderer.java12
-rw-r--r--javax/swing/ListModel.java11
-rw-r--r--javax/swing/ListSelectionModel.java28
-rw-r--r--javax/swing/LookAndFeel.java88
-rw-r--r--javax/swing/Scrollable.java12
-rw-r--r--javax/swing/SwingConstants.java28
-rw-r--r--javax/swing/SwingUtilities.java77
-rw-r--r--javax/swing/Timer.java117
-rw-r--r--javax/swing/ToggleButtonModel.java27
-rw-r--r--javax/swing/UIDefaults.java33
-rw-r--r--javax/swing/UIManager.java233
-rw-r--r--javax/swing/UnsupportedLookAndFeelException.java10
-rw-r--r--javax/swing/border/AbstractBorder.java85
-rw-r--r--javax/swing/border/Border.java15
-rw-r--r--javax/swing/border/CompoundBorder.java33
-rw-r--r--javax/swing/border/EmptyBorder.java54
-rw-r--r--javax/swing/border/MatteBorder.java38
-rw-r--r--javax/swing/border/TitledBorder.java31
-rw-r--r--javax/swing/event/AncestorEvent.java12
-rw-r--r--javax/swing/event/AncestorListener.java13
-rw-r--r--javax/swing/event/ChangeEvent.java12
-rw-r--r--javax/swing/event/ChangeListener.java7
-rw-r--r--javax/swing/event/DocumentEvent.java22
-rw-r--r--javax/swing/event/DocumentListener.java11
-rw-r--r--javax/swing/event/HyperlinkEvent.java27
-rw-r--r--javax/swing/event/HyperlinkListener.java9
-rw-r--r--javax/swing/event/ListDataEvent.java31
-rw-r--r--javax/swing/event/ListDataListener.java11
-rw-r--r--javax/swing/event/ListSelectionEvent.java28
-rw-r--r--javax/swing/event/ListSelectionListener.java9
-rw-r--r--javax/swing/event/MenuEvent.java11
-rw-r--r--javax/swing/event/UndoableEditEvent.java22
-rw-r--r--javax/swing/event/UndoableEditListener.java10
-rw-r--r--javax/swing/plaf/ButtonUI.java5
-rw-r--r--javax/swing/plaf/ComponentUI.java86
-rw-r--r--javax/swing/plaf/LabelUI.java6
-rw-r--r--javax/swing/plaf/ListUI.java6
-rw-r--r--javax/swing/plaf/OptionPaneUI.java5
-rw-r--r--javax/swing/plaf/PanelUI.java6
-rw-r--r--javax/swing/plaf/ScrollPaneUI.java6
-rw-r--r--javax/swing/plaf/TabbedPaneUI.java23
-rw-r--r--javax/swing/plaf/TextUI.java26
-rw-r--r--javax/swing/plaf/TreeUI.java6
-rw-r--r--javax/swing/plaf/ViewportUI.java6
-rw-r--r--javax/swing/plaf/basic/BasicButtonUI.java176
-rw-r--r--javax/swing/plaf/basic/BasicCheckBoxUI.java87
-rw-r--r--javax/swing/plaf/basic/BasicDefaults.java81
-rw-r--r--javax/swing/plaf/basic/BasicGraphicsUtils.java77
-rw-r--r--javax/swing/plaf/basic/BasicLabelUI.java158
-rw-r--r--javax/swing/plaf/basic/BasicListUI.java132
-rw-r--r--javax/swing/plaf/basic/BasicOptionPaneUI.java103
-rw-r--r--javax/swing/plaf/basic/BasicPanelUI.java21
-rw-r--r--javax/swing/plaf/basic/BasicRadioButtonUI.java126
-rw-r--r--javax/swing/plaf/basic/BasicScrollPaneUI.java66
-rw-r--r--javax/swing/plaf/basic/BasicTabbedPaneUI.java64
-rw-r--r--javax/swing/plaf/basic/BasicTextUI.java126
-rw-r--r--javax/swing/plaf/basic/BasicToggleButtonUI.java89
-rw-r--r--javax/swing/plaf/basic/BasicTreeUI.java7
-rw-r--r--javax/swing/plaf/basic/BasicViewportUI.java33
-rw-r--r--javax/swing/plaf/metal/MetalLookAndFeel.java31
-rw-r--r--javax/swing/text/AbstractDocument.java323
-rw-r--r--javax/swing/text/AttributeSet.java17
-rw-r--r--javax/swing/text/BadLocationException.java9
-rw-r--r--javax/swing/text/Caret.java25
-rw-r--r--javax/swing/text/CharacterIterator.java16
-rw-r--r--javax/swing/text/ComponentView.java64
-rw-r--r--javax/swing/text/DefaultCaret.java135
-rw-r--r--javax/swing/text/DefaultEditorKit.java52
-rw-r--r--javax/swing/text/Document.java25
-rw-r--r--javax/swing/text/EditorKit.java34
-rw-r--r--javax/swing/text/Element.java17
-rw-r--r--javax/swing/text/GapContent.java67
-rw-r--r--javax/swing/text/JTextComponent.java222
-rw-r--r--javax/swing/text/Keymap.java22
-rw-r--r--javax/swing/text/PlainDocument.java21
-rw-r--r--javax/swing/text/PlainEditorKit.java62
-rw-r--r--javax/swing/text/Position.java11
-rw-r--r--javax/swing/text/Segment.java73
-rw-r--r--javax/swing/text/Style.java10
-rw-r--r--javax/swing/text/View.java97
-rw-r--r--javax/swing/text/ViewFactory.java7
-rw-r--r--javax/swing/tree/TreeNode.java16
-rw-r--r--javax/swing/undo/UndoableEdit.java6
128 files changed, 9263 insertions, 0 deletions
diff --git a/javax/swing/AbstractAction.java b/javax/swing/AbstractAction.java
new file mode 100644
index 000000000..8eb0c0696
--- /dev/null
+++ b/javax/swing/AbstractAction.java
@@ -0,0 +1,8 @@
+package javax.swing;
+
+
+public abstract
+class ActionAction implements Action, Cloneable, java.io.Serializable
+{
+
+}
diff --git a/javax/swing/AbstractButton.java b/javax/swing/AbstractButton.java
new file mode 100644
index 000000000..71c37210f
--- /dev/null
+++ b/javax/swing/AbstractButton.java
@@ -0,0 +1,513 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.event.*;
+import javax.swing.plaf.*;
+
+import java.util.*;
+import java.beans.*;
+
+
+public abstract class AbstractButton extends JComponent
+ implements ItemSelectable, SwingConstants
+{
+ Icon default_icon, pressed_button, disabled_button,
+ selected_button, disabled_selected_button, current_icon;
+ String text;
+
+ int vert_align = CENTER;
+ int hori_align = CENTER;
+ int hori_text_pos = CENTER;
+ int vert_text_pos = CENTER;
+
+ boolean paint_border = true, paint_focus;
+ Action action_taken;
+ ButtonModel model;
+ Insets margin;
+
+
+ public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted";
+
+ static private class JFocusListener implements FocusListener
+ {
+ AbstractButton c;
+
+ JFocusListener(AbstractButton c)
+ {
+ this.c = c;
+ }
+
+ public void focusLost(FocusEvent event)
+ {
+ c.getModel().setArmed(false);
+
+ System.out.println("LOST FOCUS");
+ if (c.isFocusPainted())
+ {
+ c.repaint();
+ }
+ }
+ public void focusGained(FocusEvent event)
+ {
+ System.out.println("GAIN FOCUS");
+ }
+ }
+
+
+ /**********************************************
+ *
+ *
+ * Constructors
+ *
+ *
+ ****************/
+
+ AbstractButton()
+ {
+ this("",null);
+ }
+
+ AbstractButton(String text,
+ Icon icon)
+ {
+ this.text = text;
+ setIcon(icon);
+
+ setAlignmentX(LEFT_ALIGNMENT);
+ setAlignmentY(CENTER_ALIGNMENT);
+
+ addFocusListener( new JFocusListener(this) );
+
+ setModel(new DefaultButtonModel(this));
+
+ updateUI(); // get a proper ui
+ }
+
+
+ /**********************************************
+ *
+ *
+ * Actions etc
+ *
+ *
+ ****************/
+
+ ButtonModel getModel()
+ { return model; }
+ void setModel(ButtonModel newModel)
+ { model = newModel; }
+
+ String getActionCommand()
+ { return getModel().getActionCommand(); }
+ void setActionCommand(String aCommand)
+ { getModel().setActionCommand(aCommand); }
+
+ void addActionListener(ActionListener l)
+ { getModel().addActionListener(l); }
+ void removeActionListener(ActionListener l)
+ { getModel().removeActionListener(l); }
+
+ void addChangeListener(ChangeListener l)
+ { getModel().addChangeListener(l); }
+ void removeChangeListener(ChangeListener l)
+ { getModel().removeChangeListener(l); }
+
+ public void addItemListener(ItemListener l)
+ { getModel().addItemListener(l); }
+ public void removeItemListener(ItemListener l)
+ { getModel().removeItemListener(l); }
+
+ int getHorizontalAlignment()
+ { return hori_align; }
+ int getHorizontalTextPosition()
+ { return hori_text_pos; }
+ int getVerticalAlignment()
+ { return vert_align; }
+ int getVerticalTextPosition()
+ { return vert_text_pos; }
+
+
+ protected void fireItemStateChanged(ItemEvent event)
+ { getModel().fireItemStateChanged(event); }
+ protected void fireStateChanged(ChangeEvent event)
+ { getModel().fireStateChanged(event); }
+ protected void fireActionPerformed(ActionEvent event)
+ { getModel().fireActionPerformed(event); }
+
+ void setVerticalAlignment(int alignment)
+ { vert_align = alignment; }
+ void setHorizontalAlignment(int alignment)
+ { hori_align = alignment; }
+ void setVerticalTextPosition(int textPosition)
+ { vert_text_pos = textPosition; }
+ void setHorizontalTextPosition(int textPosition)
+ { hori_text_pos = textPosition; }
+
+ int getMnemonic()
+ { return getModel().getMnemonic(); }
+ void setMnemonic(char mne)
+ { getModel().setMnemonic(mne); }
+ void setMnemonic(int mne)
+ { getModel().setMnemonic(mne); }
+
+ void setRolloverEnabled(boolean b)
+ { getModel().setRollover(b); }
+ boolean isRolloverEnabled()
+ { return getModel().isRollover(); }
+
+
+ boolean isBorderPainted()
+ { return paint_border; }
+ void setBorderPainted(boolean b)
+ {
+ if (b != paint_border)
+ {
+ paint_border = b;
+ revalidate();
+ repaint();
+ }
+ }
+
+ Action getAction()
+ { return action_taken; }
+ void setAction(Action a)
+ {
+ action_taken = a;
+ revalidate();
+ repaint();
+ }
+
+ void setSelected(boolean b)
+ { getModel().setSelected(b); }
+ boolean isSelected()
+ { return getModel().isSelected(); }
+
+
+ Icon getIcon()
+ { return default_icon; }
+ void setIcon(Icon defaultIcon)
+ {
+ if (default_icon == defaultIcon)
+ return;
+
+ default_icon = defaultIcon;
+ if (default_icon != null)
+ {
+ default_icon.setParent(this);
+ }
+ revalidate();
+ repaint();
+ }
+
+ String getText()
+ { return text; }
+ void setLabel(String label)
+ { setText(label); }
+ String getLabel()
+ { return getText(); }
+ void setText(String text)
+ {
+ this.text = text;
+ revalidate();
+ repaint();
+ }
+
+
+ Insets getMargin()
+ { return margin; }
+ void setMargin(Insets m)
+ {
+ margin = m;
+ revalidate();
+ repaint();
+ }
+
+ public void setEnabled(boolean b)
+ {
+ super.setEnabled(b);
+ getModel().setEnabled(b);
+ repaint();
+ }
+
+ Icon getPressedIcon()
+ { return pressed_button; }
+ void setPressedIcon(Icon pressedIcon)
+ {
+ pressed_button = pressedIcon;
+ revalidate();
+ repaint();
+ }
+
+
+ Icon getDisabledIcon()
+ { return disabled_button; }
+ void setDisabledIcon(Icon disabledIcon)
+ {
+ disabled_button = disabledIcon;
+ revalidate();
+ repaint();
+ }
+
+ public boolean isFocusPainted()
+ { return paint_focus; }
+ public void setFocusPainted(boolean b)
+ {
+ boolean old = paint_focus;
+ paint_focus = b;
+
+ firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY,
+ old,
+ b);
+ if (hasFocus())
+ {
+ revalidate();
+ repaint();
+ }
+ }
+
+ public boolean isFocusTraversable()
+ {
+ //Identifies whether or not this component can receive the focus.
+ return true;
+ }
+
+
+ protected int checkHorizontalKey(int key, String exception)
+ {
+ // Verify that key is a legal value for the horizontalAlignment properties.
+ return 0;
+ }
+ protected int checkVerticalKey(int key, String exception)
+ {
+ // Ensures that the key is a valid.
+ return 0;
+ }
+ protected void configurePropertiesFromAction(Action a)
+ {
+ //Factory method which sets the ActionEvent source's properties according to values from the Action instance.
+ }
+
+ protected ActionListener createActionListener()
+ {
+ return new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) { }
+ };
+ }
+
+ protected PropertyChangeListener createActionPropertyChangeListener(Action a)
+ {
+ //Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.
+ return null;
+ }
+ protected ChangeListener createChangeListener()
+ {
+ // Subclasses that want to handle ChangeEvents differently can override this to return another ChangeListener implementation.
+ return new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent e) { }
+ };
+ }
+
+ protected ItemListener createItemListener()
+ {
+ return new ItemListener()
+ {
+ public void itemStateChanged(ItemEvent e) { }
+ };
+ }
+
+
+ void doClick()
+ {
+ doClick(100);
+ }
+ void doClick(int pressTime)
+ {
+ Toolkit.tlkBeep ();
+ //Programmatically perform a "click".
+ }
+
+
+ Icon getDisabledSelectedIcon()
+ {
+ //Returns the icon used by the button when it's disabled and selected.
+ return disabled_selected_button;
+ }
+
+
+ Icon getRolloverIcon()
+ {
+ // Returns the rollover icon for the button.
+ return null;
+ }
+
+ Icon getRolloverSelectedIcon()
+ {
+ // Returns the rollover selection icon for the button.
+ return null;
+ }
+ Icon getSelectedIcon()
+ {
+ // Returns the selected icon for the button.
+ return selected_button;
+ }
+
+
+ public Object[] getSelectedObjects()
+ {
+ //Returns an array (length 1) containing the label or null if the button is not selected.
+ return null;
+ }
+
+
+ public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
+ {
+ //This is overridden to return false if the current Icon's Image is not equal to the passed in Image img.
+ return current_icon == img;
+ }
+
+ boolean isContentAreaFilled()
+ {
+ // Checks whether the "content area" of the button should be filled.
+ return false;
+ }
+
+
+
+ protected void paintBorder(Graphics g)
+ {
+ // Paint the button's border if BorderPainted property is true.
+ if (isBorderPainted())
+ super.paintBorder(g);
+ }
+ protected String paramString()
+ {
+ // Returns a string representation of this AbstractButton.
+ return "AbstractButton";
+ }
+
+
+ void setContentAreaFilled(boolean b)
+ {
+ //Sets whether the button should paint the content area or leave it transparent.
+ }
+
+
+ void setDisabledSelectedIcon(Icon disabledSelectedIcon)
+ {
+ // Sets the disabled selection icon for the button.
+ }
+
+ void setRolloverIcon(Icon rolloverIcon)
+ {
+ // Sets the rollover icon for the button.
+ }
+ void setRolloverSelectedIcon(Icon rolloverSelectedIcon)
+ {
+ // Sets the rollover selected icon for the button.
+ }
+
+
+ void setSelectedIcon(Icon selectedIcon)
+ {
+ // Sets the selected icon for the button.
+ }
+
+
+ public void setUI(ButtonUI ui)
+ { // Sets the L&F object that renders this component.
+ super.setUI(ui);
+ }
+
+ ButtonUI getUI()
+ {
+ //Returns the L&F object that renders this component.
+ return (ButtonUI) ui;
+ }
+
+ void updateUI()
+ {
+ /*
+ // Notification from the UIFactory that the L&F has changed.
+ if (getUI() == null)
+ {
+ setUI(getUI());
+ }
+ */
+ }
+
+ protected void processActionEvent(ActionEvent e)
+ {
+ System.out.println("PROCESS-ACTION-EVENT: " + e);
+ }
+
+
+ protected void processMouseEvent(MouseEvent e)
+ {
+ // System.out.println("PROCESS-MOUSE-EVENT: " + e + ", PRESSED-IN-MODEL="+getModel().isPressed());
+
+ switch (e.getID())
+ {
+ case MouseEvent.MOUSE_MOVED:
+ {
+ break;
+ }
+ case MouseEvent.MOUSE_PRESSED:
+ {
+ if (! isEnabled())
+ {
+ System.out.println("button not enabled, ignoring press");
+ }
+ else
+ {
+ System.out.println("telling model:press: " + getModel());
+ getModel().setPressed(true);
+ repaint();
+ }
+ break;
+ }
+
+ case MouseEvent.MOUSE_RELEASED:
+ {
+ if (! isEnabled())
+ {
+ System.out.println("button not enabled, ignoring release");
+ }
+ else
+ {
+ int flags = 0;
+
+ System.out.println(" XXX--> " + getActionCommand());
+
+ fireActionPerformed(new ActionEvent(this,
+ ActionEvent.ACTION_PERFORMED,
+ getActionCommand(),
+ flags));
+
+ //System.out.println("telling model:release");
+ getModel().setPressed(false);
+ repaint();
+ }
+ break;
+ }
+ case MouseEvent.MOUSE_CLICKED:
+ {
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/AbstractListModel.java b/javax/swing/AbstractListModel.java
new file mode 100644
index 000000000..263ff70cb
--- /dev/null
+++ b/javax/swing/AbstractListModel.java
@@ -0,0 +1,87 @@
+package javax.swing;
+
+import javax.swing.event.*;
+import java.util.*;
+
+// fire up change events before or after
+// the element removed/added ?
+
+public class AbstractListModel implements ListModel
+{
+ Vector elts = new Vector();
+
+ public int getSize()
+ {
+ return elts.size();
+ }
+
+ public Object getElementAt(int index)
+ {
+ return elts.elementAt(index);
+ }
+
+ public void addElement(Object a)
+ {
+ int q = elts.size();
+ elts.addElement(a);
+ fire_up_change_events(ListDataEvent.INTERVAL_ADDED,
+ q,
+ q);
+ }
+
+ public void insertElementAt(Object a, int index)
+ {
+ elts.insertElementAt(a, index);
+ fire_up_change_events(ListDataEvent.INTERVAL_ADDED,
+ index, index);
+ }
+
+ void remove(int a)
+ {
+ elts.removeElementAt(a);
+ fire_up_change_events(ListDataEvent.INTERVAL_REMOVED,
+ a, a);
+ }
+
+ /*********************************************
+ *
+ * handle data change events
+ *
+ ************/
+
+ Vector listeners = new Vector();
+
+ void fire_up_change_events(int type,
+ int lower,
+ int upper)
+ {
+ for (int i=0; i<listeners.size(); i++)
+ {
+ ListDataListener l = (ListDataListener) listeners.get(i);
+
+ l.contentsChanged(new ListDataEvent(this,
+ type,
+ lower,
+ upper));
+ }
+ }
+
+ public void addListDataListener(ListDataListener l)
+ {
+ listeners.addElement(l);
+ }
+
+ public void removeListDataListener(ListDataListener l)
+ {
+ listeners.removeElement(l);
+ }
+}
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/AbstractSet.java b/javax/swing/AbstractSet.java
new file mode 100644
index 000000000..d0e90634e
--- /dev/null
+++ b/javax/swing/AbstractSet.java
@@ -0,0 +1,62 @@
+package javax.swing;
+
+import java.util.*;
+
+public abstract class AbstractSet extends AbstractCollection implements Set
+{
+ boolean contained(Object []a1, Object b)
+ {
+ for (int i=0;i<a1.length;i++)
+ {
+ if (a1[i] == b)
+ return true;
+ }
+ return false;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (! (o instanceof AbstractSet))
+ return false;
+ AbstractSet s = (AbstractSet) o;
+
+ if (s == this)
+ return true;
+
+ if (s.size() != size())
+ return false;
+
+ Object[] a1 = s.toArray();
+ Object[] a2 = toArray();
+
+ for (int i=0;i<a1.length;i++)
+ {
+ if (! contained(a2, a1[i]))
+ return false;
+ }
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int hash = 0;
+ Object[] a1 = toArray();
+
+ if (a1 == null)
+ return 0;
+
+ for (int i=0; i<a1.length; i++)
+ {
+ hash += a1[i].hashCode();
+ }
+ return hash;
+ }
+
+ public boolean removeAll(Collection c)
+ {
+ return false;
+ }
+}
+
+
+
diff --git a/javax/swing/Accessible.java b/javax/swing/Accessible.java
new file mode 100644
index 000000000..1ce7d261b
--- /dev/null
+++ b/javax/swing/Accessible.java
@@ -0,0 +1,7 @@
+package javax.swing;
+
+public abstract
+interface Accessible
+{
+ AccessibleContext getAccessibleContext();
+}
diff --git a/javax/swing/AccessibleContext.java b/javax/swing/AccessibleContext.java
new file mode 100644
index 000000000..7c0689cc6
--- /dev/null
+++ b/javax/swing/AccessibleContext.java
@@ -0,0 +1,7 @@
+package javax.swing;
+
+
+public abstract
+interface AccessibleContext
+{
+}
diff --git a/javax/swing/Action.java b/javax/swing/Action.java
new file mode 100644
index 000000000..3f2e31233
--- /dev/null
+++ b/javax/swing/Action.java
@@ -0,0 +1,24 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.beans.PropertyChangeListener;
+
+
+public abstract
+interface Action extends ActionListener
+{
+ static String DEFAULT = "";
+ static String LONG_DESCRIPTION="";
+ static String NAME = "";
+ static String SHORT_DESCRIPTION="";
+ static String SMALL_ICON="";
+
+
+ void addPropertyChangeListener(PropertyChangeListener listener);
+ Object getValue(String key);
+ boolean isEnabled();
+ void putValue(String key, Object value);
+ void removePropertyChangeListener(PropertyChangeListener listener);
+ void setEnabled(boolean b);
+}
diff --git a/javax/swing/BorderFactory.java b/javax/swing/BorderFactory.java
new file mode 100644
index 000000000..4a4433c7b
--- /dev/null
+++ b/javax/swing/BorderFactory.java
@@ -0,0 +1,331 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.font.*;
+import javax.swing.border.*;
+
+
+public class BorderFactory
+{
+ public static Border createLineBorder(Color color)
+ { /*
+ Creates a line border withe the specified color.
+
+ Parameters:
+ color - a Color to use for the lineReturns:
+ the Border object
+createLineBorder
+ */
+ return null;
+ }
+
+public static Border createLineBorder(Color color,
+ int thickness)
+ { /*
+
+ Creates a line border withe the specified color and width. The width applies to all 4 sides of the border. To specify widths individually for the top, bottom, left, and right, use createMatteBorder(int,int,int,int,Color).
+
+ Parameters:
+ color - a Color to use for the linethickness - an int specifying the width in pixelsReturns:
+ the Border object
+createRaisedBevelBorder
+ */
+ return null;
+ }
+
+
+public static Border createRaisedBevelBorder()
+ { /*
+
+ Created a border with a raised beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a raised border, highlights are on top and shadows are underneath.)
+
+ Returns:
+ the Border object
+createLoweredBevelBorder
+
+ */
+ return null;
+ }
+
+public static Border createLoweredBevelBorder()
+ { /*
+
+ Created a border with a lowered beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.)
+
+ Returns:
+ the Border object
+createBevelBorder
+
+ */
+ return null;
+ }
+
+public static Border createBevelBorder(int type)
+
+ { /*
+ Create a beveled border of the specified type, using brighter shades of the component's current background color for highlighting, and darker shading for shadows. (In a lowered border, shadows are on top and highlights are underneath.).
+
+ Parameters:
+ type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDReturns:
+ the Border object
+createBevelBorder
+
+ */
+ return null;
+ }
+
+public static Border createBevelBorder(int type,
+ Color highlight,
+ Color shadow)
+ { /*
+
+ Create a beveled border of the specified type, using the specified highlighting and shadowing. The outer edge of the highlighted area uses a brighter shade of the highlight color. The inner edge of the shadow area uses a brighter shade of the shadaw color.
+
+ Parameters:
+ type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDhighlight - a Color object for highlightsshadow - a Color object for shadowsReturns:
+ the Border object
+createBevelBorder
+
+ */
+ return null;
+ }
+
+public static Border createBevelBorder(int type,
+ Color highlightOuter,
+ Color highlightInner,
+ Color shadowOuter,
+ Color shadowInner)
+ { /*
+
+ Create a beveled border of the specified type, using the specified colors for the inner and outer highlight and shadow areas.
+
+ Parameters:
+ type - an int specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDhighlightOuter - a Color object for the outer edge of the highlight areahighlightInner - a Color object for the inner edge of the highlight areashadowOuter - a Color object for the outer edge of the shadow areashadowInner - a Color object for the inner edge of the shadow areaReturns:
+ the Border object
+createEtchedBorder
+ */
+ return null;
+ }
+
+
+public static Border createEtchedBorder()
+ { /*
+
+ Create a border with an "etched" look using the component's current background color for highlighting and shading.
+
+ Returns:
+ the Border object
+createEtchedBorder
+
+ */
+ return null;
+ }
+
+public static Border createEtchedBorder(Color highlight,
+ Color shadow)
+ { /*
+
+ Create a border with an "etched" look using the specified highlighting and shading colors.
+
+ Parameters:
+ highlight - a Color object for the border highlightsshadow - a Color object for the border shadowsReturns:
+ the Border object
+createTitledBorder
+
+ */
+ return null;
+ }
+
+ public static TitledBorder createTitledBorder(String title)
+ { /*
+ Create a new title border specifying the text of the title, using the default border (etched), using the default text position (sitting on the top line) and default justification (left) and using the default font and text color determined by the current look and feel.
+
+ Parameters:
+ title - a String containing the text of the titleReturns:
+ the TitledBorder object
+createTitledBorder
+
+ */
+ return null;
+ }
+
+ public static TitledBorder createTitledBorder(Border border)
+ { /*
+
+ Create a new title border with an empty title specifying the border object, using the default text position (sitting on the top line) and default justification (left) and using the default font, text color, and border determined by the current look and feel. (The Motif and Windows look and feels use an etched border; The Java look and feel use a gray border.)
+
+ Parameters:
+ border - the Border object to add the title toReturns:
+ the TitledBorder object
+createTitledBorder
+
+ */
+ return null;
+ }
+
+public static TitledBorder createTitledBorder(Border border,
+ String title)
+ { /*
+
+ Add a title to an existing border, specifying the text of the title, using the default positioning (sitting on the top line) and default justification (left) and using the default font and text color determined by the current look and feel.
+
+ Parameters:
+ border - the Border object to add the title totitle - a String containing the text of the titleReturns:
+ the TitledBorder object
+createTitledBorder
+
+ */
+ return null;
+ }
+
+public static TitledBorder createTitledBorder(Border border,
+ String title,
+ int titleJustification,
+ int titlePosition)
+ { /*
+
+ Add a title to an existing border, specifying the text of the title along with its positioning, using the default font and text color determined by the current look and feel.
+
+ Parameters:
+ border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).Returns:
+ the TitledBorder object
+createTitledBorder
+
+ */
+ return null;
+ }
+
+public static TitledBorder createTitledBorder(Border border,
+ String title,
+ int titleJustification,
+ int titlePosition,
+ Font titleFont)
+ { /*
+
+ Add a title to an existing border, specifying the text of the title along with its positioning and font, using the default text color determined by the current look and feel.
+
+ Parameters:
+ border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).titleFont - a Font object specifying the title fontReturns:
+ the TitledBorder object
+createTitledBorder
+
+ */
+ return null;
+ }
+
+public static TitledBorder createTitledBorder(Border border,
+ String title,
+ int titleJustification,
+ int titlePosition,
+ Font titleFont,
+ Color titleColor)
+ { /*
+
+ Add a title to an existing border, specifying the text of the title along with its positioning, font, and color.
+
+ Parameters:
+ border - the Border object to add the title totitle - a String containing the text of the titletitleJustification - an int specifying the left/right position of the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).titlePosition - an int specifying the vertical position of the text in relation to the border -- one of: TitledBorder.ABOVE_TOP, TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP, TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).titleFont - a Font object specifying the title fonttitleColor - a Color object specifying the title colorReturns:
+ the TitledBorder object
+createEmptyBorder
+
+ */
+ return null;
+ }
+
+public static Border createEmptyBorder()
+ { /*
+
+ Creates an empty border that takes up no space. (The width of the top, bottom, left, and right sides are all zero.)
+
+ Returns:
+ the Border object
+createEmptyBorder
+
+ */
+ return null;
+ }
+
+public static Border createEmptyBorder(int top,
+ int left,
+ int bottom,
+ int right)
+ { /*
+
+ Creates an empty border that takes up no space but which does no drawing, specifying the width of the top, left, bottom, and right sides.
+
+ Parameters:
+ top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelsReturns:
+ the Border object
+createCompoundBorder
+
+ */
+ return null;
+ }
+
+public static CompoundBorder createCompoundBorder()
+ { /*
+
+ Create a compound border with a null inside edge and a null outside edge.
+
+ Returns:
+ the CompoundBorder object
+createCompoundBorder
+ */
+ return null;
+ }
+
+
+public static CompoundBorder createCompoundBorder(Border outsideBorder,
+ Border insideBorder)
+ { /*
+
+ Create a compound border specifying the border objects to use for the outside and inside edges.
+
+ Parameters:
+ outsideBorder - a Border object for the outer edge of the compound borderinsideBorder - a Border object for the inner edge of the compound borderReturns:
+ the CompoundBorder object
+createMatteBorder
+ */
+ return null;
+ }
+
+
+public static MatteBorder createMatteBorder(int top,
+ int left,
+ int bottom,
+ int right,
+ Color color)
+ { /*
+
+ Create a matte-look border using a solid color. (The difference between this border and a line border is that you can specify the individual border dimensions.)
+
+ Parameters:
+ top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelscolor - a Color to use for the borderReturns:
+ the MatteBorder object
+createMatteBorder
+
+ */
+ return null;
+ }
+
+public static MatteBorder createMatteBorder(int top,
+ int left,
+ int bottom,
+ int right,
+ Icon tileIcon)
+ { /*
+
+ Create a matte-look border that consists of multiple tiles of a specified icon. Multiple copies of the icon are placed side-by-side to fill up the border area.
+
+ Note:
+ If the icon doesn't load, the border area is painted gray.
+
+ Parameters:
+ top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelstileIcon - the Icon object used for the border tilesReturns:
+ the MatteBorder object
+
+ */
+ return null;
+ }
+
+}
diff --git a/javax/swing/Box.java b/javax/swing/Box.java
new file mode 100644
index 000000000..d9ecfba19
--- /dev/null
+++ b/javax/swing/Box.java
@@ -0,0 +1,12 @@
+package javax.swing;
+
+
+
+public class Box extends JComponent
+{
+ Box(int a)
+ {
+ setLayout(new BoxLayout(this,
+ a));
+ }
+}
diff --git a/javax/swing/BoxLayout.java b/javax/swing/BoxLayout.java
new file mode 100644
index 000000000..3ee0f344c
--- /dev/null
+++ b/javax/swing/BoxLayout.java
@@ -0,0 +1,107 @@
+package javax.swing;
+
+import java.awt.*;
+
+public class BoxLayout implements LayoutManager2
+{
+ GridLayout gridbag;
+
+ final static int X_AXIS = 0;
+ final static int Y_AXIS = 1;
+
+ int way = X_AXIS;
+
+ BoxLayout(JComponent p,
+ int way)
+ {
+ int width = 0;
+ int height = 0;
+
+ this.way = way;
+
+ if (way == X_AXIS)
+ {
+ width = 1;
+ }
+ else
+ {
+ height = 1;
+ }
+
+
+ gridbag = new GridLayout(width, height);
+ }
+
+ BoxLayout(int way)
+ {
+ this(null,way);
+ }
+
+
+ public void addLayoutComponent(String name, Component comp)
+ {
+ if (way == X_AXIS)
+ {
+ gridbag.setColumns( gridbag.getColumns() + 1);
+ }
+ else
+ {
+ gridbag.setRows( gridbag.getRows() + 1);
+ }
+ }
+
+ public void removeLayoutComponent(Component comp)
+ {
+ gridbag.removeLayoutComponent(comp);
+ if (way == X_AXIS)
+ {
+ gridbag.setColumns( gridbag.getColumns() - 1);
+ }
+ else
+ {
+ gridbag.setRows( gridbag.getRows() - 1);
+ }
+ }
+
+ public Dimension preferredLayoutSize(Container parent)
+ {
+ return gridbag.preferredLayoutSize(parent);
+ }
+
+ public Dimension minimumLayoutSize(Container parent)
+ {
+ return gridbag.minimumLayoutSize(parent);
+ }
+
+ public void layoutContainer(Container parent)
+ {
+ gridbag.layoutContainer(parent);
+ }
+
+ public void addLayoutComponent ( Component child, Object constraints )
+ {
+ addLayoutComponent("", child);
+ }
+
+ public float getLayoutAlignmentX ( Container parent )
+ {
+ return 0;
+ }
+
+ public float getLayoutAlignmentY ( Container parent )
+ {
+ return 0;
+ }
+
+ public void invalidateLayout ( Container parent )
+ {
+ }
+
+ public Dimension maximumLayoutSize ( Container parent )
+ {
+ return preferredLayoutSize(parent);
+ }
+}
+
+
+
diff --git a/javax/swing/ButtonGroup.java b/javax/swing/ButtonGroup.java
new file mode 100644
index 000000000..5382800e4
--- /dev/null
+++ b/javax/swing/ButtonGroup.java
@@ -0,0 +1,100 @@
+package javax.swing;
+
+import java.io.*;
+import java.util.*;
+import javax.swing.event.*;
+
+
+public class ButtonGroup implements Serializable
+{
+ Vector v = new Vector();
+ ButtonModel sel;
+
+ public ButtonGroup() {}
+
+ public void add(AbstractButton b)
+ {
+ b.getModel().setGroup(this);
+ v.addElement(b);
+ }
+
+ public void remove(AbstractButton b)
+ {
+ b.getModel().setGroup(null);
+ v.removeElement(b);
+ }
+
+
+ public Enumeration getElements() {
+ return v.elements();
+ }
+
+ public ButtonModel getSelection() {
+ return sel;
+ }
+
+ AbstractButton FindButton(ButtonModel m)
+ {
+ for (int i=0;i<v.size();i++)
+ {
+ AbstractButton a = (AbstractButton) v.get(i);
+ if (a.getModel()== m)
+ {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ public void setSelected(ButtonModel m, boolean b)
+ {
+ if ((m == sel) &&
+ (b == true))
+ {
+ // clicked on sam item twice.
+ System.out.println("PRESSED TWICE:" + m + ", sel="+sel);
+ return;
+ }
+
+ if (sel != null)
+ {
+
+ System.out.println("DESELECTING: " + sel);
+ sel.setSelected(!b);
+
+ AbstractButton but = FindButton(sel);
+ if (but != null)
+ {
+ System.out.println("REPAINT-REQUIST: " + but.text);
+ //but.revalidate();
+ but.repaint();
+ }
+ }
+ else
+ {
+ System.out.println("NO SELECTION YET");
+ }
+
+ sel = m;
+ }
+
+ public boolean isSelected(ButtonModel m)
+ {
+ return (m == sel);
+ }
+
+ public int getButtonCount()
+ {
+ return v.size();
+ }
+
+}
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/ButtonModel.java b/javax/swing/ButtonModel.java
new file mode 100644
index 000000000..a6fa32849
--- /dev/null
+++ b/javax/swing/ButtonModel.java
@@ -0,0 +1,54 @@
+package javax.swing;
+
+import java.awt.*;
+
+import java.awt.event.*;
+import javax.swing.event.*;
+
+
+
+public abstract
+interface ButtonModel extends ItemSelectable
+{
+ boolean isArmed();
+ void setArmed(boolean b);
+
+
+ boolean isEnabled();
+ void setEnabled(boolean b);
+
+ void setPressed(boolean b);
+ boolean isPressed();
+
+
+ void removeActionListener(ActionListener l);
+ void addActionListener(ActionListener l);
+
+ void addItemListener(ItemListener l);
+ void removeItemListener(ItemListener l);
+
+ void addChangeListener(ChangeListener l);
+ void removeChangeListener(ChangeListener l);
+
+ void setRollover(boolean b);
+ boolean isRollover();
+
+ int getMnemonic();
+ void setMnemonic(int key);
+
+ void setActionCommand(String s);
+ String getActionCommand();
+
+ void setGroup(ButtonGroup group);
+
+ void setSelected(boolean b);
+ boolean isSelected();
+
+
+ // there are not in the spec !!
+
+
+ void fireItemStateChanged(ItemEvent event);
+ void fireStateChanged(ChangeEvent event);
+ void fireActionPerformed(ActionEvent event);
+}
diff --git a/javax/swing/ComponentInputMap.java b/javax/swing/ComponentInputMap.java
new file mode 100644
index 000000000..8dce04d71
--- /dev/null
+++ b/javax/swing/ComponentInputMap.java
@@ -0,0 +1,6 @@
+package javax.swing;
+
+
+public class ComponentInputMap extends InputMap
+{
+}
diff --git a/javax/swing/DefaultButtonModel.java b/javax/swing/DefaultButtonModel.java
new file mode 100644
index 000000000..dfa32dea4
--- /dev/null
+++ b/javax/swing/DefaultButtonModel.java
@@ -0,0 +1,132 @@
+package javax.swing;
+
+import java.util.*;
+import java.awt.event.*;
+import java.awt.*;
+import javax.swing.event.*;
+
+public
+class DefaultButtonModel implements ButtonModel, java.io.Serializable
+{
+ Vector actions = new Vector();
+
+ Vector items = new Vector();
+ Vector changes = new Vector();
+ ButtonGroup group;
+ JComponent comp;
+
+
+ DefaultButtonModel(JComponent a)
+ {
+ comp = a;
+ }
+
+
+ public Object[] getSelectedObjects()
+ {
+ return null;
+ }
+
+
+ public void fireItemStateChanged(ItemEvent event)
+ {
+ for (int i=0;i<items.size();i++)
+ {
+ ItemListener a = (ItemListener) items.get(i);
+ a.itemStateChanged(event);
+ }
+ }
+ public void fireStateChanged(ChangeEvent event)
+ {
+ for (int i=0;i<changes.size();i++)
+ {
+ ChangeListener a = (ChangeListener) changes.get(i);
+ a.stateChanged(event);
+ }
+ }
+ public void fireActionPerformed(ActionEvent event)
+ {
+ for (int i=0;i<actions.size();i++)
+ {
+ ActionListener a = (ActionListener) actions.get(i);
+ a.actionPerformed(event);
+ }
+ }
+
+ boolean arm;
+ public boolean isArmed() { return arm; }
+ public void setArmed(boolean b) { arm = b; }
+
+ boolean enabled = true;
+ public boolean isEnabled() { return enabled; }
+ public void setEnabled(boolean b) { enabled = b; }
+
+ boolean pressed;
+ public void setPressed(boolean b)
+ {
+ pressed = b;
+ }
+ public boolean isPressed() { return pressed; }
+
+
+ public void removeActionListener(ActionListener l) { actions.removeElement(l); }
+ public void addActionListener(ActionListener l)
+ {
+ comp.eventMask |= AWTEvent.ACTION_EVENT_MASK;
+ actions.addElement(l);
+ }
+
+ public void addItemListener(ItemListener l) { items.addElement(l); }
+ public void removeItemListener(ItemListener l) { items.removeElement(l); }
+
+ public void addChangeListener(ChangeListener l) { changes.addElement(l); }
+ public void removeChangeListener(ChangeListener l) { changes.removeElement(l); }
+
+ boolean roll;
+ public void setRollover(boolean b) { roll = b; }
+ public boolean isRollover() { return roll; }
+
+ int mne;
+ public int getMnemonic() { return mne; }
+ public void setMnemonic(int key) { mne = key; }
+
+ String com;
+ public void setActionCommand(String s) { com = s; }
+ public String getActionCommand() { return com; }
+
+ public void setGroup(ButtonGroup group)
+ {
+ this.group = group;
+ }
+
+ boolean sel;
+ public void setSelected(boolean b)
+ {
+ if (group != null)
+ {
+ if (b == true)
+ {
+ System.out.println("selected button in group:"+this);
+ group.setSelected(this, b);
+ sel = true;
+ }
+ else
+ {
+ System.out.println("deselected button in group: " + this);
+ sel = false;
+ }
+ }
+ else
+ {
+ sel = b;
+ }
+ }
+ public boolean isSelected() { return sel; }
+}
+
+
+
+
+
+
+
diff --git a/javax/swing/DefaultCellRenderer.java b/javax/swing/DefaultCellRenderer.java
new file mode 100644
index 000000000..11041cbcd
--- /dev/null
+++ b/javax/swing/DefaultCellRenderer.java
@@ -0,0 +1,38 @@
+package javax.swing;
+
+import java.awt.*;
+
+
+// this is what SUN basically told us to do so:
+// no icon though as that's not implemented yet....
+
+public class DefaultCellRenderer extends JLabel implements ListCellRenderer
+{
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus)
+ {
+ String s = value.toString();
+ setText(s);
+
+ // System.out.println("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" + s);
+
+
+ if (isSelected)
+ {
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ }
+ else
+ {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+
+ setEnabled(list.isEnabled());
+ setFont(list.getFont());
+ return this;
+ }
+}
diff --git a/javax/swing/DefaultListModel.java b/javax/swing/DefaultListModel.java
new file mode 100644
index 000000000..e02a8f698
--- /dev/null
+++ b/javax/swing/DefaultListModel.java
@@ -0,0 +1,8 @@
+package javax.swing;
+
+public class DefaultListModel extends AbstractListModel
+{
+ DefaultListModel()
+ {
+ }
+}
diff --git a/javax/swing/DefaultListSelectionModel.java b/javax/swing/DefaultListSelectionModel.java
new file mode 100644
index 000000000..b6cd70175
--- /dev/null
+++ b/javax/swing/DefaultListSelectionModel.java
@@ -0,0 +1,144 @@
+package javax.swing;
+
+import javax.swing.event.*;
+import java.util.*;
+
+public class DefaultListSelectionModel implements ListSelectionModel
+{
+ int mode = SINGLE_SELECTION;
+
+ Vector sel = new Vector();
+
+ Vector listeners;
+
+ Vector get_listeners()
+ {
+ if (listeners == null)
+ listeners = new Vector();
+ return listeners;
+ }
+
+
+ public void addListSelectionListener(ListSelectionListener listener)
+ {
+ get_listeners().addElement(listener);
+ }
+
+ public void removeListSelectionListener(ListSelectionListener listener)
+ {
+ get_listeners().removeElement(listener);
+ }
+
+ class Range
+ {
+ int i0, i1;
+
+ Range(int a, int b)
+ {
+ if (a > b)
+ {
+ i0 = b;
+ i1 = a;
+ }
+ else
+ {
+ i0 = a;
+ i1 = b;
+ }
+ }
+ }
+
+
+ public int getMinSelectionIndex()
+ {
+ if (isSelectionEmpty())
+ return -1;
+
+ boolean first = true;
+ int min = -1;
+ for (int i=0;i<sel.size();i++)
+ {
+ Range r = (Range) sel.get(i);
+
+ if (first)
+ {
+ min = r.i0;
+ first = false;
+ }
+ else
+ {
+ if (r.i0 > min)
+ {
+ min = r.i0;
+ }
+ }
+ }
+ return min;
+ }
+
+ public int getMaxSelectionIndex()
+ {
+ if (isSelectionEmpty())
+ return -1;
+
+ boolean first = true;
+ int max = -1;
+ for (int i=1;i<sel.size();i++)
+ {
+ Range r = (Range) sel.get(i);
+
+ if (first)
+ {
+ max = r.i1;
+ }
+ else
+ {
+ if (r.i1 > max)
+ {
+ max = r.i1;
+ }
+ }
+ }
+ return max;
+ }
+
+ public boolean isSelectedIndex(int a)
+ {
+ for (int i=0;i<sel.size();i++)
+ {
+ Range r = (Range) sel.get(i);
+ if (r.i0 <= a &&
+ r.i1 >= a)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public int getSelectionMode()
+ { return mode; }
+ public void setSelectionMode(int a)
+ { mode = a; }
+
+ boolean isSelectionEmpty()
+ {
+ return sel.size() == 0;
+ }
+
+ public void clearSelection()
+ {
+ sel.removeAllElements();
+ }
+
+ public void setSelectionInterval(int index0, int index1)
+ {
+ if (mode == SINGLE_SELECTION)
+ {
+ sel.removeAllElements();
+ }
+
+ sel.addElement(new Range(index0, index1));
+ }
+}
diff --git a/javax/swing/Icon.java b/javax/swing/Icon.java
new file mode 100644
index 000000000..1dd46654c
--- /dev/null
+++ b/javax/swing/Icon.java
@@ -0,0 +1,13 @@
+package javax.swing;
+
+import java.awt.*;
+
+public interface Icon
+{
+ int getIconHeight();
+ int getIconWidth();
+ void paintIcon(Component c, Graphics g, int x, int y);
+
+ // not in suns's spec:
+ void setParent(Component p);
+}
diff --git a/javax/swing/ImageIcon.java b/javax/swing/ImageIcon.java
new file mode 100644
index 000000000..414f01480
--- /dev/null
+++ b/javax/swing/ImageIcon.java
@@ -0,0 +1,58 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.image.*;
+
+
+
+public class ImageIcon implements Icon
+{
+ Image image;
+ String file, descr;
+ Component observer;
+
+ ImageIcon(String s)
+ {
+ this(s, "");
+ }
+
+ ImageIcon(String file,
+ String descr)
+ {
+ this.file = file;
+ this.descr = descr;
+
+ image = Toolkit.getDefaultToolkit().getImage(file);
+ if (image == null) {
+ return;
+ }
+ //loadImage(image);
+ }
+
+ // not in SUN's spec !!!
+ public void setParent(Component p)
+ {
+ observer = p;
+ }
+
+ public Image getImage()
+ { return image; }
+
+ public String getDescription()
+ { return descr; }
+ public void setDescription(String description)
+ { this.descr = description; }
+
+ public int getIconHeight()
+ { return image.getHeight(observer); }
+ public int getIconWidth()
+ { return image.getWidth(observer); }
+
+ public void paintIcon(Component c,
+ Graphics g,
+ int x,
+ int y)
+ {
+ g.drawImage(image, x, y, observer);
+ }
+}
diff --git a/javax/swing/InputMap.java b/javax/swing/InputMap.java
new file mode 100644
index 000000000..70b14c145
--- /dev/null
+++ b/javax/swing/InputMap.java
@@ -0,0 +1,6 @@
+package javax.swing;
+
+
+public class InputMap
+{
+}
diff --git a/javax/swing/JApplet.java b/javax/swing/JApplet.java
new file mode 100644
index 000000000..b0a04d3d3
--- /dev/null
+++ b/javax/swing/JApplet.java
@@ -0,0 +1,170 @@
+package javax.swing;
+
+import java.applet.*;
+import java.awt.*;
+import java.awt.event.*;
+
+
+
+public class JApplet extends Applet
+{
+
+ public final static int HIDE_ON_CLOSE = 0;
+ public final static int EXIT_ON_CLOSE = 1;
+ public final static int DISPOSE_ON_CLOSE = 2;
+ public final static int DO_NOTHING_ON_CLOSE = 3;
+
+ private int close_action = EXIT_ON_CLOSE;
+ private boolean checking;
+ protected JRootPane rootPane;
+
+ public JApplet()
+ {
+ frameInit();
+ }
+
+ public JApplet(String title)
+ {
+ frameInit();
+ }
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ getRootPane(); // will do set/create
+ }
+
+ public Dimension getPreferredSize()
+ {
+ Dimension d = super.getPreferredSize();
+ System.out.println("JFrame.getPrefSize(): " + d + " , comp="+countComponents() + ", layout=" + layoutm);
+ return d;
+ }
+
+ public void setLayout(LayoutManager manager)
+ { super.setLayout(manager); }
+
+ void setLayeredPane(JLayeredPane layeredPane)
+ { getRootPane().setLayeredPane(layeredPane); }
+
+ JLayeredPane getLayeredPane()
+ { return getRootPane().getLayeredPane(); }
+
+ JRootPane getRootPane()
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
+
+ void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+
+ JRootPane createRootPane()
+ { return new JRootPane(); }
+
+ Container getContentPane()
+ { return getRootPane().getContentPane(); }
+
+ void setContentPane(Container contentPane)
+ { getRootPane().setContentPane(contentPane); }
+
+ Component getGlassPane()
+ { return getRootPane().getGlassPane(); }
+
+ void setGlassPane(Component glassPane)
+ { getRootPane().setGlassPane(glassPane); }
+
+
+ /////////////////////////////////////////////////////////////////////////////////
+ protected void addImpl(Component comp, Object constraints, int index)
+ { super.addImpl(comp, constraints, index); }
+
+ AccessibleContext getAccessibleContext()
+ { return null; }
+
+ int getDefaultCloseOperation()
+ { return close_action; }
+
+
+ JMenuBar getJMenuBar()
+ { return getRootPane().getJMenuBar(); }
+
+ void setJMenuBar(JMenuBar menubar)
+ { getRootPane().setJMenuBar(menubar); }
+
+
+ protected String paramString()
+ { return "JFrame"; }
+
+ protected void processKeyEvent(KeyEvent e)
+ { super.processKeyEvent(e); }
+
+ protected void processWindowEvent(WindowEvent e)
+
+ {
+ // System.out.println("PROCESS_WIN_EV-1: " + e);
+ super.processWindowEvent(e);
+ // System.out.println("PROCESS_WIN_EV-2: " + e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch(close_action)
+ {
+ case EXIT_ON_CLOSE:
+ {
+ System.out.println("user requested exit on close");
+ System.exit(1);
+ break;
+ }
+ case DISPOSE_ON_CLOSE:
+ {
+ System.out.println("user requested dispose on close");
+ //dispose();
+ break;
+ }
+ case HIDE_ON_CLOSE:
+
+ case DO_NOTHING_ON_CLOSE:
+ break;
+ }
+ break;
+ }
+
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_OPENED:
+ case WindowEvent.WINDOW_ICONIFIED:
+ case WindowEvent.WINDOW_DEICONIFIED:
+ case WindowEvent.WINDOW_ACTIVATED:
+ case WindowEvent.WINDOW_DEACTIVATED:
+ break;
+ }
+ }
+
+
+ public void remove(Component comp)
+ { getContentPane().remove(comp); }
+
+
+ void setDefaultCloseOperation(int operation)
+ { close_action = operation; }
+
+
+
+ protected boolean isRootPaneCheckingEnabled()
+ { return checking; }
+
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ { checking = enabled; }
+
+ public void update(Graphics g)
+ { paint(g); }
+}
diff --git a/javax/swing/JButton.java b/javax/swing/JButton.java
new file mode 100644
index 000000000..a5499f084
--- /dev/null
+++ b/javax/swing/JButton.java
@@ -0,0 +1,91 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.plaf.*;
+
+public class JButton extends AbstractButton implements Accessible
+{
+ boolean def, is_def;
+
+ JButton()
+ {
+ this(null, null);
+ }
+ JButton(Action a)
+ {
+ this();
+ setAction(a);
+ }
+
+ JButton(Icon icon)
+ {
+ this(null, icon);
+ }
+
+ JButton(String text)
+ {
+ this(text, null);
+ }
+
+ JButton(String text, Icon icon)
+ {
+ super(text, icon);
+ }
+
+ public Object[] getSelectedObjects()
+ {
+ return null;
+ }
+
+ protected void configurePropertiesFromAction(Action a)
+ {
+ //Factory method which sets the AbstractButton's properties according to values from the Action instance.
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ //Gets the AccessibleContext associated with this JButton.
+ return null;
+ }
+
+ String getUIClassID()
+ {
+ //Returns a string that specifies the name of the L&F class that renders this component.
+ return "JButton";
+ }
+
+ boolean isDefaultButton()
+ {
+ //Returns whether or not this button is the default button on the RootPane.
+ return is_def;
+ }
+
+ boolean isDefaultCapable()
+ {
+ //Returns whether or not this button is capable of being the default button on the RootPane.
+ return def;
+ }
+
+ protected String paramString()
+ {
+ return "JButton";
+ }
+
+ public void removeNotify()
+ {
+ //Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane, and if so, sets the RootPane's default button to null to ensure the RootPane doesn't hold onto an invalid button reference.
+ }
+
+ void setDefaultCapable(boolean defaultCapable)
+ { def = defaultCapable; }
+
+ void updateUI()
+ {
+ ButtonUI b = (ButtonUI)UIManager.getUI(this);
+ setUI(b);
+ }
+}
+
+
+
diff --git a/javax/swing/JCheckBox.java b/javax/swing/JCheckBox.java
new file mode 100644
index 000000000..cb826ab46
--- /dev/null
+++ b/javax/swing/JCheckBox.java
@@ -0,0 +1,56 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.plaf.*;
+
+
+
+public class JCheckBox extends JToggleButton
+{
+ JCheckBox()
+ {
+ this(null, null);
+ }
+ JCheckBox(Action a)
+ {
+ this();
+ setAction(a);
+ }
+
+ JCheckBox(Icon icon)
+ {
+ this(null, icon);
+ }
+
+ JCheckBox(String text)
+ {
+ this(text, null);
+ }
+
+ JCheckBox(String text, Icon icon)
+ {
+ super(text, icon);
+ }
+
+
+ AccessibleContext getAccessibleContext()
+ {
+ //Gets the AccessibleContext associated with this JCheckBox.
+ return null;
+ }
+
+ String getUIClassID()
+ {
+ //Returns a string that specifies the name of the L&F class that renders this component.
+ return "JCheckBox";
+ }
+
+ protected String paramString()
+ {
+ return "JCheckBox";
+ }
+}
+
+
+
diff --git a/javax/swing/JComponent.java b/javax/swing/JComponent.java
new file mode 100644
index 000000000..8d267c610
--- /dev/null
+++ b/javax/swing/JComponent.java
@@ -0,0 +1,818 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.event.*;
+import java.io.*;
+
+import javax.swing.event.*;
+import javax.swing.border.*;
+import javax.swing.plaf.*;
+
+import java.util.*;
+import java.beans.*;
+
+public abstract class JComponent extends Container implements Serializable
+{
+ Dimension pref,min,max;
+ Border border;
+ JToolTip tooltip;
+ String tool_tip_text;
+ boolean use_double_buffer, opaque;
+ protected ComponentUI ui;
+
+ Vector ancestor_list;
+ Vector veto_list;
+ Vector change_list;
+ Hashtable prop_hash;
+
+ JComponent()
+ {
+ super();
+ super.setLayout(new FlowLayout());
+
+ //eventMask |= AWTEvent.COMP_KEY_EVENT_MASK;
+ eventMask |= AWTEvent.KEY_EVENT_MASK;
+
+ //updateUI(); // get a proper ui
+ }
+
+
+ // protected EventListenerList listenerList
+ public boolean contains(int x, int y)
+ {
+ //return dims.contains(x,y);
+ return super.contains(x,y);
+ }
+
+
+ public void addNotify()
+ {
+ //Notification to this component that it now has a parent component.
+ super.addNotify();
+ }
+
+
+ Hashtable get_prop_hash()
+ {
+ if (prop_hash == null)
+ prop_hash = new Hashtable();
+ return prop_hash;
+ }
+ Vector get_veto_list()
+ {
+ if (veto_list == null)
+ veto_list = new Vector();
+ return veto_list;
+ }
+ Vector get_change_list()
+ {
+ if (change_list == null)
+ change_list = new Vector();
+ return change_list;
+ }
+ Vector get_ancestor_list()
+ {
+ if (ancestor_list == null)
+ ancestor_list = new Vector();
+ return ancestor_list;
+ }
+
+ Object getClientProperty(Object key)
+{ return get_prop_hash().get(key); }
+
+ void putClientProperty(Object key, Object value)
+ { get_prop_hash().put(key, value); }
+
+
+ void removeAncestorListener(AncestorListener listener)
+ { get_ancestor_list().removeElement(listener); }
+
+ void removePropertyChangeListener(PropertyChangeListener listener)
+ { get_change_list().removeElement(listener); }
+
+ void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
+ { /* FIXME */ get_change_list().removeElement(listener); }
+
+ void removeVetoableChangeListener(VetoableChangeListener listener)
+ { get_veto_list().removeElement(listener); }
+
+ void addAncestorListener(AncestorListener listener)
+ { get_ancestor_list().addElement(listener); }
+
+ void addPropertyChangeListener(PropertyChangeListener listener)
+ { get_change_list().addElement(listener); }
+
+ void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
+ { /* FIXME */ get_change_list().addElement(listener); }
+
+ void addVetoableChangeListener(VetoableChangeListener listener)
+ { get_veto_list().addElement(listener); }
+
+ void computeVisibleRect(Rectangle rect)
+ {
+ //Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors.
+ //super.computeVisibleRect(rect);
+ }
+
+
+ void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
+ {
+ //Reports a bound property change.
+ }
+ void firePropertyChange(String propertyName, byte oldValue, byte newValue)
+ {
+ // Reports a bound property change.
+ }
+ void firePropertyChange(String propertyName, char oldValue, char newValue)
+ {
+ //Reports a bound property change.
+ }
+
+ void firePropertyChange(String propertyName, double oldValue, double newValue)
+ {
+ //Reports a bound property change.
+ }
+
+ void firePropertyChange(String propertyName, float oldValue, float newValue)
+ {
+ // Reports a bound property change.
+ }
+ void firePropertyChange(String propertyName, int oldValue, int newValue)
+ {
+ // Reports a bound property change.
+ }
+ void firePropertyChange(String propertyName, long oldValue, long newValue)
+ {
+ //Reports a bound property change. protected
+ }
+
+ void firePropertyChange(String propertyName, Object oldValue, Object newValue)
+ {
+ // Support for reporting bound property changes.
+ }
+ void firePropertyChange(String propertyName, short oldValue, short newValue)
+ {
+ // Reports a bound property change.
+ }
+
+
+ protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
+ {
+ // Support for reporting constrained property changes.
+ }
+
+ AccessibleContext getAccessibleContext()
+ {
+ // Get the AccessibleContext associated with this JComponent
+ return null;
+ }
+ ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)
+ {
+ //Return the object that will perform the action registered for a given keystroke.
+ return null;
+ }
+ public float getAlignmentX()
+ {
+ // Overrides Container.getAlignmentX to return the vertical alignment.
+ return 0;
+ }
+
+ public float getAlignmentY()
+ {
+ // Overrides Container.getAlignmentY to return the horizontal alignment.
+ return 0;
+ }
+ boolean getAutoscrolls()
+ {
+ //Returns true if this component automatically scrolls its contents when dragged, (when contained in a component that supports scrolling, like JViewport
+ return false;
+ }
+
+ public void setBorder(Border border)
+ {
+ //System.out.println("set border called !, new border = " + border);
+ this.border = border;
+ revalidate();
+ repaint();
+ }
+
+ public Border getBorder()
+ { return border; }
+
+
+ Rectangle getBounds(Rectangle rv)
+ {
+ if (rv == null)
+ return new Rectangle(x,y,width,height);
+ else
+ {
+ rv.setBounds(x,y,width, height);
+ return rv;
+ }
+ }
+
+ protected Graphics getComponentGraphics(Graphics g)
+ { return g; }
+
+ int getConditionForKeyStroke(KeyStroke aKeyStroke)
+ {
+ //Return the condition that determines whether a registered action occurs in response to the specified keystroke.
+ return 0;
+ }
+ int getDebugGraphicsOptions()
+ {
+ return 0;
+ }
+
+ public Graphics getGraphics()
+ { return super.getGraphics(); }
+
+
+ // static MantaNative void DebugMe(Border b);
+
+ public Insets getInsets()
+ {
+ // System.out.println("watch this border");
+ // DebugMe(border);
+ // System.out.println("border = " + border);
+
+ if (border == null)
+ {
+ //System.out.println("compares to null !");
+ return super.getInsets();
+ }
+ // System.out.println("compare failed !");
+ return getBorder().getBorderInsets(this);
+ }
+
+ Insets getInsets(Insets insets)
+ {
+ if (insets == null)
+ return getInsets();
+ return new Insets(getInsets());
+ }
+ Point getLocation(Point rv)
+ {
+ //Store the x,y origin of this component into "return value" rv and return rv.
+
+ if (rv == null)
+ return new Point(x,y);
+
+ rv.setLocation(x,
+ y);
+ return rv;
+ }
+
+ public Dimension getMaximumSize()
+ {
+ if (max != null)
+ {
+ //System.out.println("HAVE_MAX_SIZE = " + max);
+ return max;
+ }
+ if (ui != null)
+ {
+ Dimension s = ui.getMaximumSize(this);
+ if (s != null)
+ {
+ //System.out.println(" UI-MAX = " + s + ", UI = " + ui + ", IM="+this);
+ return s;
+ }
+ }
+ Dimension p = super.getMaximumSize();
+ //System.out.println(" MAX = " + p + ", COMP="+this);
+ return p;
+ }
+
+ public Dimension getMinimumSize()
+ {
+ if (min != null)
+ {
+ //System.out.println("HAVE_MIN_SIZE = " + min);
+ return min;
+ }
+ if (ui != null)
+ {
+ Dimension s = ui.getMinimumSize(this);
+ if (s != null)
+ {
+ // System.out.println(" UI-MIN = " + s + ", UI = " + ui + ", IM="+this);
+ return s;
+ }
+ }
+ Dimension p = super.getMinimumSize();
+ // System.out.println(" MIN = " + p + ", COMP="+this);
+ return p;
+ }
+
+ public Dimension getPreferredSize()
+ {
+ if (pref != null)
+ {
+ //System.out.println("HAVE_PREF_SIZE = " + pref);
+ return pref;
+ }
+
+ if (ui != null)
+ {
+ Dimension s = ui.getPreferredSize(this);
+ if (s != null)
+ {
+ //System.out.println(" UI-PREF = " + s + ", UI = " + ui + ", IM="+this);
+ return s;
+ }
+ }
+ Dimension p = super.getPreferredSize();
+ // System.out.println(" PREF = " + p + ", COMP="+this);
+ return p;
+ }
+
+ Component getNextFocusableComponent()
+ {
+ // Return the next focusable component or null if the focus manager should choose the next focusable component automatically
+ return null;
+ }
+
+
+ KeyStroke[] getRegisteredKeyStrokes()
+ {
+ // Return the KeyStrokes that will initiate registered actions.
+ return null;
+ }
+
+ JRootPane getRootPane()
+ {
+ JRootPane p = SwingUtilities.getRootPane(this);
+ System.out.println("root = " + p);
+ return p;
+ }
+
+ Dimension getSize(Dimension rv)
+ {
+ // System.out.println("JComponent, getsize()");
+ if (rv == null)
+ return new Dimension(getWidth(),
+ getHeight());
+ else
+ {
+ rv.setSize(getWidth(),
+ getHeight());
+ return rv;
+ }
+ }
+
+
+
+ /*********************************************************************
+ *
+ *
+ * tooltips:
+ *
+ *
+ **************************************/
+
+ JToolTip createToolTip()
+ {
+ if (tooltip == null)
+ tooltip = new JToolTip(tool_tip_text);
+ return tooltip;
+ }
+
+ public Point getToolTipLocation(MouseEvent event)
+{ return null; }
+
+ void setToolTipText(String text)
+ { tool_tip_text = text; }
+
+ String getToolTipText()
+ { return tool_tip_text; }
+
+ public String getToolTipText(MouseEvent event)
+ { return tool_tip_text; }
+
+ /*********************************************************************
+ *
+ *
+ * things to do with visibility:
+ *
+ *
+ **************************************/
+
+
+ Container getTopLevelAncestor()
+ {
+ // Returns the top-level ancestor of this component (either the containing Window or Applet), or null if this component has not been added to any container.
+ System.out.println("JComponent, getTopLevelAncestor()");
+ return null;
+ }
+
+ Rectangle getVisibleRect()
+ {
+ /// Returns the Component's "visible rectangle" - the intersection of this components visible rectangle:
+ System.out.println("JComponent, getVisibleRect()");
+ return null;
+ }
+
+
+ int getHeight()
+ {
+ //System.out.println("JComponent, getHeight()");
+ return height;
+ }
+
+ int getWidth()
+ {
+ //System.out.println("JComponent, getWidth()");
+ return width;
+ }
+
+ int getX()
+ {
+ //System.out.println("JComponent, getX()");
+ return x;
+ }
+
+ int getY()
+ {
+ //System.out.println("JComponent, getY()");
+ return y;
+ }
+
+ void grabFocus()
+ {
+ // Set the focus on the receiving component.
+ }
+
+ boolean hasFocus()
+ {
+ // Returns true if this Component has the keyboard focus.
+ return false;
+ }
+
+ public boolean isDoubleBuffered()
+ { return use_double_buffer; }
+
+ boolean isFocusCycleRoot()
+ {
+ // Override this method and return true if your component is the root of of a component tree with its own focus cycle.
+ return false;
+ }
+
+ public boolean isFocusTraversable()
+ {
+ // Identifies whether or not this component can receive the focus.
+ return false;
+ }
+
+ static boolean isLightweightComponent(Component c)
+ {
+ return c.getPeer() instanceof LightweightPeer;
+ }
+
+ boolean isManagingFocus()
+ {
+ // Override this method and return true if your JComponent manages focus.
+ return false;
+ }
+
+ boolean isOpaque()
+ { return opaque; }
+
+ boolean isOptimizedDrawingEnabled()
+ {
+ // Returns true if this component tiles its children,
+ return true;
+ }
+
+ boolean isPaintingTile()
+ {
+ // Returns true if the receiving component is currently painting a tile.
+ return false;
+ }
+
+ boolean isRequestFocusEnabled()
+ {
+ // Return whether the receiving component can obtain the focus by calling requestFocus
+ return false;
+ }
+
+ boolean isValidateRoot()
+ {
+ // If this method returns true, revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated.
+ return false;
+ }
+
+ public void paint(Graphics g)
+ {
+ // System.out.println("SWING_PAINT:" + this);
+
+ paintBorder(g);
+ paintComponent(g);
+ paintChildren(g);
+ }
+
+ protected void paintBorder(Graphics g)
+ {
+ // System.out.println("PAINT_BORDER x XXXXXXX x x x x x x x x x x x x:" + getBorder() + ", THIS="+this);
+
+ // Paint the component's border.
+ if (getBorder() != null)
+ {
+ //System.out.println("PAINT_BORDER x XXXXXXX x x x x x x x x x x x x:" + getBorder() + ", THIS="+this);
+
+ getBorder().paintBorder(this,
+ g,
+ 0,
+ 0,
+ getWidth(),
+ getHeight());
+ }
+ }
+
+ protected void paintChildren(Graphics g)
+ {
+ // Paint this component's children.
+ super.paintChildren(g);
+ }
+
+ protected void paintComponent(Graphics g)
+ {
+ // If the UI delegate is non-null, call its paint method.
+ if (ui != null)
+ {
+ ui.paint(g, this);
+ }
+ }
+
+ void paintImmediately(int x, int y, int w, int h)
+ {
+ // Paint the specified region in this component and all of its descendants that overlap the region, immediately.
+ }
+
+ void paintImmediately(Rectangle r)
+ {
+ /// Paint the specified region now.
+ paintImmediately(r.x,
+ r.y,
+ r.width,
+ r.height);
+ }
+ protected String paramString()
+ {
+ // Returns a string representation of this JComponent.
+ return "JComponent";
+ }
+ protected void processComponentKeyEvent(KeyEvent e)
+ {
+ // Process any key events that the component itself recognizes.
+ //System.out.println("COMP_KEY-EVENT: " + e);
+ }
+ protected void processFocusEvent(FocusEvent e)
+ {
+ // Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.
+ //System.out.println("FOCUS_EVENT: " + e);
+ }
+
+ protected void processKeyEvent(KeyEvent e)
+ {
+ // Override processKeyEvent to process events protected
+ //System.out.println("KEY-EVENT: " + e);
+ }
+
+ public void processMouseMotionEvent(MouseEvent e)
+ {
+ // Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects.
+ //System.out.println("COMP_MOUSE-EVENT: " + e + ", MEMORY = " + Runtime.getRuntime().freeMemory());
+ }
+
+ void registerKeyboardAction(ActionListener anAction,
+ KeyStroke aKeyStroke,
+ int aCondition)
+ {
+ registerKeyboardAction(anAction,
+ null,
+ aKeyStroke,
+ aCondition);
+ }
+
+ void registerKeyboardAction(ActionListener anAction,
+ String aCommand,
+ KeyStroke aKeyStroke,
+ int aCondition)
+ {
+ // Register a new keyboard action.
+ }
+
+
+ public void removeNotify()
+ {
+ // Notification to this component that it no longer has a parent component.
+ }
+
+ public void repaint(long tm, int x, int y, int width, int height)
+ {
+ // Adds the specified region to the dirty region list if the component is showing.
+ //System.out.println("JC: repaint");
+ super.repaint(tm, x,y,width,height);
+ }
+
+ void repaint(Rectangle r)
+ {
+ // Adds the specified region to the dirty region list if the component is showing.
+ repaint(0,
+ r.x,
+ r.y,
+ r.width,
+ r.height);
+ }
+
+ boolean requestDefaultFocus()
+ {
+ // Request the focus for the component that should have the focus by default.
+ return false;
+ }
+
+ public void requestFocus()
+ {
+ // Set focus on the receiving component if isRequestFocusEnabled returns true
+ super.requestFocus();
+ }
+
+ void resetKeyboardActions()
+ {
+ // Unregister all keyboard actions
+ }
+
+ public void reshape(int x, int y, int w, int h)
+ {
+ /// Moves and resizes this component.
+ super.reshape(x,y,w,h);
+ }
+
+ void revalidate()
+ {
+ // Support for deferred automatic layout.
+ if (getParent() == null)
+ invalidate();
+ }
+
+ void scrollRectToVisible(Rectangle aRect)
+ {
+ // Forwards the scrollRectToVisible() message to the JComponent's parent.
+ }
+
+ void setAlignmentX(float alignmentX)
+ {
+ // Set the the vertical alignment.
+ }
+
+ void setAlignmentY(float alignmentY)
+ {
+ // Set the the horizontal alignment.
+ }
+
+ void setAutoscrolls(boolean autoscrolls)
+ {
+ // If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport
+ }
+
+
+ void setDebugGraphicsOptions(int debugOptions)
+ {
+ // Enables or disables diagnostic information about every graphics operation performed within the component or one of its children.
+ }
+
+ void setDoubleBuffered(boolean aFlag)
+ {
+ use_double_buffer = aFlag;
+ }
+
+ public void setEnabled(boolean enabled)
+ {
+ // Sets whether or not this component is enabled.
+ super.setEnabled(enabled);
+ repaint();
+ }
+
+ public void setFont(Font font)
+ {
+ super.setFont(font);
+ revalidate();
+ repaint();
+ }
+ public void setBackground(Color bg)
+ {
+ super.setBackground(bg);
+ revalidate();
+ repaint();
+ }
+ public void setForeground(Color fg)
+ {
+ super.setForeground(fg);
+ revalidate();
+ repaint();
+ }
+
+ void setMaximumSize(Dimension maximumSize)
+ { max = maximumSize; }
+
+ void setMinimumSize(Dimension minimumSize)
+ { min = minimumSize; }
+
+ void setPreferredSize(Dimension preferredSize)
+ { pref = preferredSize; }
+
+ void setNextFocusableComponent(Component aComponent)
+ {
+ // Specifies the next component to get the focus after this one, for example, when the tab key is pressed.
+ }
+
+ void setOpaque(boolean isOpaque)
+ {
+ opaque = isOpaque;
+ revalidate();
+ repaint();
+ }
+
+
+ void setRequestFocusEnabled(boolean aFlag)
+ {
+ }
+
+
+ public void setVisible(boolean aFlag)
+ {
+ // Makes the component visible or invisible.
+
+ super.setVisible(aFlag);
+ if (getParent() != null)
+ {
+ Rectangle dims = getBounds();
+ getParent().repaint(dims.x,
+ dims.y,
+ dims.width,
+ dims.height);
+ }
+ }
+
+ void unregisterKeyboardAction(KeyStroke aKeyStroke)
+ {
+ // Unregister a keyboard action.
+ }
+
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+
+
+
+ /******************************************
+ *
+ *
+ * UI management
+ *
+ *
+ *********/
+
+ String getUIClassID()
+ {
+ /// Return the UIDefaults key used to look up the name of the swing.
+ return "JComponent";
+ }
+
+ protected void setUI(ComponentUI newUI)
+ {
+ if (ui != null)
+ {
+ ui.uninstallUI(this);
+ }
+
+ // Set the look and feel delegate for this component.
+ ui = newUI;
+
+ if (ui != null)
+ {
+ ui.installUI(this);
+ }
+
+ revalidate();
+ repaint();
+ }
+
+ void updateUI()
+ {
+ // Resets the UI property to a value from the current look and feel.
+ System.out.println("update UI not overwritten in class: " + this);
+ }
+
+}
+
+
+
+
+
+
+
diff --git a/javax/swing/JDialog.java b/javax/swing/JDialog.java
new file mode 100644
index 000000000..e2e6b171e
--- /dev/null
+++ b/javax/swing/JDialog.java
@@ -0,0 +1,219 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+
+public class JDialog extends Dialog implements Accessible
+{
+ public final static int HIDE_ON_CLOSE = 0;
+ public final static int DISPOSE_ON_CLOSE = 1;
+ public final static int DO_NOTHING_ON_CLOSE = 2;
+
+ protected AccessibleContext accessibleContext;
+
+ private int close_action = HIDE_ON_CLOSE;
+
+ /***************************************************
+ *
+ *
+ * constructors
+ *
+ *
+ *************/
+
+ JDialog(Frame owner)
+ {
+ this(owner, "dialog");
+ }
+
+ JDialog(Frame owner,
+ String s)
+ {
+ this(owner, s, true);
+ }
+
+ JDialog(Frame owner,
+ String s,
+ boolean modeld)
+ {
+ super(owner, s, modeld);
+ }
+
+ JDialog(Frame owner,
+ // String s,
+ boolean modeld)
+ {
+ super(owner, "JDialog", modeld);
+ }
+ JDialog(Dialog owner)
+ {
+ this(owner, "dialog");
+ }
+
+ JDialog(Dialog owner,
+ String s)
+ {
+ this(owner, s, true);
+ }
+
+ JDialog(Dialog owner,
+ String s,
+ boolean modeld)
+ {
+ super(owner, s, modeld);
+ }
+
+
+ /***************************************************
+ *
+ *
+ * methods, this part is shared with JDialog, JFrame
+ *
+ *
+ *************/
+
+
+ private boolean checking;
+ protected JRootPane rootPane;
+
+ void setLocationRelativeTo(Component c)
+ {
+ }
+
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ getRootPane(); // will do set/create
+ }
+
+ public Dimension getPreferredSize()
+ {
+ Dimension d = super.getPreferredSize();
+ return d;
+ }
+
+ JMenuBar getJMenuBar()
+ { return getRootPane().getJMenuBar(); }
+
+ void setJMenuBar(JMenuBar menubar)
+ { getRootPane().setJMenuBar(menubar); }
+
+
+ public void setLayout(LayoutManager manager)
+ { super.setLayout(manager); }
+
+ void setLayeredPane(JLayeredPane layeredPane)
+ { getRootPane().setLayeredPane(layeredPane); }
+
+ JLayeredPane getLayeredPane()
+ { return getRootPane().getLayeredPane(); }
+
+ JRootPane getRootPane()
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
+
+ void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+
+ JRootPane createRootPane()
+ { return new JRootPane(); }
+
+ Container getContentPane()
+ { return getRootPane().getContentPane(); }
+
+ void setContentPane(Container contentPane)
+ { getRootPane().setContentPane(contentPane); }
+
+ Component getGlassPane()
+ { return getRootPane().getGlassPane(); }
+
+ void setGlassPane(Component glassPane)
+ { getRootPane().setGlassPane(glassPane); }
+
+
+ protected void addImpl(Component comp, Object constraints, int index)
+ { super.addImpl(comp, constraints, index); }
+
+
+ public void remove(Component comp)
+ { getContentPane().remove(comp); }
+
+ protected boolean isRootPaneCheckingEnabled()
+ { return checking; }
+
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ { checking = enabled; }
+
+
+ public void update(Graphics g)
+ { paint(g); }
+
+ protected void processKeyEvent(KeyEvent e)
+ { super.processKeyEvent(e); }
+
+ /////////////////////////////////////////////////////////////////////////////////
+
+
+ protected void processWindowEvent(WindowEvent e)
+ {
+ // System.out.println("PROCESS_WIN_EV-1: " + e);
+ super.processWindowEvent(e);
+ // System.out.println("PROCESS_WIN_EV-2: " + e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch(close_action)
+ {
+ case DISPOSE_ON_CLOSE:
+ {
+ System.out.println("user requested dispose on close");
+ dispose();
+ break;
+ }
+ case HIDE_ON_CLOSE:
+ {
+ setVisible(false);
+ break;
+ }
+ case DO_NOTHING_ON_CLOSE:
+ break;
+ }
+ break;
+ }
+
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_OPENED:
+ case WindowEvent.WINDOW_ICONIFIED:
+ case WindowEvent.WINDOW_DEICONIFIED:
+ case WindowEvent.WINDOW_ACTIVATED:
+ case WindowEvent.WINDOW_DEACTIVATED:
+ break;
+ }
+ }
+
+
+ void setDefaultCloseOperation(int operation)
+ { close_action = operation; }
+
+ protected String paramString()
+ { return "JDialog"; }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+}
diff --git a/javax/swing/JEditorPane.java b/javax/swing/JEditorPane.java
new file mode 100644
index 000000000..3ed9a0c6a
--- /dev/null
+++ b/javax/swing/JEditorPane.java
@@ -0,0 +1,187 @@
+package javax.swing;
+
+import java.io.*;
+import java.net.*;
+import javax.swing.text.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class JEditorPane extends JTextComponent
+{
+ URL page_url;
+ EditorKit kit;
+ String ctype = "text/plain";
+ boolean focus_root;
+ boolean manages_focus;
+
+
+ JEditorPane()
+ {
+ }
+
+ JEditorPane(String url)
+ {
+ this();
+ setPage(url);
+ }
+
+ JEditorPane(String type, String text)
+ {
+ ctype = text;
+ setText(text);
+ }
+
+ JEditorPane(URL url)
+ {
+ setPage(url);
+ }
+
+ void addHyperlinkListener(HyperlinkListener listener)
+ { }
+
+ protected EditorKit createDefaultEditorKit()
+ { return new PlainEditorKit(); }
+
+ static EditorKit createEditorKitForContentType(String type)
+ { return new PlainEditorKit(); }
+
+ void fireHyperlinkUpdate(HyperlinkEvent e)
+ {
+ }
+
+ AccessibleContext getAccessibleContext()
+ { return null; }
+
+ String getContentType()
+ { return ctype; }
+
+ EditorKit getEditorKit()
+ { return kit; }
+
+ static String getEditorKitClassNameForContentType(String type)
+ { return "text/plain"; }
+
+ EditorKit getEditorKitForContentType(String type)
+ { return kit; }
+
+ public Dimension getPreferredSize()
+ {
+ //Returns the preferred size for the JEditorPane.
+ return super.getPreferredSize();
+ }
+
+ boolean getScrollableTracksViewportHeight()
+ { return false; }
+ boolean getScrollableTracksViewportWidth()
+ { return false; }
+
+ URL getPage()
+ { return page_url; }
+
+ protected InputStream getStream(URL page)
+ {
+ try {
+ return page.openStream();
+ } catch (Exception e) {
+ System.out.println("Hhmmm, failed to open stream: " + e);
+ }
+ return null;
+ }
+
+ public String getText()
+ { return super.getText(); }
+
+ String getUIClassID()
+ { return "JEditorPane"; }
+
+ boolean isFocusCycleRoot()
+ { return focus_root;
+ }
+ boolean isManagingFocus()
+ { return manages_focus; }
+
+ protected String paramString()
+ { return "JEditorPane"; }
+
+ protected void processComponentKeyEvent(KeyEvent e)
+ {
+ //Overridden to handle processing of tab/shift tab.
+ }
+
+ protected void processKeyEvent(KeyEvent e)
+ {
+ //Make sure that TAB and Shift-TAB events get consumed, so that awt doesn't attempt focus traversal.
+ }
+
+ void read(InputStream in, Object desc)
+ {
+ //This method initializes from a stream.
+ }
+
+ static void registerEditorKitForContentType(String type, String classname)
+ {
+ //Establishes the default bindings of type to classname.
+ }
+
+ static void registerEditorKitForContentType(String type, String classname, ClassLoader loader)
+ {
+ //Establishes the default bindings of type to classname.
+ }
+
+ void removeHyperlinkListener(HyperlinkListener listener)
+ {
+ //Removes a hyperlink listener.
+ }
+
+ void replaceSelection(String content)
+ {
+ //Replaces the currently selected content with new content represented by the given string.
+ }
+
+ protected void scrollToReference(String reference)
+ {
+ //Scrolls the view to the given reference location (that is, the value returned by the UL.getRef method for the URL being displayed).
+ }
+
+ void setContentType(String type)
+ {
+ ctype = type;
+ invalidate();
+ repaint();
+ }
+
+ void setEditorKit(EditorKit kit)
+ {
+ this.kit = kit;
+ invalidate();
+ repaint();
+ }
+
+ void setEditorKitForContentType(String type, EditorKit k)
+ {
+ ctype = type;
+ setEditorKit(k);
+ }
+
+ void setPage(String url)
+ {
+ // Sets the current URL being displayed.
+ }
+
+ void setPage(URL page)
+ {
+ // Sets the current URL being displayed.
+ }
+
+ void setText(String t)
+ {
+ super.setText(t);
+ }
+}
+
+
+
+
+
+
diff --git a/javax/swing/JFrame.java b/javax/swing/JFrame.java
new file mode 100644
index 000000000..ea011ecaa
--- /dev/null
+++ b/javax/swing/JFrame.java
@@ -0,0 +1,206 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class JFrame extends Frame
+{
+ public final static int HIDE_ON_CLOSE = 0;
+ public final static int EXIT_ON_CLOSE = 1;
+ public final static int DISPOSE_ON_CLOSE = 2;
+ public final static int DO_NOTHING_ON_CLOSE = 3;
+
+ protected AccessibleContext accessibleContext;
+
+ private int close_action = EXIT_ON_CLOSE;
+
+
+ /***************************************************
+ *
+ * initia
+ *
+ *
+ *************/
+
+
+ public JFrame()
+ {
+ super("JFrame");
+ frameInit();
+ }
+
+ public JFrame(String title)
+ {
+ super(title);
+ frameInit();
+ }
+
+
+ /***************************************************
+ *
+ *
+ * methods, this part is shared with JDialog, JFrame
+ *
+ *
+ *************/
+
+
+ private boolean checking;
+ protected JRootPane rootPane;
+
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ getRootPane(); // will do set/create
+ }
+
+ public Dimension getPreferredSize()
+ {
+ Dimension d = super.getPreferredSize();
+ return d;
+ }
+
+ JMenuBar getJMenuBar()
+ { return getRootPane().getJMenuBar(); }
+
+ void setJMenuBar(JMenuBar menubar)
+ { getRootPane().setJMenuBar(menubar); }
+
+
+ public void setLayout(LayoutManager manager)
+ { super.setLayout(manager); }
+
+ void setLayeredPane(JLayeredPane layeredPane)
+ { getRootPane().setLayeredPane(layeredPane); }
+
+ JLayeredPane getLayeredPane()
+ { return getRootPane().getLayeredPane(); }
+
+ JRootPane getRootPane()
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
+
+ void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+
+ JRootPane createRootPane()
+ { return new JRootPane(); }
+
+ Container getContentPane()
+ { return getRootPane().getContentPane(); }
+
+ void setContentPane(Container contentPane)
+ { getRootPane().setContentPane(contentPane); }
+
+ Component getGlassPane()
+ { return getRootPane().getGlassPane(); }
+
+ void setGlassPane(Component glassPane)
+ { getRootPane().setGlassPane(glassPane); }
+
+
+ protected void addImpl(Component comp, Object constraints, int index)
+ { super.addImpl(comp, constraints, index); }
+
+
+ public void remove(Component comp)
+ { getContentPane().remove(comp); }
+
+ protected boolean isRootPaneCheckingEnabled()
+ { return checking; }
+
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ { checking = enabled; }
+
+
+ public void update(Graphics g)
+ { paint(g); }
+
+ protected void processKeyEvent(KeyEvent e)
+ { super.processKeyEvent(e); }
+
+ /////////////////////////////////////////////////////////////////////////////////
+
+ AccessibleContext getAccessibleContext()
+ { return null; }
+
+ int getDefaultCloseOperation()
+ { return close_action; }
+
+
+
+ protected String paramString()
+ { return "JFrame"; }
+
+
+ protected void processWindowEvent(WindowEvent e)
+ {
+ // System.out.println("PROCESS_WIN_EV-1: " + e);
+ super.processWindowEvent(e);
+ // System.out.println("PROCESS_WIN_EV-2: " + e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch(close_action)
+ {
+ case EXIT_ON_CLOSE:
+ {
+ System.out.println("user requested exit on close");
+ System.exit(1);
+ break;
+ }
+ case DISPOSE_ON_CLOSE:
+ {
+ System.out.println("user requested dispose on close");
+ dispose();
+ break;
+ }
+ case HIDE_ON_CLOSE:
+ {
+ setVisible(false);
+ break;
+ }
+ case DO_NOTHING_ON_CLOSE:
+ break;
+ }
+ break;
+ }
+
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_OPENED:
+ case WindowEvent.WINDOW_ICONIFIED:
+ case WindowEvent.WINDOW_DEICONIFIED:
+ case WindowEvent.WINDOW_ACTIVATED:
+ case WindowEvent.WINDOW_DEACTIVATED:
+ break;
+ }
+ }
+
+
+ void setDefaultCloseOperation(int operation)
+ { close_action = operation; }
+
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/JLabel.java b/javax/swing/JLabel.java
new file mode 100644
index 000000000..e4d9f8480
--- /dev/null
+++ b/javax/swing/JLabel.java
@@ -0,0 +1,201 @@
+package javax.swing;
+
+import java.awt.*;
+import javax.swing.plaf.*;
+
+
+public class JLabel extends JComponent implements SwingConstants
+{
+ String text;
+ Icon icon;
+ int gap;
+ int align;
+
+ int hor_align;
+ int hor_text_pos;
+
+ int vert_align;
+ int vert_text_pos;
+
+ JLabel()
+ {
+ this("", null, 0);
+ }
+
+ JLabel(Icon image)
+ {
+ this("", image, 0);
+ }
+
+ JLabel(Icon image, int horizontalAlignment)
+ {
+ this("", image, horizontalAlignment);
+ }
+
+ JLabel(String text)
+ {
+ this(text, null, 0);
+ }
+
+ JLabel(String text, int horizontalAlignment)
+ {
+ this(text, null, horizontalAlignment);
+ }
+
+ JLabel(String text, Icon icon, int horizontalAlignment)
+ {
+ // do the work.....
+ this.text = text;
+ setIcon(icon);
+ this.align = horizontalAlignment;
+
+ updateUI(); // get a proper ui
+ }
+
+
+ protected int checkHorizontalKey(int key, String message)
+ {
+ // Verify that key is a legal value for the horizontalAlignment properties.
+ return 0;
+ }
+ protected int checkVerticalKey(int key, String message)
+ {
+ // Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties.
+ return 0;
+ }
+ AccessibleContext getAccessibleContext()
+ {
+ // Get the AccessibleContext of this object
+ return null;
+ }
+ Icon getDisabledIcon()
+ {
+ // Returns the value of the disabledIcon property if it's been set, If it hasn't been set and the value of the icon property is an ImageIcon, we compute a "grayed out" version of the icon and update the disabledIcon property with that.
+ return null;
+ }
+ int getDisplayedMnemonic()
+ {
+ // Return the keycode that indicates a mnemonic key.
+ return 0;
+ }
+ int getHorizontalAlignment()
+ {
+ // Returns the alignment of the label's contents along the X axis.
+ return hor_align;
+ }
+ int getHorizontalTextPosition()
+ {
+ // Returns the horizontal position of the label's text, relative to its image.
+ return hor_text_pos;
+ }
+
+ Icon getIcon()
+ { return icon; }
+
+ int getIconTextGap()
+ {
+ // Returns the amount of space between the text and the icon displayed in this label.
+ return 0;
+ }
+ Component getLabelFor()
+ {
+ // Get the component this is labelling.
+ return null;
+ }
+ String getText()
+ { return text; }
+
+ String getUIClassID()
+ { return "JLabel"; }
+
+ int getVerticalAlignment()
+ {
+ // Returns the alignment of the label's contents along the Y axis.
+ return vert_align;
+ }
+ int getVerticalTextPosition()
+ {
+ // Returns the vertical position of the label's text, relative to its image.
+ return vert_text_pos;
+ }
+
+ public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
+ {
+ // This is overriden to return false if the current Icon's Image is not equal to the passed in Image img.
+ return (img == icon);
+ }
+ protected String paramString()
+ {
+ // Returns a string representation of this JLabel.
+ return "JLabel";
+ }
+ void setDisabledIcon(Icon disabledIcon)
+ {
+ // Set the icon to be displayed if this JLabel is "disabled" (JLabel.setEnabled(false)).
+ }
+ void setDisplayedMnemonic(char aChar)
+ {
+ // Specifies the displayedMnemonic as a char value.
+ }
+ void setDisplayedMnemonic(int key)
+ {
+ // Specify a keycode that indicates a mnemonic key.
+ }
+ void setHorizontalAlignment(int alignment)
+ {
+ // Sets the alignment of the label's contents along the X axis.
+ hor_align = alignment;
+ }
+ void setHorizontalTextPosition(int textPosition)
+ {
+ // Sets the horizontal position of the label's text, relative to its image.
+ hor_text_pos = textPosition;
+ }
+ void setIcon(Icon icon)
+ {
+ this.icon = icon;
+ if (icon != null)
+ {
+ icon.setParent(this);
+ }
+ revalidate();
+ repaint();
+ }
+
+ void setIconTextGap(int iconTextGap)
+ {
+ gap = iconTextGap;
+ }
+
+ void setLabelFor(Component c)
+ {
+ // Set the component this is labelling.
+ }
+ void setText(String text)
+ {
+ this.text = text;
+ revalidate();
+ repaint();
+ }
+
+ void setVerticalAlignment(int alignment)
+ {
+ // Sets the alignment of the label's contents along the Y axis.
+ vert_align = alignment;
+ }
+ void setVerticalTextPosition(int textPosition)
+ {
+ // Sets the vertical position of the label's text, relative to its image.
+ vert_text_pos = textPosition;
+ }
+ void updateUI()
+ {
+ LabelUI b = (LabelUI)UIManager.getUI(this);
+ setUI(b);
+ }
+}
+
+
+
+
+
diff --git a/javax/swing/JLayeredPane.java b/javax/swing/JLayeredPane.java
new file mode 100644
index 000000000..444335012
--- /dev/null
+++ b/javax/swing/JLayeredPane.java
@@ -0,0 +1,21 @@
+package javax.swing;
+
+import java.awt.*;
+
+public class JLayeredPane extends JComponent
+{
+ JLayeredPane()
+ {
+ }
+
+
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+
+ comp.validate();
+ comp.repaint();
+ }
+
+
+}
diff --git a/javax/swing/JList.java b/javax/swing/JList.java
new file mode 100644
index 000000000..9131b01a5
--- /dev/null
+++ b/javax/swing/JList.java
@@ -0,0 +1,196 @@
+package javax.swing;
+
+import javax.swing.event.*;
+
+import java.awt.*;
+import javax.swing.plaf.*;
+import java.util.*;
+
+
+public class JList extends JComponent implements Scrollable
+{
+ Color select_back, select_fore;
+ ListCellRenderer render;
+ int visibles = 8;
+
+ ListModel model;
+ ListSelectionModel sel_model;
+
+ JList()
+ {
+ init();
+ }
+
+ JList(Object[] listData)
+ {
+ init();
+ setListData(listData);
+ }
+
+
+ JList(Vector listData)
+ {
+ init();
+ setListData(listData);
+ }
+
+
+ JList(ListModel listData)
+ {
+ init();
+ setModel(listData);
+ }
+ void init()
+ {
+ render = new DefaultCellRenderer();
+
+ sel_model = new DefaultListSelectionModel();
+ setModel(new DefaultListModel());
+
+ select_back = new Color(0,0,255);
+ select_fore = new Color(255,255,255);
+
+ updateUI();
+ }
+
+
+ public int getVisibleRowCount()
+ { return visibles; }
+ public void setVisibleRowCount(int visibleRowCount)
+ {
+ visibles = visibleRowCount;
+ invalidate();
+ repaint();
+ }
+
+ void addListSelectionListener(ListSelectionListener listener)
+ { sel_model.addListSelectionListener(listener); }
+ void removeListSelectionListener(ListSelectionListener listener)
+ { sel_model.removeListSelectionListener(listener); }
+
+ void setSelectionMode(int a)
+ { sel_model.setSelectionMode(a); }
+ void setSelectedIndex(int a)
+ { sel_model.setSelectionInterval(a,a); }
+ int getSelectedIndex()
+ { return sel_model.getMinSelectionIndex(); }
+ Object getSelectedValue()
+ {
+ int index = getSelectedIndex();
+ if (index == -1)
+ return null;
+ return getModel().getElementAt(index);
+ }
+
+ Color getSelectionBackground()
+ { return select_back; }
+ Color getSelectionForeground()
+ { return select_fore; }
+
+
+ public void setListData(final Object[] listData)
+ {
+ class AL extends AbstractListModel
+ {
+ public int getSize() { return listData.length; }
+ public Object getElementAt(int i) { return listData[i]; }
+ };
+
+ setModel (new AL());
+ }
+
+ public void setListData(final Vector listData)
+ {
+ class AL extends AbstractListModel
+ {
+ public int getSize() { return listData.size(); }
+ public Object getElementAt(int i) { return listData.elementAt(i); }
+ };
+
+ setModel (new AL());
+ }
+
+
+ public ListCellRenderer getCellRenderer()
+ { return render; }
+ public void setCellRenderer(ListCellRenderer cellRenderer)
+ {
+ render = cellRenderer;
+ invalidate();
+ repaint();
+ }
+
+ public void setModel(ListModel model)
+ {
+ ListDataListener l = new ListDataListener()
+ {
+ public void intervalAdded(ListDataEvent e) {
+ repaint();
+ }
+ public void intervalRemoved(ListDataEvent e) {
+ repaint();
+ }
+ public void contentsChanged(ListDataEvent e) {
+ repaint();
+ }
+ };
+
+ this.model = model;
+ model.addListDataListener(l);
+ }
+
+ public ListModel getModel()
+ { return model; }
+
+
+ public ListUI getUI()
+ { return (ListUI) ui; }
+ public void setUI(ListUI ui)
+ { super.setUI(ui); }
+
+ public void updateUI()
+ {
+ setUI((ListUI)UIManager.getUI(this));
+ }
+
+ public String getUIClassID()
+ {
+ return "JList";
+ }
+
+
+ AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ public Dimension getPreferredScrollableViewportSize()
+ {
+ return null;
+ }
+
+ public int getScrollableUnitIncrement(Rectangle visibleRect,
+ int orientation,
+ int direction)
+ {
+ return 1;
+ }
+
+ public int getScrollableBlockIncrement(Rectangle visibleRect,
+ int orientation,
+ int direction)
+ {
+ return 1;
+ }
+
+ public boolean getScrollableTracksViewportWidth()
+ {
+ return false;
+ }
+
+ public boolean getScrollableTracksViewportHeight()
+ {
+ return false;
+ }
+
+}
diff --git a/javax/swing/JMenuBar.java b/javax/swing/JMenuBar.java
new file mode 100644
index 000000000..d3ccf0f4d
--- /dev/null
+++ b/javax/swing/JMenuBar.java
@@ -0,0 +1,8 @@
+package javax.swing;
+
+public class JMenuBar extends JComponent
+{
+ JMenuBar()
+ {
+ }
+}
diff --git a/javax/swing/JOptionPane.java b/javax/swing/JOptionPane.java
new file mode 100644
index 000000000..341beb46f
--- /dev/null
+++ b/javax/swing/JOptionPane.java
@@ -0,0 +1,353 @@
+package javax.swing;
+
+import java.awt.*;
+import javax.swing.plaf.*;
+
+public class JOptionPane extends JComponent
+{
+ public static final int DEFAULT_OPTION = 0;
+ public static final int YES_NO_OPTION = 1;
+ public static final int YES_NO_CANCEL_OPTION = 2;
+ public static final int OK_CANCEL_OPTION = 3;
+ public static final int YES_OPTION = 4;
+ public static final int NO_OPTION = 5;
+ public static final int CANCEL_OPTION = 6;
+ public static final int OK_OPTION = 7;
+ public static final int CLOSED_OPTION = 8;
+
+ public static final int ERROR_MESSAGE = 0;
+ public static final int INFORMATION_MESSAGE = 1;
+ public static final int WARNING_MESSAGE = 2;
+ public static final int QUESTION_MESSAGE = 3;
+ public static final int PLAIN_MESSAGE = 4;
+
+ final static String VALUE_PROPERTY = "value_prop";
+ final static String INPUT_VALUE_PROPERTY = "input_value_prop";
+
+ final static String UNINITIALIZED_VALUE = "uninit";
+
+ Object msg;
+ int mtype;
+ int otype;
+ Icon icon;
+ Object []args;
+ Object init;
+
+ JDialog dialog;
+
+ /*****************************************************************************
+ *
+ *
+ * joptionpanels
+ *
+ *
+ ***********************************/
+
+ JOptionPane()
+ {
+ this("mess");
+ }
+
+ JOptionPane(Object m)
+ {
+ this(m, PLAIN_MESSAGE);
+ }
+
+ JOptionPane(Object m,
+ int mtype)
+ {
+ this(m, mtype, DEFAULT_OPTION);
+ }
+
+ JOptionPane(Object m,
+ int mtype,
+ int otype)
+ {
+ this(m, mtype, otype, null);
+ }
+
+ JOptionPane(Object m,
+ int mtype,
+ int otype,
+ Icon icon)
+ {
+ this(m, mtype, otype, icon, null);
+ }
+
+ JOptionPane(Object m,
+ int mtype,
+ int otype,
+ Icon icon,
+ Object []args)
+ {
+ this(m, mtype, otype, icon, args, null);
+ }
+
+ JOptionPane(Object msg,
+ int mtype,
+ int otype,
+ Icon icon,
+ Object []args,
+ Object init)
+ {
+ // this(m, mtype, otype, icon, args, init);
+ this.msg = msg;
+ this.mtype = mtype;
+ this.otype = otype;
+ this.icon = icon;
+ this.args = args;
+ this.init = init;
+
+ updateUI();
+ }
+
+
+ /*****************************************************************************
+ *
+ *
+ *
+ *
+ *
+ ***********************************/
+
+ Object val;
+ void setValue(Object v)
+ { val = v; }
+ Object getValue()
+ { return val; }
+
+ String getUIClassID()
+ { return "JOptionPane"; }
+
+
+ public void setUI(OptionPaneUI ui) {
+ super.setUI(ui);
+ }
+
+ public OptionPaneUI getUI() {
+ return (OptionPaneUI)ui;
+ }
+
+ public void updateUI() {
+ setUI((OptionPaneUI)UIManager.getUI(this));
+ }
+
+
+ AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ protected String paramString()
+ {
+ return "JOptionPane";
+ }
+
+ static void showMessageDialog(Component frame,
+ String msg,
+ String title,
+ int bla)
+ {
+ DoShowOptionDialog(frame,
+ msg,
+ title,
+ bla,
+ 0,
+ null,
+ null,
+ null);
+ }
+ static void showMessageDialog(Component frame,
+ String msg,
+ String title,
+ int bla,
+ Icon icon)
+ {
+ DoShowOptionDialog(frame,
+ msg,
+ title,
+ bla,
+ 0,
+ icon,
+ null,
+ null);
+ }
+ static void showMessageDialog(Component frame,
+ String msg)
+ {
+ showMessageDialog(frame,
+ msg,
+ null);
+ }
+
+
+ static void showMessageDialog(Component frame,
+ String msg,
+ Icon icon)
+ {
+ //System.out.println("++++++++++++++++++creating message dialog:"+msg + ", frame="+frame);
+ DoShowOptionDialog(frame,
+ msg,
+ "Message",
+ DEFAULT_OPTION,
+ PLAIN_MESSAGE,
+ icon,
+ null,
+ null);
+ }
+
+ static int showConfirmDialog(JFrame frame,
+ String yes,
+ String no,
+ int bla)
+ {
+ return 0;
+ }
+
+ static String showInputDialog(JFrame frame,
+ String msg,
+ String title,
+ int opt_type,
+ int msg_type,
+ Icon icon,
+ Object[] opts,
+ Object init)
+ {
+ return (String) DoShowOptionDialog(frame,
+ msg,
+ title,
+ opt_type,
+ msg_type,
+ icon,
+ opts,
+ init);
+ }
+
+ static Object showInputDialog(JFrame frame,
+ String msg,
+ String title,
+ int opt_type,
+ Icon icon,
+ Object[] opts,
+ Object init)
+ {
+ return DoShowOptionDialog(frame,
+ msg,
+ title,
+ opt_type,
+ 0, //msg_type,
+ icon,
+ opts,
+ init);
+ }
+
+
+ // everybody comes here eventually
+ static int showOptionDialog(Component frame,
+ String msg,
+ String title,
+ int opt_type,
+ int msg_type,
+ Icon icon,
+ Object[] opts,
+ Object init)
+ {
+ Integer a = (Integer) DoShowOptionDialog(frame,
+ msg,
+ title,
+ opt_type,
+ msg_type,
+ icon,
+ opts,
+ init);
+ if (a == null)
+ return -1;
+ return a.intValue();
+ }
+
+ static Object DoShowOptionDialog(Component frame,
+ String msg,
+ String title,
+ int opt_type,
+ int msg_type,
+ Icon icon,
+ Object[] opts,
+ Object init)
+ {
+
+ JOptionPane p = new JOptionPane(msg,
+ msg_type,
+ opt_type,
+ icon,
+ opts,
+ init);
+ System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg);
+
+
+ JDialog a;
+
+ if (frame == null)
+ {
+ a = new JDialog((Frame)frame,
+ title,
+ true);
+ }
+ else if (frame instanceof Dialog)
+ {
+ a = new JDialog((Dialog) frame,
+ title,
+ true);
+ }
+ else if (frame instanceof Frame)
+ {
+ a = new JDialog((Frame) frame,
+ title,
+ true);
+ }
+ else
+ {
+ System.out.println("HUUUUHHH, not a frame or dialog !");
+
+ a = new JDialog((Frame)null,
+ title,
+ true);
+ }
+
+ p.dialog = a;
+
+ a.getContentPane().setLayout(new BorderLayout());
+ a.getContentPane().add(p,
+ BorderLayout.CENTER);
+ // package the deal
+ a.pack();
+
+ a.setVisible(true);
+
+ Object s = p.getValue();
+
+ System.out.println("RESULT FROM DIALOG = " + s);
+
+ if (s == null)
+ return null;
+
+ return s;
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/JPanel.java b/javax/swing/JPanel.java
new file mode 100644
index 000000000..e4fa8fc65
--- /dev/null
+++ b/javax/swing/JPanel.java
@@ -0,0 +1,73 @@
+package javax.swing;
+
+import java.awt.*;
+import javax.swing.plaf.*;
+
+public class JPanel extends JComponent
+{
+ JPanel()
+ {
+ this(new FlowLayout(),
+ true);
+ }
+
+ JPanel(boolean double_buffered)
+ {
+ this(new FlowLayout(),
+ double_buffered);
+ }
+
+ JPanel(LayoutManager layout)
+ {
+ this(layout,
+ true);
+ }
+
+
+ JPanel(LayoutManager layout,
+ boolean isDoubleBuffered)
+ {
+ if (layout == null)
+ {
+ System.err.println("NO LAYOUT SET !!!");
+ layout = new FlowLayout();
+ }
+ setLayout(layout);
+ setOpaque(true);
+
+ updateUI();
+ }
+
+ String getUIClassID()
+ { return "JPanel"; }
+
+
+ public void setUI(PanelUI ui) {
+ super.setUI(ui);
+ }
+
+ public PanelUI getUI() {
+ return (PanelUI)ui;
+ }
+
+ public void updateUI() {
+ setUI((PanelUI)UIManager.getUI(this));
+ }
+
+
+ AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ protected String paramString()
+ {
+ return "JPanel";
+ }
+}
+
+
+
+
+
+
diff --git a/javax/swing/JRadioButton.java b/javax/swing/JRadioButton.java
new file mode 100644
index 000000000..047dcd5ef
--- /dev/null
+++ b/javax/swing/JRadioButton.java
@@ -0,0 +1,54 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.plaf.*;
+
+public class JRadioButton extends JToggleButton
+{
+ JRadioButton()
+ {
+ this(null, null);
+ }
+ JRadioButton(Action a)
+ {
+ this();
+ setAction(a);
+ }
+
+ JRadioButton(Icon icon)
+ {
+ this(null, icon);
+ }
+
+ JRadioButton(String text)
+ {
+ this(text, null);
+ }
+
+ JRadioButton(String text, Icon icon)
+ {
+ super(text, icon);
+ }
+
+
+ AccessibleContext getAccessibleContext()
+ {
+ //Gets the AccessibleContext associated with this JRadioButton.
+ return null;
+ }
+
+ String getUIClassID()
+ {
+ //Returns a string that specifies the name of the L&F class that renders this component.
+ return "JRadioButton";
+ }
+
+ protected String paramString()
+ {
+ return "JRadioButton";
+ }
+}
+
+
+
diff --git a/javax/swing/JRootPane.java b/javax/swing/JRootPane.java
new file mode 100644
index 000000000..3c2d1169f
--- /dev/null
+++ b/javax/swing/JRootPane.java
@@ -0,0 +1,164 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class JRootPane extends JComponent
+{
+ // The class used to obtain the accessible role for this object.
+ static protected class AccessibleJRootPane
+ {
+ }
+
+ //A custom layout manager
+ static protected class RootLayout extends BorderLayout
+ {
+ public Dimension preferredLayoutSize ( Container c )
+ {
+ Dimension p = super.preferredLayoutSize(c);
+ System.out.println(" PREF-SIZE from RootLayout = " + p);
+ return p;
+ }
+ }
+
+ /***********************************************************/
+
+
+ //The glass pane that overlays the menu bar and content pane, so it can intercept mouse movements and such.
+ protected Component glassPane;
+
+ //The layered pane that manages the menu bar and content pane.
+ protected JLayeredPane layeredPane;
+
+ // The menu bar.
+ protected JMenuBar menuBar;
+
+ protected Container contentPane;
+
+ /********************************************************/
+
+ String getUIClassID()
+ { return "JPanel"; }
+
+
+ void setJMenuBar(JMenuBar m)
+ { menuBar = m; }
+
+ JMenuBar getJMenuBar()
+ { return menuBar; }
+
+
+ public Container getContentPane()
+ {
+ if (contentPane == null)
+ {
+ setContentPane(createContentPane());
+ }
+ return contentPane;
+ }
+
+ public void setContentPane(Container p)
+ {
+ contentPane = p;
+ getLayeredPane().add(contentPane, 0);
+ }
+
+ protected void addImpl(Component comp,
+ Object constraints,
+ int index)
+ {
+ super.addImpl(comp, constraints, index);
+ //System.out.println("don't do that !");
+ }
+
+ public Component getGlassPane()
+ {
+ if (glassPane == null)
+ setGlassPane(createGlassPane());
+ return glassPane;
+ }
+
+ public void setGlassPane(Component f)
+ {
+ if (glassPane != null)
+ remove(glassPane);
+
+ glassPane = f;
+
+ glassPane.setVisible(false);
+ add(glassPane, 0);
+ }
+
+ public JLayeredPane getLayeredPane()
+ {
+ if (layeredPane == null)
+ setLayeredPane(createLayeredPane());
+ return layeredPane;
+ }
+ public void setLayeredPane(JLayeredPane f)
+ {
+ if (layeredPane != null)
+ remove(layeredPane);
+
+ layeredPane = f;
+ add(f, -1);
+ }
+
+
+ /********************************************************/
+
+ JRootPane()
+ {
+ setLayout(createRootLayout());
+
+ getGlassPane();
+ getLayeredPane();
+ getContentPane();
+
+ setDoubleBuffered(true);
+ updateUI();
+ }
+
+ protected LayoutManager createRootLayout() {
+ return new RootLayout();
+ }
+
+ JComponent createContentPane()
+ {
+ JPanel p = new JPanel();
+ p.setName(this.getName()+".contentPane");
+ p.setLayout(new BorderLayout());
+ // p.setVisible(true);
+
+ System.out.println("Created ContentPane: " + p);
+ return p;
+ }
+
+ Component createGlassPane()
+ {
+ JPanel p = new JPanel();
+ p.setName(this.getName()+".glassPane");
+ p.setLayout(new BorderLayout());
+ p.setVisible(false);
+
+ System.out.println("created the glasspane: "+p);
+ return p;
+ }
+
+ JLayeredPane createLayeredPane()
+ {
+ JLayeredPane l = new JLayeredPane();
+ return l;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/JScrollBar.java b/javax/swing/JScrollBar.java
new file mode 100644
index 000000000..97bb76547
--- /dev/null
+++ b/javax/swing/JScrollBar.java
@@ -0,0 +1,6 @@
+package javax.swing;
+
+
+public class JScrollBar extends JComponent
+{
+}
diff --git a/javax/swing/JScrollPane.java b/javax/swing/JScrollPane.java
new file mode 100644
index 000000000..6e4704302
--- /dev/null
+++ b/javax/swing/JScrollPane.java
@@ -0,0 +1,96 @@
+package javax.swing;
+
+import java.awt.*;
+import javax.swing.plaf.*;
+
+
+public class JScrollPane extends JComponent
+{
+ protected JViewport columnHeader;
+ protected JViewport rowHeader;
+
+ protected Component lowerLeft;
+ protected Component lowerRight;
+ protected Component upperLeft;
+ protected Component upperRight;
+
+ protected JScrollBar horizontalScrollBar;
+ protected int horizontalScrollBarPolicy;
+ protected JScrollBar verticalScrollBar;
+ protected int verticalScrollBarPolicy;
+
+ protected JViewport viewport;
+
+
+ JScrollPane()
+ {
+ this(null, 0, 0);
+ }
+
+ JScrollPane(Component view)
+ {
+ this(view, 0, 0);
+ }
+
+
+ JScrollPane(int vsbPolicy, int hsbPolicy)
+ {
+ this(null, 0, 0);
+ }
+
+ JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
+ {
+ setViewportView(view);
+ setOpaque(true);
+ updateUI();
+ }
+
+ String getUIClassID()
+ {
+ //Returns a string that specifies the name of the L&F class that renders this component.
+ return "JScrollPane";
+ }
+
+ JViewport getViewport()
+ {
+ return viewport;
+ }
+
+ JViewport createViewport()
+ {
+ return new JViewport();
+ }
+
+ void setViewport(JViewport v)
+ {
+ if (viewport != null)
+ remove(viewport);
+
+ viewport = v;
+
+ add(v);
+
+ revalidate();
+ repaint();
+ }
+
+ void updateUI()
+ {
+ ScrollPaneUI b = (ScrollPaneUI)UIManager.getUI(this);
+ setUI(b);
+ }
+
+
+ public void setViewportView(Component view)
+ {
+ if (getViewport() == null)
+ {
+ setViewport(createViewport());
+ }
+
+ if (view != null)
+ {
+ getViewport().setView(view);
+ }
+ }
+}
diff --git a/javax/swing/JTabbedPane.java b/javax/swing/JTabbedPane.java
new file mode 100644
index 000000000..7485d3235
--- /dev/null
+++ b/javax/swing/JTabbedPane.java
@@ -0,0 +1,88 @@
+package javax.swing;
+
+import java.util.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+
+public class JTabbedPane extends JComponent
+{
+ class Tab
+ {
+ Icon icon;
+ String name, descr;
+ Component tab;
+
+ Tab(String name,
+ Icon icon,
+ Component tab,
+ String descr)
+ {
+ this.name = name;
+ this.icon = icon;
+ this.tab = tab;
+ this.descr = descr;
+ }
+ }
+
+ private Vector tabs = new Vector();
+
+ JTabbedPane()
+ {
+ }
+
+ void addTab(String name,
+ Component panel)
+ {
+ addTab(name, null, panel, null);
+ }
+ void addTab(String name,
+ Icon icon,
+ Component panel)
+ {
+ addTab(name, icon, panel, null);
+ }
+ void addTab(String name,
+ Icon icon,
+ Component panel,
+ String descr)
+ {
+ tabs.addElement(new Tab(name, icon, panel, descr));
+ }
+
+ int getTabCount()
+ {
+ return tabs.size();
+ }
+ Component getComponentAt(int i)
+ {
+ Tab t = (Tab) tabs.elementAt(i);
+ return t.tab;
+ }
+
+ String getUIClassID()
+ { return "JTabbedPane"; }
+
+
+ public void setUI(TabbedPaneUI ui) {
+ super.setUI(ui);
+ }
+
+ public TabbedPaneUI getUI() {
+ return (TabbedPaneUI)ui;
+ }
+
+ public void updateUI()
+ {
+ setUI((TabbedPaneUI)UIManager.getUI(this));
+ }
+
+ AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ protected String paramString()
+ {
+ return "JTabbedPane";
+ }
+}
diff --git a/javax/swing/JTextField.java b/javax/swing/JTextField.java
new file mode 100644
index 000000000..de265138a
--- /dev/null
+++ b/javax/swing/JTextField.java
@@ -0,0 +1,28 @@
+package javax.swing;
+
+import java.awt.event.*;
+import java.util.*;
+
+
+public class JTextField extends JEditorPane
+{
+ Vector actions = new Vector();
+
+ JTextField(int a)
+ {
+ }
+
+ void addActionListener(ActionListener l)
+ {
+ actions.addElement(l);
+ }
+
+ void removeActionListener(ActionListener l)
+ {
+ actions.removeElement(l);
+ }
+
+ void selectAll()
+ {
+ }
+}
diff --git a/javax/swing/JToggleButton.java b/javax/swing/JToggleButton.java
new file mode 100644
index 000000000..1ffa2a33c
--- /dev/null
+++ b/javax/swing/JToggleButton.java
@@ -0,0 +1,72 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.plaf.*;
+
+public class JToggleButton extends AbstractButton
+{
+ JToggleButton()
+ {
+ this(null, null);
+ }
+ JToggleButton(Action a)
+ {
+ this();
+ setAction(a);
+ }
+
+ JToggleButton(Icon icon)
+ {
+ this(null, icon);
+ }
+
+ JToggleButton(String text)
+ {
+ this(text, null);
+ }
+
+ JToggleButton(String text, Icon icon)
+ {
+ this(text, icon, false);
+ }
+
+ JToggleButton (String text, Icon icon, boolean selected)
+ {
+ super(text, icon);
+
+ // Create the model
+ setModel(new ToggleButtonModel(this));
+
+ model.setSelected(selected);
+ }
+
+
+
+ AccessibleContext getAccessibleContext()
+ {
+ //Gets the AccessibleContext associated with this JToggleButton.
+ return null;
+ }
+
+ String getUIClassID()
+ {
+ //Returns a string that specifies the name of the L&F class that renders this component.
+ return "JToggleButton";
+ }
+
+ protected String paramString()
+ {
+ return "JToggleButton";
+ }
+
+
+ void updateUI()
+ {
+ ButtonUI b = (ButtonUI)UIManager.getUI(this);
+ setUI(b);
+ }
+}
+
+
+
diff --git a/javax/swing/JToolTip.java b/javax/swing/JToolTip.java
new file mode 100644
index 000000000..b7a306bbe
--- /dev/null
+++ b/javax/swing/JToolTip.java
@@ -0,0 +1,16 @@
+package javax.swing;
+
+import java.awt.*;
+
+
+public class JToolTip extends JComponent
+{
+ String text;
+
+ JToolTip(String text)
+ {
+ this.text = text;
+ }
+}
+
+
diff --git a/javax/swing/JTree.java b/javax/swing/JTree.java
new file mode 100644
index 000000000..e9d345c57
--- /dev/null
+++ b/javax/swing/JTree.java
@@ -0,0 +1,71 @@
+package javax.swing;
+
+import java.awt.*;
+import javax.swing.plaf.*;
+
+public class JTree extends JComponent implements Scrollable, Accessible
+{
+ JTree()
+ {
+ updateUI();
+ }
+
+ public TreeUI getUI()
+ {
+ return (TreeUI) ui;
+ }
+
+ public void setUI(TreeUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ public void updateUI()
+ {
+ setUI((TreeUI)UIManager.getUI(this));
+ }
+
+
+ public String getUIClassID()
+ {
+ return "JTree";
+ }
+
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ public Dimension getPreferredScrollableViewportSize()
+ {
+ return null;
+ }
+
+ public int getScrollableUnitIncrement(Rectangle visibleRect,
+ int orientation,
+ int direction)
+ {
+ return 1;
+ }
+
+ public int getScrollableBlockIncrement(Rectangle visibleRect,
+ int orientation,
+ int direction)
+ {
+ return 1;
+ }
+
+ public boolean getScrollableTracksViewportWidth()
+ {
+ return false;
+ }
+
+ public boolean getScrollableTracksViewportHeight()
+ {
+ return false;
+ }
+}
+
+
+
diff --git a/javax/swing/JViewport.java b/javax/swing/JViewport.java
new file mode 100644
index 000000000..7d8ca7615
--- /dev/null
+++ b/javax/swing/JViewport.java
@@ -0,0 +1,99 @@
+package javax.swing;
+
+import javax.swing.plaf.*;
+import java.awt.*;
+
+
+public class JViewport extends JComponent
+{
+ Component c;
+
+ JViewport()
+ {
+ setOpaque(true);
+ updateUI();
+ }
+
+ void setView(Component c)
+ {
+ if (this.c != null)
+ remove(c);
+
+ this.c = c;
+
+ add(c);
+ }
+
+ public String getUIClassID()
+ {
+ return "JViewport";
+ }
+
+ public void updateUI()
+ {
+ ViewportUI vp = (ViewportUI) UIManager.getUI(this);
+ setUI(vp);
+ }
+
+ Container GetHeavy(Container parent)
+ {
+ if (parent == null)
+ return null;
+
+ while (isLightweightComponent(parent))
+ {
+ Container p = parent.getParent();
+
+ if (p == null)
+ {
+ System.out.println("GetHeavy FAILED, no heavy weight component found");
+ return parent;
+ }
+
+ parent = p;
+ }
+ return parent;
+ }
+
+
+ public void paint(Graphics g)
+ {
+ paintChildren(g);
+
+ System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXX JViewport -----> paint()");
+
+ Container parent = GetHeavy(getParent());
+
+ System.out.println("parent = " + parent + ", " + getParent());
+
+ //parent.paint();
+
+ Graphics wg = parent.getGraphics();
+
+ int x = 0;
+ int y = 0;
+ int w = getWidth();
+ int h = getHeight();
+
+ Rectangle r = new Rectangle(x, y, w, h);
+
+ int ox = 0;
+ int oy = 0;
+
+ wg.copyArea(r.x,
+ r.y,
+ r.width,
+ r.height,
+ ox,
+ oy);
+
+ wg.dispose();
+ }
+}
+
+
+
+
+
+
+
diff --git a/javax/swing/JWindow.java b/javax/swing/JWindow.java
new file mode 100644
index 000000000..fa5f1c9b4
--- /dev/null
+++ b/javax/swing/JWindow.java
@@ -0,0 +1,189 @@
+package javax.swing;
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+
+public class JWindow extends Window implements Accessible
+{
+ public final static int HIDE_ON_CLOSE = 0;
+ public final static int EXIT_ON_CLOSE = 1;
+ public final static int DISPOSE_ON_CLOSE = 2;
+ public final static int DO_NOTHING_ON_CLOSE = 3;
+
+ protected AccessibleContext accessibleContext;
+
+ private int close_action = EXIT_ON_CLOSE;
+
+
+ /***************************************************
+ *
+ *
+ * constructors
+ *
+ *
+ *************/
+
+ JWindow()
+ {
+ }
+
+ /***************************************************
+ *
+ *
+ * methods, this part is shared with JDialog, JFrame
+ *
+ *
+ *************/
+
+
+ private boolean checking;
+ protected JRootPane rootPane;
+
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ getRootPane(); // will do set/create
+ }
+
+ public Dimension getPreferredSize()
+ {
+ Dimension d = super.getPreferredSize();
+ return d;
+ }
+
+ JMenuBar getJMenuBar()
+ { return getRootPane().getJMenuBar(); }
+
+ void setJMenuBar(JMenuBar menubar)
+ { getRootPane().setJMenuBar(menubar); }
+
+
+ public void setLayout(LayoutManager manager)
+ { super.setLayout(manager); }
+
+ void setLayeredPane(JLayeredPane layeredPane)
+ { getRootPane().setLayeredPane(layeredPane); }
+
+ JLayeredPane getLayeredPane()
+ { return getRootPane().getLayeredPane(); }
+
+ JRootPane getRootPane()
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
+
+ void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+
+ JRootPane createRootPane()
+ { return new JRootPane(); }
+
+ Container getContentPane()
+ { return getRootPane().getContentPane(); }
+
+ void setContentPane(Container contentPane)
+ { getRootPane().setContentPane(contentPane); }
+
+ Component getGlassPane()
+ { return getRootPane().getGlassPane(); }
+
+ void setGlassPane(Component glassPane)
+ { getRootPane().setGlassPane(glassPane); }
+
+
+ protected void addImpl(Component comp, Object constraints, int index)
+ { super.addImpl(comp, constraints, index); }
+
+
+ public void remove(Component comp)
+ { getContentPane().remove(comp); }
+
+ protected boolean isRootPaneCheckingEnabled()
+ { return checking; }
+
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ { checking = enabled; }
+
+
+ public void update(Graphics g)
+ { paint(g); }
+
+ protected void processKeyEvent(KeyEvent e)
+ { super.processKeyEvent(e); }
+
+ /////////////////////////////////////////////////////////////////////////////////
+
+ public AccessibleContext getAccessibleContext()
+ { return null; }
+
+ int getDefaultCloseOperation()
+ { return close_action; }
+
+ protected String paramString()
+ { return "JWindow"; }
+
+
+ protected void processWindowEvent(WindowEvent e)
+ {
+ // System.out.println("PROCESS_WIN_EV-1: " + e);
+ super.processWindowEvent(e);
+ // System.out.println("PROCESS_WIN_EV-2: " + e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch(close_action)
+ {
+ case EXIT_ON_CLOSE:
+ {
+ System.out.println("user requested exit on close");
+ System.exit(1);
+ break;
+ }
+ case DISPOSE_ON_CLOSE:
+ {
+ System.out.println("user requested dispose on close");
+ dispose();
+ break;
+ }
+ case HIDE_ON_CLOSE:
+ {
+ setVisible(false);
+ break;
+ }
+ case DO_NOTHING_ON_CLOSE:
+ break;
+ }
+ break;
+ }
+
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_OPENED:
+ case WindowEvent.WINDOW_ICONIFIED:
+ case WindowEvent.WINDOW_DEICONIFIED:
+ case WindowEvent.WINDOW_ACTIVATED:
+ case WindowEvent.WINDOW_DEACTIVATED:
+ break;
+ }
+ }
+
+
+ void setDefaultCloseOperation(int operation)
+ { close_action = operation; }
+
+}
+
+
+
diff --git a/javax/swing/KeyStroke.java b/javax/swing/KeyStroke.java
new file mode 100644
index 000000000..dbb0ab443
--- /dev/null
+++ b/javax/swing/KeyStroke.java
@@ -0,0 +1,8 @@
+package javax.swing;
+
+import java.io.*;
+
+public class KeyStroke implements Serializable
+{
+}
+
diff --git a/javax/swing/ListCellRenderer.java b/javax/swing/ListCellRenderer.java
new file mode 100644
index 000000000..a1374f7d8
--- /dev/null
+++ b/javax/swing/ListCellRenderer.java
@@ -0,0 +1,12 @@
+package javax.swing;
+
+import java.awt.*;
+
+public interface ListCellRenderer
+{
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus);
+}
diff --git a/javax/swing/ListModel.java b/javax/swing/ListModel.java
new file mode 100644
index 000000000..fbe662b2e
--- /dev/null
+++ b/javax/swing/ListModel.java
@@ -0,0 +1,11 @@
+package javax.swing;
+
+import javax.swing.event.*;
+
+public interface ListModel
+{
+ int getSize();
+ Object getElementAt(int index);
+ void addListDataListener(ListDataListener l);
+ void removeListDataListener(ListDataListener l);
+}
diff --git a/javax/swing/ListSelectionModel.java b/javax/swing/ListSelectionModel.java
new file mode 100644
index 000000000..8b3190eb7
--- /dev/null
+++ b/javax/swing/ListSelectionModel.java
@@ -0,0 +1,28 @@
+package javax.swing;
+
+
+import javax.swing.event.*;
+
+public interface ListSelectionModel
+{
+ final static int SINGLE_SELECTION = 0;
+ final static int SINGLE_INTERVAL_SELECTION = 1;
+ final static int MULTIPLE_INTERVAL_SELECTION = 1;
+
+ void setSelectionMode(int a);
+ int getSelectionMode();
+
+ void clearSelection();
+
+ int getMinSelectionIndex();
+ int getMaxSelectionIndex();
+ boolean isSelectedIndex(int a);
+
+ void setSelectionInterval(int index0, int index1);
+
+
+
+ void addListSelectionListener(ListSelectionListener listener);
+ void removeListSelectionListener(ListSelectionListener listener);
+
+}
diff --git a/javax/swing/LookAndFeel.java b/javax/swing/LookAndFeel.java
new file mode 100644
index 000000000..b5475bd82
--- /dev/null
+++ b/javax/swing/LookAndFeel.java
@@ -0,0 +1,88 @@
+package javax.swing;
+
+import javax.swing.text.*;
+
+public abstract class LookAndFeel
+{
+ UIDefaults getDefaults()
+ {
+ //This method is called once by UIManager.setLookAndFeel to create the look and feel specific defaults table.
+ return null;
+ }
+
+ abstract String getDescription();
+ abstract String getID();
+ abstract String getName();
+
+ void initialize()
+ {
+ //UIManager.setLookAndFeel calls this method before the first call (and typically the only call) to getDefaults().
+ }
+
+ static void installBorder(JComponent c, String defaultBorderName)
+ {
+ //Convenience method for installing a component's default Border object on the specified component if either the border is currently null or already an instance of UIResource.
+ }
+
+ static void installColors(JComponent c, String defaultBgName, String defaultFgName)
+ {
+ //Convenience method for initializing a component's foreground and background color properties with values from the current defaults table.
+ }
+
+ static void installColorsAndFont(JComponent c, String defaultBgName, String defaultFgName, String defaultFontName)
+ {
+ //Convenience method for initializing a components foreground background and font properties with values from the current defaults table.
+ }
+
+ abstract boolean isNativeLookAndFeel();
+ abstract boolean isSupportedLookAndFeel();
+
+ static void loadKeyBindings(InputMap retMap, Object[] keys)
+ {
+ //Loads the bindings in keys into retMap.
+ }
+
+ static ComponentInputMap makeComponentInputMap(JComponent c, Object[] keys)
+ {
+ // Creates a ComponentInputMap from keys.
+ return null;
+ }
+
+ static Object makeIcon(Class baseClass, String gifFile)
+ {
+ //Utility method that creates a UIDefaults.LazyValue that creates an ImageIcon UIResource for the specified gifFile filename.
+ return null;
+ }
+
+ static InputMap makeInputMap(Object[] keys)
+ {
+ //Creates a InputMap from keys.
+ return null;
+ }
+
+ static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)
+ {
+ // Convenience method for building lists of KeyBindings.
+ return null;
+ }
+
+
+ public String toString()
+ {
+ //Returns a string that displays and identifies this object's properties.
+ return "LookAndFeel";
+ }
+
+ void uninitialize()
+ {
+ //UIManager.setLookAndFeel calls this method just before we're replaced by a new default look and feel.
+ }
+
+
+ static void uninstallBorder(JComponent c)
+ {
+ //Convenience method for un-installing a component's default border on the specified component if the border is currently an instance of UIResource.
+ }
+
+}
+
diff --git a/javax/swing/Scrollable.java b/javax/swing/Scrollable.java
new file mode 100644
index 000000000..3ba56e0ea
--- /dev/null
+++ b/javax/swing/Scrollable.java
@@ -0,0 +1,12 @@
+package javax.swing;
+
+import java.awt.*;
+
+public interface Scrollable
+{
+ Dimension getPreferredScrollableViewportSize();
+ int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction);
+ int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction);
+ boolean getScrollableTracksViewportWidth();
+ boolean getScrollableTracksViewportHeight();
+}
diff --git a/javax/swing/SwingConstants.java b/javax/swing/SwingConstants.java
new file mode 100644
index 000000000..639ec8122
--- /dev/null
+++ b/javax/swing/SwingConstants.java
@@ -0,0 +1,28 @@
+package javax.swing;
+
+
+
+public interface SwingConstants
+{
+ public static final int CENTER = 0;
+ public static final int TOP = 1;
+ public static final int LEFT = 2;
+ public static final int BOTTOM = 3;
+ public static final int RIGHT = 4;
+
+ public static final int NORTH = 1;
+ public static final int NORTH_EAST = 2;
+ public static final int EAST = 3;
+ public static final int SOUTH_EAST = 4;
+ public static final int SOUTH = 5;
+ public static final int SOUTH_WEST = 6;
+ public static final int WEST = 7;
+ public static final int NORTH_WEST = 8;
+
+ public static final int HORIZONTAL = 0;
+ public static final int VERTICAL = 1;
+
+ public static final int LEADING = 10;
+ public static final int TRAILING = 11;
+}
+
diff --git a/javax/swing/SwingUtilities.java b/javax/swing/SwingUtilities.java
new file mode 100644
index 000000000..47007982b
--- /dev/null
+++ b/javax/swing/SwingUtilities.java
@@ -0,0 +1,77 @@
+package javax.swing;
+
+import java.awt.*;
+
+
+public class SwingUtilities
+{
+ static JRootPane getRootPane(Component a)
+ {
+ if (a instanceof JRootPane)
+ return (JRootPane) a;
+
+ a = a.getParent();
+
+ if (a != null)
+ {
+ return getRootPane(a);
+ }
+
+ return null;
+ }
+
+ static void updateComponentTreeUI(JFrame comp)
+ {
+ }
+
+ static public String layoutCompoundLabel(JComponent c,
+ FontMetrics fm,
+ String text,
+ Icon i,
+ int vert_a,
+ int hor_i,
+ int vert_text_pos,
+ int hor_text_pos,
+ Rectangle vr,
+ Rectangle ir,
+ Rectangle tr,
+ int gap)
+ {
+ // view rect 'vr' already ok,
+ // we need to compute ir (icon rect) and tr (text-rect)
+
+ int next_x = 0;//vr.x;
+ int next_y = 0;//vr.y;
+
+ ir.height = ir.width = ir.y = ir.x = 0;
+
+ if (i != null)
+ {
+ ir.x = vr.x;
+ ir.y = vr.y;
+ ir.width = i.getIconWidth();
+ ir.height = i.getIconWidth();
+
+
+ next_x += gap + i.getIconWidth();
+ next_y += gap + i.getIconHeight();
+ }
+
+ tr.x = next_x;
+ tr.y = vr.y + (vr.height/2);
+
+ tr.width = fm.stringWidth(text);
+ tr.height = fm.getHeight() + fm.getAscent()/2;
+
+ return text;
+ }
+}
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/Timer.java b/javax/swing/Timer.java
new file mode 100644
index 000000000..f225e8cd9
--- /dev/null
+++ b/javax/swing/Timer.java
@@ -0,0 +1,117 @@
+package javax.swing;
+
+import java.awt.event.*;
+import java.util.*;
+
+
+public class Timer
+{
+ int ticks;
+ static boolean verbose;
+ boolean running;
+ boolean repeat_ticks = true;
+ long interval, init_delay;
+ Vector actions = new Vector();
+
+ class Waker extends Thread
+ {
+ public void run()
+ {
+ running = true;
+ try {
+ sleep(init_delay);
+
+ while (running)
+ {
+ sleep(interval);
+
+ if (verbose)
+ {
+ System.out.println("javax.swing.Timer -> clocktick");
+ }
+
+ ticks++;
+ fireActionPerformed();
+
+ if (! repeat_ticks)
+ break;
+ }
+ running = false;
+ } catch (Exception e) {
+ System.out.println("swing.Timer::" + e);
+ }
+ }
+ }
+
+ public void addActionListener(ActionListener listener)
+ {
+ actions.addElement(listener);
+ }
+ public void removeActionListener(ActionListener listener)
+ {
+ actions.removeElement(listener);
+ }
+
+ void fireActionPerformed()
+ {
+ for (int i=0;i<actions.size();i++)
+ {
+ ActionListener a = (ActionListener) actions.elementAt(i);
+ a.actionPerformed(new ActionEvent(this, ticks, "Timer"));
+ }
+ }
+
+
+
+ public static void setLogTimers(boolean flag)
+ {
+ verbose = flag;
+ }
+
+ public static boolean getLogTimers()
+ {
+ return verbose;
+ }
+
+
+ public void setDelay(int delay)
+ {
+ interval = delay;
+ }
+
+ public int getDelay()
+ {
+ return (int)interval;
+ }
+
+
+ public void setInitialDelay(int initialDelay)
+ {
+ init_delay = initialDelay;
+ }
+
+ public void setRepeats(boolean flag)
+ {
+ repeat_ticks = flag;
+ }
+
+ boolean isRunning()
+ {
+ return running;
+ }
+
+ void start()
+ {
+ if (isRunning())
+ {
+ System.err.println("attempt to start a running timer");
+ return;
+ }
+ new Waker().start();
+ }
+
+ void stop()
+ {
+ running = false;
+ }
+}
diff --git a/javax/swing/ToggleButtonModel.java b/javax/swing/ToggleButtonModel.java
new file mode 100644
index 000000000..664e87731
--- /dev/null
+++ b/javax/swing/ToggleButtonModel.java
@@ -0,0 +1,27 @@
+package javax.swing;
+
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.event.*;
+
+public
+class ToggleButtonModel extends DefaultButtonModel
+{
+ ToggleButtonModel(JComponent c)
+ {
+ super(c);
+ }
+
+ public void setPressed(boolean b)
+ {
+ if (! isEnabled())
+ return;
+
+ if (! b)
+ {
+ return;
+ }
+
+ setSelected(b);
+ }
+}
diff --git a/javax/swing/UIDefaults.java b/javax/swing/UIDefaults.java
new file mode 100644
index 000000000..bcd19856e
--- /dev/null
+++ b/javax/swing/UIDefaults.java
@@ -0,0 +1,33 @@
+package javax.swing;
+
+import java.util.*;
+import javax.swing.*;
+import javax.swing.plaf.*;
+
+import java.awt.*;
+
+public class UIDefaults extends Hashtable
+{
+ ComponentUI getUI(JComponent a)
+ {
+ String pp = a.getUIClassID(); //a.getClass().getName();
+
+ ComponentUI p = (ComponentUI) get(pp);
+ if (p == null)
+ {
+ System.out.println("failed to locate UI:" + pp);
+ }
+ else
+ {
+ System.out.println("UI Located ----> " + pp + " === " + p);
+ }
+ return p;
+ }
+
+ public Insets getInsets(Object key)
+ {
+ Insets s = (Insets) get(key);
+ System.out.println("insets----> " + s);
+ return s;
+ }
+}
diff --git a/javax/swing/UIManager.java b/javax/swing/UIManager.java
new file mode 100644
index 000000000..b44146daa
--- /dev/null
+++ b/javax/swing/UIManager.java
@@ -0,0 +1,233 @@
+package javax.swing;
+
+import java.io.*;
+import java.awt.*;
+
+import javax.swing.border.*;
+import javax.swing.plaf.*;
+import javax.swing.plaf.basic.*;
+import javax.swing.plaf.metal.*;
+
+
+import java.beans.*;
+
+
+public class UIManager implements Serializable
+{
+ static class LookAndFeelInfo
+ {
+ String name, clazz;
+
+ LookAndFeelInfo(String name,
+ String clazz)
+ {
+ this.name = name;
+ this.clazz = clazz;
+ }
+ String getName() { return name; }
+ String getClassName() { return clazz; }
+ }
+
+
+ static LookAndFeelInfo [] installed = {
+ new LookAndFeelInfo("Metal",
+ "javax.swing.plaf.metal.MetalLookAndFeel")
+ };
+
+
+ static LookAndFeel[] aux_installed;
+
+ static LookAndFeel look_and_feel = new MetalLookAndFeel();
+
+
+ UIManager()
+ {
+ }
+
+ static void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ // Add a PropertyChangeListener to the listener list.
+ }
+
+ static void addAuxiliaryLookAndFeel(LookAndFeel l)
+ {
+ // Add a LookAndFeel to the list of auxiliary look and feels.
+ if (aux_installed == null)
+ {
+ aux_installed = new LookAndFeel[1];
+ aux_installed[0] = l;
+ return;
+ }
+
+ LookAndFeel[] T = new LookAndFeel[ aux_installed.length+1 ];
+ System.arraycopy(aux_installed, 0,
+ T, 0,
+ aux_installed.length);
+ aux_installed = T;
+ aux_installed[aux_installed.length-1] = l;
+ }
+
+ static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)
+ {
+ if (aux_installed == null)
+ return false;
+
+ for (int i=0;i<aux_installed.length;i++)
+ {
+ if (aux_installed[i] == laf)
+ {
+ aux_installed[ i ] = aux_installed[aux_installed.length-1];
+
+ LookAndFeel[] T = new LookAndFeel[ aux_installed.length-1 ];
+ System.arraycopy(aux_installed, 0,
+ T, 0,
+ aux_installed.length-1);
+ aux_installed = T;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static LookAndFeel[] getAuxiliaryLookAndFeels()
+ { return aux_installed; }
+
+
+ static Object get(Object key)
+ { return getLookAndFeel().getDefaults().get(key); }
+
+ static Border getBorder(Object key)
+ // Returns a border from the defaults table.
+ {
+ return (Border) getLookAndFeel().getDefaults().get(key);
+ }
+
+ static Color getColor(Object key)
+ // Returns a drawing color from the defaults table.
+ {
+ return (Color) getLookAndFeel().getDefaults().get(key);
+ }
+ static String getCrossPlatformLookAndFeelClassName()
+ {
+ // this string can be passed to Class.forName()
+ return "javax.swing.plaf.metal.MetalLookAndFeel";
+ }
+
+ static UIDefaults getDefaults()
+ {
+ // Returns the default values for this look and feel.
+ return getLookAndFeel().getDefaults();
+ }
+
+ static Dimension getDimension(Object key)
+ // Returns a dimension from the defaults table.
+ {
+ System.out.println("UIManager.getDim");
+ return new Dimension(200,100);
+ }
+ static Font getFont(Object key)
+ // Returns a drawing font from the defaults table.
+ {
+ return (Font) getLookAndFeel().getDefaults().get(key);
+ }
+ static Icon getIcon(Object key)
+ // Returns an Icon from the defaults table.
+ {
+ return (Icon) getLookAndFeel().getDefaults().get(key);
+ }
+ static Insets getInsets(Object key)
+ // Returns an Insets object from the defaults table.
+ {
+ return (Insets) getLookAndFeel().getDefaults().getInsets(key);
+ }
+
+ static LookAndFeelInfo[] getInstalledLookAndFeels()
+ {
+ return installed;
+ }
+
+ static int getInt(Object key)
+ {
+ Integer x = (Integer) getLookAndFeel().getDefaults().get(key);
+ if (x == null)
+ return 0;
+ return x.intValue();
+ }
+ static LookAndFeel getLookAndFeel()
+ {
+ return look_and_feel;
+ }
+
+ static UIDefaults getLookAndFeelDefaults()
+ // Returns the default values for this look and feel.
+ {
+ return getLookAndFeel().getDefaults();
+ }
+ static String getString(Object key)
+ // Returns a string from the defaults table.
+ {
+ return (String) getLookAndFeel().getDefaults().get(key);
+ }
+ static String getSystemLookAndFeelClassName()
+ // Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class.
+ {
+ return getCrossPlatformLookAndFeelClassName();
+ }
+
+
+ static ComponentUI getUI(JComponent target)
+ // Returns the L&F object that renders the target component.
+ {
+ ComponentUI ui = getDefaults().getUI(target);
+ //System.out.println("GET-UI-> " + ui + ", for " + target);
+ return ui;
+ }
+
+
+ static void installLookAndFeel(String name, String className)
+ // Creates a new look and feel and adds it to the current array.
+ {
+ }
+ static void installLookAndFeel(LookAndFeelInfo info)
+ // Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]).
+ {
+ }
+ static Object put(Object key, Object value)
+ // Stores an object in the defaults table.
+ {
+ return getLookAndFeel().getDefaults().put(key,value);
+ }
+ static void removePropertyChangeListener(PropertyChangeListener listener)
+ // Remove a PropertyChangeListener from the listener list.
+ {
+ }
+ static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
+ // Replaces the current array of installed LookAndFeelInfos.
+ {
+ }
+ static void setLookAndFeel(LookAndFeel newLookAndFeel)
+ {
+ if (look_and_feel != null)
+ look_and_feel.uninitialize();
+
+ // Set the current default look and feel using a LookAndFeel object.
+ look_and_feel = newLookAndFeel;
+ look_and_feel.initialize();
+
+ // revalidate();
+ // repaint();
+ }
+ static void setLookAndFeel(String className)
+ throws ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException,
+ UnsupportedLookAndFeelException
+ {
+ // Set the current default look and feel using a class name.
+ Class c = Class.forName(className);
+ LookAndFeel a = (LookAndFeel) c.newInstance(); // throws class-cast-exception
+ setLookAndFeel(a);
+ }
+
+
+}
diff --git a/javax/swing/UnsupportedLookAndFeelException.java b/javax/swing/UnsupportedLookAndFeelException.java
new file mode 100644
index 000000000..26d51ba5c
--- /dev/null
+++ b/javax/swing/UnsupportedLookAndFeelException.java
@@ -0,0 +1,10 @@
+package javax.swing;
+
+
+public class UnsupportedLookAndFeelException extends Exception
+{
+ UnsupportedLookAndFeelException(String a)
+ {
+ super(a);
+ }
+}
diff --git a/javax/swing/border/AbstractBorder.java b/javax/swing/border/AbstractBorder.java
new file mode 100644
index 000000000..be6edf529
--- /dev/null
+++ b/javax/swing/border/AbstractBorder.java
@@ -0,0 +1,85 @@
+package javax.swing.border;
+
+import java.io.*;
+import java.awt.*;
+
+public abstract class AbstractBorder implements Border, Serializable
+{
+ AbstractBorder()
+ {
+ }
+
+ public void paintBorder(Component c,
+ Graphics g,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ System.out.println("HMMMMM, abstract-border.paintBorder");
+ }
+
+
+ public Insets getBorderInsets(Component c, Insets insets)
+ {
+ if (insets == null)
+ insets = new Insets();
+
+ insets.left = insets.top = insets.right = insets.bottom = 5;
+
+ return insets;
+ }
+
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, new Insets());
+ }
+
+
+ public boolean isBorderOpaque()
+ { return false; }
+
+ public Rectangle getInteriorRectangle(Component c,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ return getInteriorRectangle(c,
+ this,
+ x,
+ y,
+ width,
+ height);
+ }
+
+
+ public static Rectangle getInteriorRectangle(Component c,
+ Border b,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ if(b != null)
+ {
+ Insets insets = b.getBorderInsets(c);
+
+ int w = insets.right - insets.left;
+ int h = insets.top - insets.bottom;
+
+ return new Rectangle(x + insets.left,
+ y + insets.top,
+ width - w,
+ height - h);
+ }
+ else
+ {
+ return new Rectangle(x,
+ y,
+ width,
+ height);
+ }
+ }
+}
+
diff --git a/javax/swing/border/Border.java b/javax/swing/border/Border.java
new file mode 100644
index 000000000..60bc8d47d
--- /dev/null
+++ b/javax/swing/border/Border.java
@@ -0,0 +1,15 @@
+package javax.swing.border;
+
+import java.awt.*;
+
+public interface Border
+{
+ public Insets getBorderInsets(Component c);
+ public boolean isBorderOpaque();
+ public void paintBorder(Component c,
+ Graphics g,
+ int x,
+ int y,
+ int width,
+ int height);
+}
diff --git a/javax/swing/border/CompoundBorder.java b/javax/swing/border/CompoundBorder.java
new file mode 100644
index 000000000..5e5dbc7ce
--- /dev/null
+++ b/javax/swing/border/CompoundBorder.java
@@ -0,0 +1,33 @@
+package javax.swing.border;
+
+import java.awt.*;
+
+public class CompoundBorder extends AbstractBorder
+{
+
+ public Insets getBorderInsets(Component c,
+ Insets s)
+ {
+ if (s == null)
+ s = new Insets();
+
+ s.left = s.right = s.top = s.bottom = 5;
+
+ return s;
+ }
+
+ public boolean isBorderOpaque()
+ {
+ return false;
+ }
+
+ public void paintBorder(Component c,
+ Graphics g,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ }
+}
+
diff --git a/javax/swing/border/EmptyBorder.java b/javax/swing/border/EmptyBorder.java
new file mode 100644
index 000000000..9de08bb68
--- /dev/null
+++ b/javax/swing/border/EmptyBorder.java
@@ -0,0 +1,54 @@
+package javax.swing.border;
+
+import java.awt.*;
+
+
+public class EmptyBorder extends AbstractBorder
+{
+
+ protected int l,r,b,t;
+
+
+ EmptyBorder()
+ {
+ }
+
+ EmptyBorder(int left,
+ int right,
+ int top,
+ int bottom)
+ {
+ this.l = left;
+ this.r = r;
+ this.t = t;
+ this.b = b;
+ }
+
+
+ public Insets getBorderInsets(Component c,
+ Insets s)
+ {
+ if (s == null)
+ s = new Insets();
+
+ s.left = l;
+ s.right = r;
+ s.top = t;
+ s.bottom = b;
+
+ return s;
+ }
+
+ public boolean isBorderOpaque()
+ {
+ return false;
+ }
+
+
+ public void paintBorder(Component c,
+ Graphics g,
+ int x, int y, int width, int height)
+ {
+ }
+}
+
diff --git a/javax/swing/border/MatteBorder.java b/javax/swing/border/MatteBorder.java
new file mode 100644
index 000000000..b40f7847f
--- /dev/null
+++ b/javax/swing/border/MatteBorder.java
@@ -0,0 +1,38 @@
+package javax.swing.border;
+
+import java.awt.*;
+
+public class MatteBorder extends EmptyBorder
+{
+ Color c;
+
+ MatteBorder()
+ {
+ }
+
+
+ MatteBorder(int top,
+ int left,
+ int bottom,
+ int right,
+ Color color)
+ {
+ super(top, left, bottom, right);
+ this.c = color;
+ }
+
+ public boolean isBorderOpaque()
+ {
+ return false;
+ }
+
+ public void paintBorder(Component c,
+ Graphics g,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ }
+}
+
diff --git a/javax/swing/border/TitledBorder.java b/javax/swing/border/TitledBorder.java
new file mode 100644
index 000000000..f1f03deec
--- /dev/null
+++ b/javax/swing/border/TitledBorder.java
@@ -0,0 +1,31 @@
+package javax.swing.border;
+
+import java.awt.*;
+
+public class TitledBorder extends AbstractBorder
+{
+
+ public Insets getBorderInsets(Component c,
+ Insets s)
+ {
+ s.left = s.right = s.top = s.bottom = 5;
+ return s;
+ }
+
+
+
+ public boolean isBorderOpaque()
+ {
+ return false;
+ }
+
+ public void paintBorder(Component c,
+ Graphics g,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ }
+}
+
diff --git a/javax/swing/event/AncestorEvent.java b/javax/swing/event/AncestorEvent.java
new file mode 100644
index 000000000..326ed19dd
--- /dev/null
+++ b/javax/swing/event/AncestorEvent.java
@@ -0,0 +1,12 @@
+package javax.swing.event;
+
+import java.awt.*;
+
+public class AncestorEvent extends AWTEvent
+{
+ AncestorEvent(Component src,
+ int id)
+ {
+ super(src, id);
+ }
+}
diff --git a/javax/swing/event/AncestorListener.java b/javax/swing/event/AncestorListener.java
new file mode 100644
index 000000000..87b4c80db
--- /dev/null
+++ b/javax/swing/event/AncestorListener.java
@@ -0,0 +1,13 @@
+package javax.swing.event;
+
+
+public interface AncestorListener extends EventListener
+{
+ void ancestorAdded(AncestorEvent event);
+ // Called when the source or one of its ancestors is made visible either by setVisible(true) being called or by its being added to the component hierarchy.
+ void ancestorMoved(AncestorEvent event);
+ // Called when either the source or one of its ancestors is moved.
+ void ancestorRemoved(AncestorEvent event);
+ // Called when the source or one of its ancestors is made invisible either by setVisible(false) being called or by its being remove from the component hierarchy.
+
+}
diff --git a/javax/swing/event/ChangeEvent.java b/javax/swing/event/ChangeEvent.java
new file mode 100644
index 000000000..9b07ec497
--- /dev/null
+++ b/javax/swing/event/ChangeEvent.java
@@ -0,0 +1,12 @@
+package javax.swing.event;
+
+import java.util.*;
+
+public class ChangeEvent extends EventObject
+{
+ ChangeEvent(Object src)
+ {
+ super(src);
+ }
+}
+
diff --git a/javax/swing/event/ChangeListener.java b/javax/swing/event/ChangeListener.java
new file mode 100644
index 000000000..05b14e988
--- /dev/null
+++ b/javax/swing/event/ChangeListener.java
@@ -0,0 +1,7 @@
+package javax.swing.event;
+
+
+public interface ChangeListener
+{
+ void stateChanged(ChangeEvent e);
+}
diff --git a/javax/swing/event/DocumentEvent.java b/javax/swing/event/DocumentEvent.java
new file mode 100644
index 000000000..004d45fe8
--- /dev/null
+++ b/javax/swing/event/DocumentEvent.java
@@ -0,0 +1,22 @@
+package javax.swing.event;
+
+import javax.swing.text.*;
+
+
+public interface DocumentEvent
+{
+ class ElementChange
+ {
+ }
+
+ class EventType
+ {
+ }
+
+ ElementChange getChange(Element elem);
+ Document getDocument();
+ int getLength();
+ int getOffset();
+ EventType getType();
+}
+
diff --git a/javax/swing/event/DocumentListener.java b/javax/swing/event/DocumentListener.java
new file mode 100644
index 000000000..7ae4babe4
--- /dev/null
+++ b/javax/swing/event/DocumentListener.java
@@ -0,0 +1,11 @@
+package javax.swing.event;
+
+import java.util.*;
+
+public interface DocumentListener extends EventListener
+{
+ void changedUpdate(DocumentEvent e);
+ void insertUpdate(DocumentEvent e);
+ void removeUpdate(DocumentEvent e);
+}
+
diff --git a/javax/swing/event/HyperlinkEvent.java b/javax/swing/event/HyperlinkEvent.java
new file mode 100644
index 000000000..109c0445d
--- /dev/null
+++ b/javax/swing/event/HyperlinkEvent.java
@@ -0,0 +1,27 @@
+package javax.swing.event;
+
+import java.util.*;
+import java.net.*;
+
+public class HyperlinkEvent extends EventObject
+{
+ class EventType
+ {
+ }
+
+ String descr;
+ EventType t;
+
+ HyperlinkEvent(Object source, EventType type, URL u)
+ {
+ this(source, type, u, null);
+ }
+
+ HyperlinkEvent(Object source, EventType type, URL u, String desc)
+ {
+ super(source);
+
+ descr = desc;
+ t = type;
+ }
+}
diff --git a/javax/swing/event/HyperlinkListener.java b/javax/swing/event/HyperlinkListener.java
new file mode 100644
index 000000000..cef46272d
--- /dev/null
+++ b/javax/swing/event/HyperlinkListener.java
@@ -0,0 +1,9 @@
+package javax.swing.event;
+
+import java.util.*;
+
+
+public interface HyperlinkListener extends EventListener
+{
+ void hyperlinkUpdate(HyperlinkEvent e);
+}
diff --git a/javax/swing/event/ListDataEvent.java b/javax/swing/event/ListDataEvent.java
new file mode 100644
index 000000000..4780bae3f
--- /dev/null
+++ b/javax/swing/event/ListDataEvent.java
@@ -0,0 +1,31 @@
+package javax.swing.event;
+
+
+import java.util.EventObject;
+
+
+public class ListDataEvent extends EventObject
+{
+ // Ronald: what does constents change mean ?
+ // the size of the list of the contents of any
+ // of its list items?
+
+ public static final int CONTENTS_CHANGED = 0;
+ public static final int INTERVAL_ADDED = 1;
+ public static final int INTERVAL_REMOVED = 2;
+
+ int type, index0, index1;
+
+ public int getType() { return type; }
+ public int getIndex0() { return index0; }
+ public int getIndex1() { return index1; }
+
+ public ListDataEvent(Object source, int type, int index0, int index1)
+ {
+ super(source);
+
+ this.type = type;
+ this.index0 = index0;
+ this.index1 = index1;
+ }
+}
diff --git a/javax/swing/event/ListDataListener.java b/javax/swing/event/ListDataListener.java
new file mode 100644
index 000000000..7d5dae372
--- /dev/null
+++ b/javax/swing/event/ListDataListener.java
@@ -0,0 +1,11 @@
+package javax.swing.event;
+
+import java.util.EventListener;
+
+
+public interface ListDataListener extends EventListener
+{
+ void intervalAdded(ListDataEvent e);
+ void intervalRemoved(ListDataEvent e);
+ void contentsChanged(ListDataEvent e);
+}
diff --git a/javax/swing/event/ListSelectionEvent.java b/javax/swing/event/ListSelectionEvent.java
new file mode 100644
index 000000000..8889676c4
--- /dev/null
+++ b/javax/swing/event/ListSelectionEvent.java
@@ -0,0 +1,28 @@
+package javax.swing.event;
+
+
+import java.util.*;
+
+
+public class ListSelectionEvent extends EventObject
+{
+ int first, last;
+ boolean adj;
+
+ ListSelectionEvent(Object source,
+ int firstIndex,
+ int lastIndex,
+ boolean isAdjusting)
+ {
+ super(source);
+
+ first = firstIndex;
+ last = lastIndex;
+ adj = isAdjusting;
+ }
+
+ boolean getValueIsAdjusting()
+ {
+ return adj;
+ }
+}
diff --git a/javax/swing/event/ListSelectionListener.java b/javax/swing/event/ListSelectionListener.java
new file mode 100644
index 000000000..7db0c3f27
--- /dev/null
+++ b/javax/swing/event/ListSelectionListener.java
@@ -0,0 +1,9 @@
+package javax.swing.event;
+
+import java.util.*;
+
+
+public interface ListSelectionListener extends EventListener
+{
+ void valueChanged(ListSelectionEvent e);
+}
diff --git a/javax/swing/event/MenuEvent.java b/javax/swing/event/MenuEvent.java
new file mode 100644
index 000000000..5e54a09a0
--- /dev/null
+++ b/javax/swing/event/MenuEvent.java
@@ -0,0 +1,11 @@
+package javax.swing.event;
+
+import java.util.*;
+
+public class MenuEvent extends EventObject
+{
+ MenuEvent(Object src)
+ {
+ super(src);
+ }
+}
diff --git a/javax/swing/event/UndoableEditEvent.java b/javax/swing/event/UndoableEditEvent.java
new file mode 100644
index 000000000..5162204c4
--- /dev/null
+++ b/javax/swing/event/UndoableEditEvent.java
@@ -0,0 +1,22 @@
+package javax.swing.event;
+
+import java.util.*;
+import javax.swing.undo.*;
+
+
+public class UndoableEditEvent extends EventObject
+{
+ UndoableEdit e;
+
+ UndoableEditEvent(Object source, UndoableEdit edit)
+ {
+ super(source);
+ e = edit;
+ }
+
+ UndoableEdit getEdit()
+ {
+ return e;
+ }
+
+}
diff --git a/javax/swing/event/UndoableEditListener.java b/javax/swing/event/UndoableEditListener.java
new file mode 100644
index 000000000..109b772b3
--- /dev/null
+++ b/javax/swing/event/UndoableEditListener.java
@@ -0,0 +1,10 @@
+package javax.swing.event;
+
+import javax.swing.text.*;
+
+
+public interface UndoableEditListener extends EventListener
+{
+ void undoableEditHappened(UndoableEditEvent e);
+}
+
diff --git a/javax/swing/plaf/ButtonUI.java b/javax/swing/plaf/ButtonUI.java
new file mode 100644
index 000000000..74fd19244
--- /dev/null
+++ b/javax/swing/plaf/ButtonUI.java
@@ -0,0 +1,5 @@
+package javax.swing.plaf;
+
+public class ButtonUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/ComponentUI.java b/javax/swing/plaf/ComponentUI.java
new file mode 100644
index 000000000..28684c168
--- /dev/null
+++ b/javax/swing/plaf/ComponentUI.java
@@ -0,0 +1,86 @@
+package javax.swing.plaf;
+
+import java.awt.*;
+import javax.swing.border.*;
+import javax.swing.*;
+
+
+public abstract class ComponentUI
+{
+ boolean contains(JComponent c, int x, int y)
+ {
+ return c.inside(x,y);
+ }
+
+ // this SHOULD thow an error:
+ static ComponentUI createUI(JComponent c)
+ {
+ Exception e = new Exception("createUI from ComponentUI should never be called");
+ e.printStackTrace();
+ System.exit(1);
+ return null;
+ }
+
+ Accessible getAccessibleChild(JComponent c, int i)
+ {
+ //Return the nth Accessible child of the object.
+ return null;
+ }
+
+ int getAccessibleChildrenCount(JComponent c)
+ {
+ //Returns the number of accessible children in the object.
+ return 0;
+ }
+
+ Dimension getMaximumSize(JComponent c)
+ {
+ return getPreferredSize(c);
+ }
+
+ Dimension getMinimumSize(JComponent c)
+ {
+ return getPreferredSize(c);
+ }
+
+ Dimension getPreferredSize(JComponent c)
+ {
+ return null;
+ }
+
+ void installUI(JComponent c)
+ {
+ String id = c.getUIClassID() + ".border";
+
+ Border s = UIManager.getBorder( id );
+
+ if (s != null)
+ {
+ c.setBorder( s );
+ //System.out.println("OK-INSTALL: " + this + ", ID=" + id + ",B="+s);
+ }
+ else
+ {
+ ///System.out.println("FAIL-INSTALL: " + this + ", " + id);
+ }
+ }
+
+ void paint(Graphics g, JComponent c)
+ {
+ // System.out.println("UI-COMPONENT-> unimplemented paint: " + c + ", UI="+this);
+ }
+
+ void uninstallUI(JComponent c)
+ {
+ }
+
+ void update(Graphics g, JComponent c) {
+ if (c.isOpaque()) {
+ g.setColor(c.getBackground());
+ g.fillRect(0, 0, c.getWidth(),c.getHeight());
+ }
+ paint(g, c);
+ }
+
+}
+
diff --git a/javax/swing/plaf/LabelUI.java b/javax/swing/plaf/LabelUI.java
new file mode 100644
index 000000000..759550abd
--- /dev/null
+++ b/javax/swing/plaf/LabelUI.java
@@ -0,0 +1,6 @@
+package javax.swing.plaf;
+
+
+public class LabelUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/ListUI.java b/javax/swing/plaf/ListUI.java
new file mode 100644
index 000000000..69c2396d0
--- /dev/null
+++ b/javax/swing/plaf/ListUI.java
@@ -0,0 +1,6 @@
+package javax.swing.plaf;
+
+
+public class ListUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/OptionPaneUI.java b/javax/swing/plaf/OptionPaneUI.java
new file mode 100644
index 000000000..115b2d716
--- /dev/null
+++ b/javax/swing/plaf/OptionPaneUI.java
@@ -0,0 +1,5 @@
+package javax.swing.plaf;
+
+public class OptionPaneUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/PanelUI.java b/javax/swing/plaf/PanelUI.java
new file mode 100644
index 000000000..b884acec3
--- /dev/null
+++ b/javax/swing/plaf/PanelUI.java
@@ -0,0 +1,6 @@
+package javax.swing.plaf;
+
+
+public class PanelUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/ScrollPaneUI.java b/javax/swing/plaf/ScrollPaneUI.java
new file mode 100644
index 000000000..99df9d234
--- /dev/null
+++ b/javax/swing/plaf/ScrollPaneUI.java
@@ -0,0 +1,6 @@
+package javax.swing.plaf;
+
+
+public class ScrollPaneUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/TabbedPaneUI.java b/javax/swing/plaf/TabbedPaneUI.java
new file mode 100644
index 000000000..6081c6ebc
--- /dev/null
+++ b/javax/swing/plaf/TabbedPaneUI.java
@@ -0,0 +1,23 @@
+package javax.swing.plaf;
+
+import java.awt.*;
+import javax.swing.*;
+
+public class TabbedPaneUI extends ComponentUI
+{
+ Rectangle getTabBounds(JTabbedPane pane, int index)
+ {
+ return null;
+ }
+
+ int getTabRunCount(JTabbedPane pane)
+ {
+ return 0;
+ }
+
+ int tabForCoordinate(JTabbedPane pane, int x, int y)
+ {
+ return 0;
+ }
+}
+
diff --git a/javax/swing/plaf/TextUI.java b/javax/swing/plaf/TextUI.java
new file mode 100644
index 000000000..a035d3f25
--- /dev/null
+++ b/javax/swing/plaf/TextUI.java
@@ -0,0 +1,26 @@
+package javax.swing.plaf;
+
+import javax.swing.text.*;
+import java.awt.*;
+
+public abstract class TextUI extends ComponentUI
+{
+ TextUI()
+ {
+ }
+
+ abstract void damageRange(JTextComponent t, int p0, int p1);
+ abstract void damageRange(JTextComponent t, int p0, int p1, Position.Bias firstBias, Position.Bias secondBias);
+ abstract EditorKit getEditorKit(JTextComponent t);
+ abstract int getNextVisualPositionFrom(JTextComponent t,
+ int pos,
+ Position.Bias b,
+ int direction,
+ Position.Bias[] biasRet);
+ abstract View getRootView(JTextComponent t);
+ abstract Rectangle modelToView(JTextComponent t, int pos);
+ abstract Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias);
+ abstract int viewToModel(JTextComponent t, Point pt);
+ abstract int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn);
+
+}
diff --git a/javax/swing/plaf/TreeUI.java b/javax/swing/plaf/TreeUI.java
new file mode 100644
index 000000000..48323750d
--- /dev/null
+++ b/javax/swing/plaf/TreeUI.java
@@ -0,0 +1,6 @@
+package javax.swing.plaf;
+
+
+public class TreeUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/ViewportUI.java b/javax/swing/plaf/ViewportUI.java
new file mode 100644
index 000000000..556297391
--- /dev/null
+++ b/javax/swing/plaf/ViewportUI.java
@@ -0,0 +1,6 @@
+package javax.swing.plaf;
+
+
+public class ViewportUI extends ComponentUI
+{
+}
diff --git a/javax/swing/plaf/basic/BasicButtonUI.java b/javax/swing/plaf/basic/BasicButtonUI.java
new file mode 100644
index 000000000..3a9f462a2
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicButtonUI.java
@@ -0,0 +1,176 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+
+
+public class BasicButtonUI extends ButtonUI
+{
+ int gap = 3;
+ // int y_text_space = 2, x_text_space + 5;
+
+ Color textColor, disabledTextColor;
+ Color pressedBackgroundColor;
+ Color normalBackgroundColor;
+
+ public static ComponentUI createUI(final JComponent c)
+ {
+ return new BasicButtonUI();
+ }
+
+
+ public void installUI(final JComponent c)
+ {
+ super.installUI(c);
+
+ textColor = new Color(0,0,0);
+ disabledTextColor = new Color(130, 130, 130);
+ pressedBackgroundColor = new Color(150,150,150);
+ pressedBackgroundColor = new Color(150,150,150);
+ normalBackgroundColor = new Color(192,192,192);
+ }
+
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ AbstractButton b = (AbstractButton)c;
+ Dimension d = BasicGraphicsUtils.getPreferredSize(b,
+ gap,
+ b.text,
+ b.getIcon(),
+ b.vert_align,
+ b.hori_align,
+ b.hori_text_pos,
+ b.vert_text_pos);
+ // System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
+ return d;
+ }
+
+
+ void paint(Graphics g, JComponent c)
+ {
+ AbstractButton b = (AbstractButton) c;
+
+ Rectangle tr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle vr = new Rectangle();
+
+ Font f = c.getFont();
+
+ g.setFont(f);
+
+ FontMetrics fm = FontMetrics.getFontMetrics(f);
+
+ Insets i = c.getInsets();
+
+ vr.x = i.left;
+ vr.y = i.top;
+ vr.width = b.getWidth() - (i.right + vr.x);
+ vr.height = b.getHeight() - (i.bottom + vr.y);
+
+ //System.out.println(" VIEW-RECT-BUTTON="+vr+", insets="+i+", FONTM="+fm);
+
+ String text = SwingUtilities.layoutCompoundLabel(c,
+ fm,
+ b.getText(),
+ b.getIcon(),
+ b.getVerticalAlignment(),
+ b.getHorizontalAlignment(),
+ b.getVerticalTextPosition(),
+ b.getHorizontalTextPosition(),
+ vr,
+ ir,
+ tr,
+ gap);
+
+ if (b.getModel().isPressed() ||
+ b.getModel().isSelected())
+ {
+ //System.out.println("paint pressed");
+ paintButtonPressed(g, c);
+ }
+ else
+ {
+ //System.out.println("paint normal");
+ paintButtonNormal(g, c);
+ }
+
+ paintIcon(g, c, ir);
+ paintText(g, c, tr, b.text);
+ paintFocus(g, c, vr, tr, ir);
+ }
+
+
+ protected void paintFocus(Graphics g,
+ JComponent c,
+ Rectangle vr,
+ Rectangle tr,
+ Rectangle ir)
+ {
+ }
+
+ protected void paintIcon(Graphics g,
+ JComponent c,
+ Rectangle iconRect)
+ {
+ AbstractButton b = (AbstractButton) c;
+ if (b.default_icon != null)
+ {
+ int x = iconRect.x;
+ int y = iconRect.y;
+
+ System.out.println("WE HAVE AN ICON: " + b.default_icon);
+
+ b.default_icon.paintIcon(c, g, x, y);
+ }
+ else
+ {
+ //System.out.println("NO ICON FOR BUTTON:" + b.text);
+ }
+ }
+
+ protected void paintButtonPressed(Graphics g,
+ JComponent b)
+ {
+ Dimension size = b.getSize();
+
+ g.setColor(pressedBackgroundColor);
+ g.fillRect(1,1,size.width-2, size.height-2);
+
+ }
+
+ protected void paintButtonNormal(Graphics g,
+ JComponent b)
+ {
+ Dimension size = b.getSize();
+
+ g.setColor(normalBackgroundColor);
+ g.fillRect(1,1,size.width-2, size.height-2);
+
+ }
+
+ protected void paintText(Graphics g,
+ JComponent c,
+ Rectangle textRect,
+ String text)
+ {
+ Font f = c.getFont();
+
+ g.setFont(f);
+
+ FontMetrics fm = FontMetrics.getFontMetrics(f);
+
+ g.setColor(c.isEnabled() ? textColor : disabledTextColor);
+
+ BasicGraphicsUtils.drawString(g,
+ text,
+ 0,
+ textRect.x,
+ textRect.y + fm.getAscent()/2);
+ }
+}
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicCheckBoxUI.java b/javax/swing/plaf/basic/BasicCheckBoxUI.java
new file mode 100644
index 000000000..2ad18888a
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicCheckBoxUI.java
@@ -0,0 +1,87 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+
+
+public class BasicCheckBoxUI extends BasicRadioButtonUI
+{
+ public static ComponentUI createUI(final JComponent c) {
+ return new BasicCheckBoxUI();
+ }
+
+
+ public void installUI(final JComponent c) {
+ super.installUI(c);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ AbstractButton b = (AbstractButton)c;
+ Dimension d = BasicGraphicsUtils.getPreferredSize(b,
+ gap,
+ b.text,
+ b.getIcon(),
+ b.vert_align,
+ b.hori_align,
+ b.hori_text_pos,
+ b.vert_text_pos);
+ //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
+ return d;
+ }
+
+ protected void paintFocus(Graphics g,
+ JComponent c,
+ Rectangle vr,
+ Rectangle tr,
+ Rectangle ir)
+ {
+ }
+
+ protected void paintIcon(Graphics g,
+ JComponent c,
+ Rectangle iconRect)
+ {
+ }
+
+ protected void paintButtonPressed(Graphics g,
+ JComponent b)
+ {
+ Dimension size = b.getSize();
+
+ g.setColor(pressedBackgroundColor);
+ g.fillRect(1,1,size.width-2, size.height-2);
+
+ }
+
+ protected void paintButtonNormal(Graphics g,
+ JComponent b)
+ {
+ Dimension size = b.getSize();
+
+ g.setColor(normalBackgroundColor);
+ g.fillRect(1,1,size.width-2, size.height-2);
+
+ }
+ protected void paintText(Graphics g,
+ JComponent c,
+ Rectangle textRect,
+ String text)
+ {
+ // AbstractButton b = (AbstractButton) c;
+
+ // System.out.println("drawing string: " + text + ", at:" + textRect);
+
+ g.setColor(textColor);
+ BasicGraphicsUtils.drawString(g,
+ text,
+ 0,
+ textRect.x,
+ textRect.y);
+ }
+}
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicDefaults.java b/javax/swing/plaf/basic/BasicDefaults.java
new file mode 100644
index 000000000..d2ca5432a
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicDefaults.java
@@ -0,0 +1,81 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import java.awt.*;
+import javax.swing.border.*;
+
+class BasicBorder extends MatteBorder
+{
+ BasicBorder()
+ {
+ super(5,5,5,5, null);
+ }
+
+ public void paintBorder(Component c,
+ Graphics g,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ // System.out.println("PAINT-------------------------------------------BORDER");
+
+ if (g != null)
+ {
+ g.setColor( Defaults.BtnPointClr);
+ g.draw3DRect( 0, 0, width-1, height-1, true);
+ }
+ }
+ }
+
+class PanelBorder extends MatteBorder
+{
+ PanelBorder()
+ {
+ super(5,5,5,5, null);
+ }
+
+ public void paintBorder(Component c,
+ Graphics g,
+ int x,
+ int y,
+ int width,
+ int height)
+ {
+ // System.out.println("PAINT-------------------------------------------BORDER");
+ super.paintBorder(c, g, x, y, width, height);
+ }
+ }
+
+public class BasicDefaults extends UIDefaults
+{
+
+ BasicDefaults()
+ {
+ // System.out.println("BasicDefaults !!!!!!!!!!!!!!!!!!!!!!!!!");
+ put("JButton", new BasicButtonUI());
+ put("JLabel", new BasicLabelUI());
+
+ put("JPanel", new BasicPanelUI());
+ put("JCheckBox", new BasicCheckBoxUI());
+ put("JRadioButton", new BasicRadioButtonUI());
+ put("JToggleButton", new BasicToggleButtonUI());
+ put("JOptionPane", new BasicOptionPaneUI());
+ put("JList", new BasicListUI());
+ put("JTree", new BasicTreeUI());
+ put("JTextComponent", new BasicTextUI());
+ put("JTabbedPane", new BasicTabbedPaneUI());
+ put("JScrollPane", new BasicScrollPaneUI());
+ put("JViewport", new BasicViewportUI());
+
+ put("JButton.border", new BasicBorder());
+ put("JPanel.border", new PanelBorder());
+
+ put("JToggleButton.border", new PanelBorder());
+ put("JCheckBox.border", new PanelBorder());
+ put("JRadioButton.border", new PanelBorder());
+ }
+
+}
+
+
diff --git a/javax/swing/plaf/basic/BasicGraphicsUtils.java b/javax/swing/plaf/basic/BasicGraphicsUtils.java
new file mode 100644
index 000000000..52f7c5c44
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -0,0 +1,77 @@
+package javax.swing.plaf.basic;
+
+
+import java.awt.*;
+import javax.swing.*;
+
+
+public class BasicGraphicsUtils
+{
+ public static Dimension getPreferredSize(JComponent b,
+ int gap,
+ String text,
+ Icon icon,
+ int va,
+ int ha,
+ int htp,
+ int vtp)
+ {
+ JComponent c = b;
+ // this is a staight copy from BasicButtonUI.paint()
+ //
+ Rectangle tr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle vr = new Rectangle();
+
+ Font f = c.getFont();
+
+ FontMetrics fm = FontMetrics.getFontMetrics(f);
+
+ Insets i = c.getInsets();
+
+ vr.x = i.left;
+ vr.y = i.top;
+ vr.width = b.getWidth() - (i.right + i.left);
+ vr.height = b.getHeight() - (i.bottom + i.top);
+
+ // System.out.println(" VIEW-RECT-BUTTON="+vr+", insets="+i);
+
+ String tt = SwingUtilities.layoutCompoundLabel(b,
+ fm,
+ text,
+ icon,
+ va,
+ ha,
+ vtp,
+ htp,
+ vr,
+ ir,
+ tr,
+ gap);
+
+ Rectangle r = ir.union(tr);
+
+ Insets insets = b.getInsets();
+ r.width += insets.left + insets.right;
+ r.height += insets.top + insets.bottom;
+
+ // System.out.println("COMPUTED SIZE FOR PREF_SIZE="+r);
+
+ return r.getSize();
+ }
+
+ public static void drawString(Graphics g,
+ String text,
+ int underlinedChar,
+ int x,
+ int y)
+ {
+ g.drawString(text, x, y);
+ }
+}
+
+
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicLabelUI.java b/javax/swing/plaf/basic/BasicLabelUI.java
new file mode 100644
index 000000000..b92290a12
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicLabelUI.java
@@ -0,0 +1,158 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+
+
+public class BasicLabelUI extends LabelUI
+{
+ int gap = 3;
+
+ Color foreground;
+
+
+ public static ComponentUI createUI(final JComponent c) {
+ return new BasicLabelUI();
+ }
+
+
+ public void installUI(final JComponent c) {
+ super.installUI(c);
+
+ foreground = new Color(0,0,250);
+ }
+
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ JLabel b = (JLabel)c;
+ Dimension d = BasicGraphicsUtils.getPreferredSize(b,
+ gap,
+ b.text,
+ b.icon,
+ b.vert_align,
+ b.hor_align,
+ b.hor_text_pos,
+ b.vert_text_pos);
+ System.out.println("JLABEL->^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
+ return d;
+ }
+
+
+ void paint(Graphics g, JComponent c)
+ {
+ JLabel b = (JLabel) c;
+
+ Rectangle tr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle vr = new Rectangle();
+
+ Font f = c.getFont();
+
+ g.setFont(f);
+
+ FontMetrics fm = FontMetrics.getFontMetrics(f);
+
+ Insets i = c.getInsets();
+
+ Rectangle bound = c.getBounds();
+
+ System.out.println("BOUND=" + bound + ", insets = " + i + ", " + b.text);
+
+ if (bound == null)
+ {
+ vr.x = i.left;
+ vr.y = i.top;
+ vr.width = b.getWidth() - (i.right + i.left);
+ vr.height = b.getHeight() - (i.bottom + i.top);
+ }
+ else
+ {
+ vr.x = bound.x + i.left;
+ vr.y = bound.y + i.top;
+ vr.width = bound.width - (i.right + i.left);
+ vr.height = bound.height - (i.bottom + i.top);
+ }
+
+ System.out.println(" VIEW-RECT-JLABEL="+vr+", insets="+i+", FONTM="+fm);
+
+ String text = SwingUtilities.layoutCompoundLabel(c,
+ fm,
+ b.getText(),
+ b.getIcon(),
+ b.getVerticalAlignment(),
+ b.getHorizontalAlignment(),
+ b.getVerticalTextPosition(),
+ b.getHorizontalTextPosition(),
+ vr,
+ ir,
+ tr,
+ gap);
+
+ paintIcon(g, c, ir);
+ paintText(g, c, tr, b.text);
+ paintFocus(g, c, vr, tr, ir);
+ }
+
+
+ protected void paintFocus(Graphics g,
+ JComponent c,
+ Rectangle vr,
+ Rectangle tr,
+ Rectangle ir)
+ {
+ }
+
+ protected void paintIcon(Graphics g,
+ JComponent c,
+ Rectangle iconRect)
+ {
+ JLabel b = (JLabel) c;
+ if (b.icon != null)
+ {
+ int x = iconRect.x;
+ int y = iconRect.y;
+
+ System.out.println("WE HAVE AN ICON: " + b.icon);
+
+ b.icon.paintIcon(c, g, x, y);
+ }
+ else
+ {
+ //System.out.println("NO ICON FOR BUTTON:" + b.text);
+ }
+ }
+
+
+ protected void paintText(Graphics g,
+ JComponent c,
+ Rectangle textRect,
+ String text)
+ {
+ // AbstractLabel b = (AbstractLabel) c;
+
+ System.out.println("JLabel: drawing string: " + text + ", at:" + textRect);
+
+ g.setColor(foreground);
+ g.setBackColor(new Color(190,190,190));
+
+ g.drawLine(0,0,100,100);
+
+ BasicGraphicsUtils.drawString(g,
+ text,
+ 0,
+ 0,//textRect.x,
+ 0);//textRect.y);
+ }
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicListUI.java b/javax/swing/plaf/basic/BasicListUI.java
new file mode 100644
index 000000000..b1db19510
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicListUI.java
@@ -0,0 +1,132 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.plaf.*;
+import javax.swing.*;
+import java.awt.*;
+
+
+public class BasicListUI extends ListUI
+{
+ int gap_between_cells;
+ Color textColor, disabledTextColor, pressedBackgroundColor, normalBackgroundColor;
+
+
+ public static ComponentUI createUI(final JComponent c)
+ {
+ return new BasicButtonUI();
+ }
+
+
+ public void installUI(final JComponent c)
+ {
+ super.installUI(c);
+
+ textColor = new Color(0,0,0);
+ disabledTextColor = new Color(130, 130, 130);
+ pressedBackgroundColor = new Color(150,150,150);
+ normalBackgroundColor = new Color(192,192,192);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ JList l = (JList) c;
+
+ System.out.println("XXXXXXXXXXXXXXXxx getPreferredSize------------> " + l);
+
+
+ int rows = l.getVisibleRowCount();
+
+ ListCellRenderer render = l.getCellRenderer();
+
+ int width = 200;
+ int height = rows * 16;
+
+ if (l.getModel().getSize() == 0)
+ {
+ return new Dimension(width, height);
+ }
+
+ System.out.println("BASIC_LIST_UI ====-> " + l.getModel().getElementAt(0));
+
+ Component elt = render.getListCellRendererComponent(l,
+ l.getModel().getElementAt(0),
+ 0,
+ false,
+ false);
+ Dimension a = elt.getPreferredSize();
+ if (a == null)
+ {
+ return new Dimension(width, height);
+ }
+
+ return new Dimension(a.width,
+ a.height * rows);
+ }
+
+ void paintBackground(Graphics g,
+ JComponent c)
+ {
+ Dimension size = getPreferredSize(c);
+
+ g.setColor(normalBackgroundColor);
+ g.fillRect(0,0,size.width, size.height);
+ }
+
+ void paint(Graphics g,
+ JComponent c)
+ {
+ JList l = (JList) c;
+
+ int rows = l.getVisibleRowCount();
+
+ ListCellRenderer render = l.getCellRenderer();
+
+ System.out.println("RENDER-JLIST: " + rows + ", " + l.getModel().getSize());
+
+ paintBackground(g, c);
+
+ if (l.getModel().getSize() == 0)
+ return;
+
+ // use element 0 to figure out how big we are:
+ Component elt = render.getListCellRendererComponent(l,
+ l.getModel().getElementAt(0),
+ 0,
+ false,
+ false);
+ Dimension dim = elt.getPreferredSize();
+
+ Rectangle a = new Rectangle(0,
+ 0,
+ dim.width,
+ dim.height);
+
+ for (int i=0;i<l.getModel().getSize();i++)
+ {
+ boolean is_sel = false;
+ boolean has_focus = false;
+
+ Component comp = render.getListCellRendererComponent(l,
+ l.getModel().getElementAt(i),
+ i,
+ is_sel,
+ has_focus);
+
+ //System.out.println("AAAAA=> " + a + ", " + comp + ", index = " + i);
+
+ comp.setBounds(a);
+
+ comp.paint(g);
+
+ a.y += dim.height + gap_between_cells;
+ }
+ }
+}
+
+
+
+
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicOptionPaneUI.java b/javax/swing/plaf/basic/BasicOptionPaneUI.java
new file mode 100644
index 000000000..c4d1d3e79
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -0,0 +1,103 @@
+package javax.swing.plaf.basic;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.plaf.*;
+
+
+public class BasicOptionPaneUI extends OptionPaneUI
+{
+ JOptionPane pane;
+
+ BasicOptionPaneUI()
+ {
+ }
+
+ public static ComponentUI createUI(JComponent x)
+ {
+ return new BasicOptionPaneUI();
+ }
+
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ pane = (JOptionPane)c;
+
+ System.out.println(" -------------: " + pane);
+
+ JLabel message = pane.msg != null ? new JLabel(pane.msg) : null;
+ JButton ok_button = new JButton("Ok");
+
+ ok_button.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent a)
+ {
+ System.out.println("ACTION ---> " + a);
+ // pane.dialog.dispose();
+
+ if (pane.dialog.isModal())
+ {
+ System.out.println("modal dialog !!");
+ pane.dialog.setModal(false);
+ }
+ pane.dialog.setVisible(false);
+ }
+ });
+
+ if (pane.args != null)
+ {
+ for (int i=0; i<pane.args.length; i++)
+ {
+ Object o = pane.args[i];
+ if (o != null)
+ {
+ if (o instanceof String)
+ {
+ String s = (String) o;
+ JLabel m = new JLabel(s);
+ pane.add(m);
+ }
+ else if (o instanceof Component)
+ {
+ Component com = (Component) o;
+ pane.add(com);
+ }
+ else
+ {
+ System.out.println("UNRECOGNIZED ARG: " + o);
+ }
+ }
+ }
+ }
+
+ pane.add(message);
+ pane.add(ok_button);
+ }
+
+ Dimension getMinimumOptionPaneSize()
+ {
+ return new Dimension(300,100);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ if (c == null)
+ return getMinimumOptionPaneSize();
+
+ if (c != pane)
+ return null;
+
+ LayoutManager l = c.getLayout();
+ if (l == null)
+ return getMinimumOptionPaneSize();
+
+ Dimension d1 = l.preferredLayoutSize(c);
+ Dimension d2 = getMinimumOptionPaneSize();
+
+ d1.width = Math.max(d1.width, d2.width);
+ d1.height = Math.max(d1.height, d2.height);
+
+ return d2;
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicPanelUI.java b/javax/swing/plaf/basic/BasicPanelUI.java
new file mode 100644
index 000000000..5976bd2a1
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicPanelUI.java
@@ -0,0 +1,21 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+
+
+public class BasicPanelUI extends PanelUI
+{
+ int gap = 3;
+
+ public static ComponentUI createUI(JComponent x)
+ {
+ return new BasicPanelUI();
+ }
+
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicRadioButtonUI.java b/javax/swing/plaf/basic/BasicRadioButtonUI.java
new file mode 100644
index 000000000..312ae0bf0
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicRadioButtonUI.java
@@ -0,0 +1,126 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+
+
+public class BasicRadioButtonUI extends BasicToggleButtonUI
+{
+ int large_circle_width = 20;
+ int circle_width = large_circle_width - 8; // FIXME: sun == ?
+
+ public static ComponentUI createUI(final JComponent c) {
+ return new BasicRadioButtonUI();
+ }
+
+
+ public void installUI(final JComponent c) {
+ super.installUI(c);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ AbstractButton b = (AbstractButton)c;
+ Dimension d = BasicGraphicsUtils.getPreferredSize(b,
+ gap,
+ b.text,
+ b.getIcon(),
+ b.vert_align,
+ b.hori_align,
+ b.hori_text_pos,
+ b.vert_text_pos);
+ // and add a little something for the circles:
+
+ d.width += large_circle_width;
+ d.height = Math.max(large_circle_width, d.height);
+
+ //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
+ return d;
+ }
+
+ protected void paintFocus(Graphics g,
+ JComponent c,
+ Rectangle vr,
+ Rectangle tr,
+ Rectangle ir)
+ {
+ }
+
+ protected void paintIcon(Graphics g,
+ JComponent c,
+ Rectangle iconRect)
+ {
+ }
+
+ protected void paintButtonPressed(Graphics g,
+ JComponent b)
+ {
+ Dimension size = b.getSize();
+
+ paintButtonNormal(g, b);
+
+ int x = gap;
+ int y = gap;
+
+ int diffp = 2;
+ int diff = 3;
+
+ g.setColor(textColor);
+ g.fillArc(x+diffp, y+diffp,
+ circle_width-diff, circle_width-diff,
+ 0, 360);
+ }
+
+ protected void paintButtonNormal(Graphics g,
+ JComponent c)
+ {
+ AbstractButton b = (AbstractButton) c;
+
+ Dimension size = b.getSize();
+
+ g.setColor(normalBackgroundColor);
+ g.fillRect(1,1,size.width-2, size.height-2);
+
+ int x = gap;
+ int y = gap;
+
+ g.setColor(pressedBackgroundColor);
+ g.drawArc(x, y,
+ circle_width, circle_width,
+ 0, 360);
+
+ g.setColor(new Color(255,255,255));
+ g.drawArc(x, y,
+ circle_width+1, circle_width+1,
+ 145, 160);
+ }
+
+ protected void paintText(Graphics g,
+ JComponent c,
+ Rectangle textRect,
+ String text)
+ {
+ // AbstractButton b = (AbstractButton) c;
+
+ //System.out.println("drawing string: " + text + ", " + c.isEnabled());
+
+ g.setColor(c.isEnabled() ? textColor : disabledTextColor);
+
+ BasicGraphicsUtils.drawString(g,
+ text,
+ 0,
+ textRect.x + circle_width + gap,
+ textRect.y);
+ }
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicScrollPaneUI.java b/javax/swing/plaf/basic/BasicScrollPaneUI.java
new file mode 100644
index 000000000..5b274220c
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicScrollPaneUI.java
@@ -0,0 +1,66 @@
+package javax.swing.plaf.basic;
+
+
+import javax.swing.plaf.*;
+import javax.swing.*;
+import java.awt.*;
+
+
+
+public class BasicScrollPaneUI extends ScrollPaneUI
+{
+ int min_w = 50;
+ int min_h = 50;
+
+ public static ComponentUI createUI(final JComponent c)
+ {
+ return new BasicScrollPaneUI();
+ }
+
+
+ public void installUI(final JComponent c)
+ {
+ super.installUI(c);
+ }
+
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ JScrollPane p = (JScrollPane ) c;
+
+ Dimension d = new Dimension(min_w,
+ min_h);
+
+ Dimension a = p.getViewport().getPreferredSize();
+
+ if (a != null)
+ {
+ d.width = Math.max(d.width, a.width);
+ d.height = Math.max(d.height, a.height);
+ }
+
+
+ System.out.println("BasicScrollPaneUI->preff->"+d);
+ return d;
+ }
+
+ void paint(Graphics g, JComponent c)
+ {
+ System.out.println("BasicScrollPaneUI->paint()->"+c);
+
+ JScrollPane p = (JScrollPane ) c;
+ p.getViewport().paint(g);
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/javax/swing/plaf/basic/BasicTabbedPaneUI.java
new file mode 100644
index 000000000..f9134a8ce
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -0,0 +1,64 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import java.awt.*;
+import javax.swing.plaf.*;
+
+public class BasicTabbedPaneUI extends TabbedPaneUI
+{
+ public static ComponentUI createUI(final JComponent c)
+ {
+ return new BasicTabbedPaneUI();
+ }
+
+ public void installUI(final JComponent c)
+ {
+ super.installUI(c);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ JTabbedPane p = (JTabbedPane) c;
+
+ Dimension d = new Dimension(50,50);
+
+ for (int i=0;i<p.getTabCount();i++)
+ {
+ Component comp = p.getComponentAt(i);
+
+ Dimension pr = comp.getPreferredSize();
+
+ d.width = Math.max(d.width, comp.width);
+ d.height = Math.max(d.height, comp.height);
+ }
+
+ Insets i = p.getInsets();
+
+ d.width += i.left + i.right;
+ d.height += i.top + i.bottom;
+
+ int height_of_tabs = 25;
+
+ d.height += height_of_tabs;
+
+ // FIXME: should be max of panes in p
+ return d;
+ }
+
+
+ Rectangle getTabBounds(JTabbedPane pane, int index)
+ {
+ return null;
+ }
+
+ int getTabRunCount(JTabbedPane pane)
+ {
+ return 0;
+ }
+
+ int tabForCoordinate(JTabbedPane pane, int x, int y)
+ {
+ return 0;
+ }
+}
+
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;
+ }
+}
+
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicToggleButtonUI.java b/javax/swing/plaf/basic/BasicToggleButtonUI.java
new file mode 100644
index 000000000..3e181ca8a
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicToggleButtonUI.java
@@ -0,0 +1,89 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.*;
+import javax.swing.plaf.*;
+import java.awt.*;
+
+
+public class BasicToggleButtonUI extends BasicButtonUI
+{
+
+ public static ComponentUI createUI(final JComponent c) {
+ return new BasicToggleButtonUI();
+ }
+
+
+ public void installUI(final JComponent c) {
+ super.installUI(c);
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ AbstractButton b = (AbstractButton)c;
+ Dimension d = BasicGraphicsUtils.getPreferredSize(b,
+ gap,
+ b.text,
+ b.getIcon(),
+ b.vert_align,
+ b.hori_align,
+ b.hori_text_pos,
+ b.vert_text_pos);
+ //System.out.println("^^^^^^^^^^^^^^^^^^^^^^ BASIC-PREF="+d + ",T="+b.text);
+ return d;
+ }
+
+ protected void paintFocus(Graphics g,
+ JComponent c,
+ Rectangle vr,
+ Rectangle tr,
+ Rectangle ir)
+ {
+ }
+
+ protected void paintIcon(Graphics g,
+ JComponent c,
+ Rectangle iconRect)
+ {
+ }
+
+ protected void paintButtonPressed(Graphics g,
+ JComponent b)
+ {
+ Dimension size = b.getSize();
+
+ g.setColor(pressedBackgroundColor);
+ g.fillRect(1,1,size.width-2, size.height-2);
+
+ }
+
+ protected void paintButtonNormal(Graphics g,
+ JComponent b)
+ {
+ Dimension size = b.getSize();
+
+ g.setColor(normalBackgroundColor);
+ g.fillRect(1,1,size.width-2, size.height-2);
+
+ }
+ protected void paintText(Graphics g,
+ JComponent c,
+ Rectangle textRect,
+ String text)
+ {
+ // AbstractButton b = (AbstractButton) c;
+
+ // System.out.println("drawing string: " + text + ", at:" + textRect);
+
+ g.setColor(textColor);
+
+ BasicGraphicsUtils.drawString(g,
+ text,
+ 0,
+ textRect.x,
+ textRect.y);
+ }
+}
+
+
+
+
diff --git a/javax/swing/plaf/basic/BasicTreeUI.java b/javax/swing/plaf/basic/BasicTreeUI.java
new file mode 100644
index 000000000..1f4f2a8b2
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicTreeUI.java
@@ -0,0 +1,7 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.plaf.*;
+
+public class BasicTreeUI extends TreeUI
+{
+}
diff --git a/javax/swing/plaf/basic/BasicViewportUI.java b/javax/swing/plaf/basic/BasicViewportUI.java
new file mode 100644
index 000000000..d399cc7a9
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicViewportUI.java
@@ -0,0 +1,33 @@
+package javax.swing.plaf.basic;
+
+import javax.swing.plaf.*;
+import javax.swing.*;
+import java.awt.*;
+
+public class BasicViewportUI extends ViewportUI
+{
+
+ public static ComponentUI createUI(final JComponent c)
+ {
+ return new BasicViewportUI();
+ }
+
+
+ public void installUI(final JComponent c)
+ {
+ super.installUI(c);
+ }
+
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ Dimension d = new Dimension(100,100);
+ System.out.println("BasicViewportUI->preff->"+d);
+ return d;
+ }
+
+ void paint(Graphics g, JComponent c)
+ {
+ System.out.println("BasicViewportUI->paint->"+c);
+ }
+}
diff --git a/javax/swing/plaf/metal/MetalLookAndFeel.java b/javax/swing/plaf/metal/MetalLookAndFeel.java
new file mode 100644
index 000000000..cc85babef
--- /dev/null
+++ b/javax/swing/plaf/metal/MetalLookAndFeel.java
@@ -0,0 +1,31 @@
+package javax.swing.plaf.metal;
+
+import javax.swing.*;
+import javax.swing.plaf.*;
+import javax.swing.plaf.basic.*;
+
+
+public class MetalLookAndFeel extends LookAndFeel
+ {
+ boolean isNativeLookAndFeel() { return true; }
+ boolean isSupportedLookAndFeel() { return true; }
+ String getDescription() { return "Metal look and feel"; }
+ String getID() { return "MetalLookAndFeel"; }
+ String getName() { return "MetalLookAndFeel"; }
+
+
+ UIDefaults LAF_defaults;
+
+ MetalLookAndFeel()
+ {
+ }
+
+ UIDefaults getDefaults()
+ {
+ if (LAF_defaults == null)
+ LAF_defaults = new BasicDefaults();
+
+ // Returns the default values for this look and feel.
+ return LAF_defaults;
+ }
+ };
diff --git a/javax/swing/text/AbstractDocument.java b/javax/swing/text/AbstractDocument.java
new file mode 100644
index 000000000..ddb2c6b36
--- /dev/null
+++ b/javax/swing/text/AbstractDocument.java
@@ -0,0 +1,323 @@
+package javax.swing.text;
+
+import javax.swing.event.*;
+import javax.swing.undo.*;
+import java.util.*;
+import javax.swing.tree.*;
+
+public abstract class AbstractDocument implements Document
+{
+ Vector doc_list = new Vector();
+ Vector undo_list = new Vector();
+
+ // these still need to be implemented by a derived class:
+ public abstract Element getParagraphElement(int pos);
+ public abstract Element getDefaultRootElement();
+
+ // some inner classes sun says I should have:
+ abstract class AbstractElement implements Element, TreeNode
+ {
+ int count, offset;
+ AttributeSet attr;
+ Vector elts = new Vector();
+ String name;
+ Element parent;
+ Vector kids = new Vector();
+ TreeNode tree_parent;
+
+ AbstractElement(Element p, AttributeSet s)
+ { parent = p; attr = s; }
+
+ public Enumeration children() { return kids.elements(); }
+ public boolean getAllowsChildren() { return true; }
+ public TreeNode getChildAt(int index) { return (TreeNode) kids.elementAt(index); }
+ public int getChildCount() { return kids.size(); }
+ public int getIndex(TreeNode node) { return kids.indexOf(node); }
+ public TreeNode getParent() { return tree_parent; }
+
+ public AttributeSet getAttributes() { return attr; }
+ public Document getDocument() { return AbstractDocument.this; }
+ public Element getElement(int index) { return elts.elementAt(index); }
+ public String getName() { return name; }
+ public Element getParentElement() { return parent; }
+
+ public abstract boolean isLeaf();
+ public abstract int getEndOffset();
+ public abstract int getElementCount();
+ public abstract int getElementIndex(int offset);
+ public abstract int getStartOffset();
+ }
+
+ interface AttributeContext
+ {
+ }
+
+
+ static class BranchElement extends AbstractElement
+ {
+ BranchElement(Element e, AttributeSet a, int s, int end)
+ { super(e, a); }
+
+ public boolean isLeaf() { return false; }
+ public int getEndOffset() { return 0; }
+ public int getElementCount() { return 0; }
+ public int getElementIndex(int offset) { return 0; }
+ public int getStartOffset() { return 0; }
+ }
+
+ public interface Content
+ {
+ public Position createPosition(int offset) throws BadLocationException;
+ public int length();
+ public UndoableEdit insertString(int where, String str) throws BadLocationException;
+ public UndoableEdit remove(int where, int nitems) throws BadLocationException;
+ public String getString(int where, int len) throws BadLocationException;
+ public void getChars(int where, int len, Segment txt) throws BadLocationException;
+ }
+
+ class DefaultDocumentEvent implements DocumentEvent
+ {
+ int len, off;
+ public Document getDocument() { return AbstractDocument.this; }
+ public int getLength() { return len; }
+ public int getOffset() { return off; }
+ public DocumentEvent.EventType getType() { return null; }
+ public DocumentEvent.ElementChange getChange(Element elem) { return null; }
+ }
+
+ static class ElementEdit
+ {
+ }
+
+ class LeafElement extends AbstractElement
+ {
+ LeafElement(Element e, AttributeSet a, int s, int end)
+ { super(e, a); }
+
+ public boolean isLeaf() { return true; }
+ public int getEndOffset() { return 0; }
+ public int getElementCount() { return 0; }
+ public int getElementIndex(int offset) { return 0; }
+ public int getStartOffset() { return 0; }
+ }
+
+
+ Content content;
+
+ AbstractDocument(Content doc)
+ {
+ content = doc;
+ }
+
+ /********************************************************
+ *
+ * the meat:
+ *
+ ***********/
+
+
+ public void addDocumentListener(DocumentListener listener)
+ {
+ doc_list.addElement(listener);
+ }
+
+ public void addUndoableEditListener(UndoableEditListener listener)
+ {
+ undo_list.addElement(listener);
+ }
+
+ protected Element createBranchElement(Element parent, AttributeSet a)
+ {
+ return new BranchElement(parent, a, 0, 0);
+ }
+
+ protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1)
+ {
+ return new LeafElement(parent, a, p0, p1-p0);
+ }
+
+ public Position createPosition(int offs)
+ {
+ final int a = offs;
+ return new Position()
+ {
+ public int getOffset()
+ {
+ return a;
+ }
+ };
+ }
+
+ protected void fireChangedUpdate(DocumentEvent e)
+ {
+ }
+
+ protected void fireInsertUpdate(DocumentEvent e)
+ {
+ }
+
+ protected void fireRemoveUpdate(DocumentEvent e)
+ {
+ }
+
+ protected void fireUndoableEditUpdate(UndoableEditEvent e)
+ {
+ }
+ int getAsynchronousLoadPriority()
+ {
+ return 0;
+ }
+
+ protected AttributeContext getAttributeContext()
+ {
+ return null;
+ }
+
+ Element getBidiRootElement()
+ {
+ return null;
+ }
+
+ protected Content getContent()
+ {
+ return content;
+ }
+
+ protected Thread getCurrentWriter()
+ {
+ return null;
+ }
+
+
+ Dictionary getDocumentProperties()
+ {
+ return null;
+ }
+
+ public Position getEndPosition()
+ {
+ return null;
+ }
+
+ public int getLength()
+ {
+ return content.length();
+ }
+
+ EventListener[] getListeners(Class listenerType)
+ {
+ return null;
+ }
+
+ public Object getProperty(Object key)
+ {
+ return null;
+ }
+
+ public Element[] getRootElements()
+ {
+ return null;
+ }
+
+ public Position getStartPosition()
+ {
+ return null;
+ }
+
+ public String getText(int offset, int length)
+ {
+ try {
+ return content.getString(offset, length);
+ } catch (Exception e) {
+ System.out.println("Hmmm, fail to getText: " + offset + " -> " + length);
+ return null;
+ }
+ }
+
+ public void getText(int offset, int length, Segment txt)
+ {
+ String a = getText(offset, length);
+
+ if (a == null)
+ {
+ txt.offset = 0;
+ txt.count = 0;
+ txt.array = new char[0];
+ return;
+ }
+
+ txt.offset = offset;
+ txt.count = length;
+
+ char chars[] = new char[ a.length() ];
+
+ a.getChars(0, a.length(), chars, 0);
+
+ txt.array = chars;
+ }
+
+ public void insertString(int offs, String str, AttributeSet a)
+ {
+ try {
+ content.insertString(offs, str);
+ } catch (Exception e) {
+ System.err.println("FAILED TO INSERT-STRING: " + e + ", at:"+offs);
+ }
+ }
+
+ protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)
+ {
+ }
+
+ protected void postRemoveUpdate(DefaultDocumentEvent chng)
+ {
+ }
+
+ public void putProperty(Object key, Object value)
+ {
+ }
+
+ void readLock()
+ {
+ }
+
+ void readUnlock()
+ {
+ }
+
+ public void remove(int offs, int len)
+ {
+ }
+
+ public void removeDocumentListener(DocumentListener listener)
+ {
+ }
+
+ public void removeUndoableEditListener(UndoableEditListener listener)
+ {
+ }
+
+ protected void removeUpdate(DefaultDocumentEvent chng)
+ {
+ }
+
+ public void render(Runnable r)
+ {
+ }
+
+ void setAsynchronousLoadPriority(int p)
+ {
+ }
+
+ void setDocumentProperties(Dictionary x)
+ {
+ }
+
+ protected void writeLock()
+ {
+ }
+
+ protected void writeUnlock()
+ {
+ }
+}
diff --git a/javax/swing/text/AttributeSet.java b/javax/swing/text/AttributeSet.java
new file mode 100644
index 000000000..cce2871b6
--- /dev/null
+++ b/javax/swing/text/AttributeSet.java
@@ -0,0 +1,17 @@
+package javax.swing.text;
+
+import java.util.*;
+
+
+public interface AttributeSet
+{
+ boolean containsAttribute(Object name, Object value);
+ boolean containsAttributes(AttributeSet attributes);
+ AttributeSet copyAttributes();
+ Object getAttribute(Object key);
+ int getAttributeCount();
+ Enumeration getAttributeNames();
+ AttributeSet getResolveParent();
+ boolean isDefined(Object attrName);
+ boolean isEqual(AttributeSet attr);
+}
diff --git a/javax/swing/text/BadLocationException.java b/javax/swing/text/BadLocationException.java
new file mode 100644
index 000000000..34f142b5b
--- /dev/null
+++ b/javax/swing/text/BadLocationException.java
@@ -0,0 +1,9 @@
+package javax.swing.text;
+
+
+public class BadLocationException extends Exception
+{
+ BadLocationException()
+ {
+ }
+}
diff --git a/javax/swing/text/Caret.java b/javax/swing/text/Caret.java
new file mode 100644
index 000000000..cf9c49b4f
--- /dev/null
+++ b/javax/swing/text/Caret.java
@@ -0,0 +1,25 @@
+package javax.swing.text;
+
+import java.awt.*;
+import javax.swing.event.*;
+
+public interface Caret
+{
+ void addChangeListener(ChangeListener l);
+ void deinstall(JTextComponent c);
+ int getBlinkRate();
+ int getDot();
+ Point getMagicaretPosition();
+ int getMark();
+ void install(JTextComponent c);
+ boolean isSelectionVisible();
+ boolean isVisible();
+ void moveDot(int dot);
+ void paint(Graphics g);
+ void removeChangeListener(ChangeListener l);
+ void setBlinkRate(int rate);
+ void setDot(int dot);
+ void setMagicCaretPosition(Point p);
+ void setSelectionVisible(boolean v);
+ void setVisible(boolean v);
+}
diff --git a/javax/swing/text/CharacterIterator.java b/javax/swing/text/CharacterIterator.java
new file mode 100644
index 000000000..b84fe7fa0
--- /dev/null
+++ b/javax/swing/text/CharacterIterator.java
@@ -0,0 +1,16 @@
+package javax.swing.text;
+
+
+public interface CharacterIterator extends Cloneable
+{
+ Object clone();
+ char current();
+ char first();
+ int getBeginIndex();
+ int getEndIndex();
+ int getIndex();
+ char last();
+ char next();
+ char previous();
+ char setIndex(int position);
+}
diff --git a/javax/swing/text/ComponentView.java b/javax/swing/text/ComponentView.java
new file mode 100644
index 000000000..b67537d3e
--- /dev/null
+++ b/javax/swing/text/ComponentView.java
@@ -0,0 +1,64 @@
+package javax.swing.text;
+
+import java.awt.*;
+
+public class ComponentView extends View
+{
+ ComponentView(Element elem)
+ {
+ super(elem);
+ }
+
+
+ protected Component createComponent()
+ {
+ return null;
+ }
+
+ float getAlignment(int axis)
+ {
+ return 0;
+ }
+
+ Component getComponent()
+ {
+ return null;
+ }
+
+ float getMaximumSpan(int axis)
+ {
+ return 0;
+ }
+
+ float getMinimumSpan(int axis)
+ {
+ return 0;
+ }
+
+ float getPreferredSpan(int axis)
+ {
+ return 0;
+ }
+
+ Shape modelToView(int pos, Shape a, Position.Bias b)
+ {
+ return null;
+ }
+
+ void paint(Graphics g, Shape a)
+ {
+ }
+
+ void setParent(View p)
+ {
+ }
+
+ void setSize(float width, float height)
+ {
+ }
+
+ int viewToModel(float x, float y, Shape a, Position.Bias[] bias)
+ {
+ return 0;
+ }
+}
diff --git a/javax/swing/text/DefaultCaret.java b/javax/swing/text/DefaultCaret.java
new file mode 100644
index 000000000..f90238000
--- /dev/null
+++ b/javax/swing/text/DefaultCaret.java
@@ -0,0 +1,135 @@
+package javax.swing.text;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.event.*;
+import javax.swing.event.*;
+
+
+public class DefaultCaret extends Rectangle implements Caret, FocusListener, MouseListener, MouseMotionListener
+{
+ Color color = new Color(0,0,0);
+ JTextComponent parent;
+
+ public void mouseDragged(java.awt.event.MouseEvent evt)
+ {
+ }
+
+ public void mouseMoved(java.awt.event.MouseEvent evt)
+ {
+ }
+
+ public void mouseClicked(java.awt.event.MouseEvent evt)
+ {
+ }
+
+ public void mouseEntered(java.awt.event.MouseEvent evt)
+ {
+ }
+
+ public void mouseExited(java.awt.event.MouseEvent evt)
+ {
+ }
+
+ public void mousePressed(java.awt.event.MouseEvent evt)
+ {
+ }
+
+ public void mouseReleased(java.awt.event.MouseEvent evt)
+ {
+ }
+
+ public void focusGained(java.awt.event.FocusEvent evt)
+ {
+ }
+
+ public void focusLost(java.awt.event.FocusEvent evt)
+ {
+ }
+
+ // caret methods:
+
+ public void deinstall(JTextComponent c)
+ {
+ parent.removeFocusListener(this);
+ parent.removeMouseListener(this);
+
+ parent = null;
+ }
+ public void install(JTextComponent c)
+ {
+ parent.addFocusListener(this);
+ parent.addMouseListener(this);
+ parent = c;
+ repaint();
+ }
+
+ Point magic = null;
+ public void setMagicCaretPosition(Point p)
+ { magic = p; }
+ public Point getMagicaretPosition()
+ { return magic; }
+
+
+ int mark = 0;
+ public int getMark()
+ { return mark; }
+
+ boolean vis_sel = true;
+ public void setSelectionVisible(boolean v)
+ { vis_sel = v; repaint(); }
+ public boolean isSelectionVisible()
+ { return vis_sel; }
+
+ private void repaint()
+ {
+ if (parent != null)
+ {
+ parent.repaint();
+ }
+ }
+
+ public void paint(Graphics g)
+ {
+ g.setColor(color);
+ g.drawLine(x,y,
+ x,y+height);
+ }
+
+
+ Vector changes = new Vector();
+ public void addChangeListener(ChangeListener l)
+ { changes.addElement(l); }
+ public void removeChangeListener(ChangeListener l)
+ { changes.removeElement(l); }
+
+
+ int blink = 500;
+ public int getBlinkRate()
+ { return blink; }
+ public void setBlinkRate(int rate)
+ { blink = rate; }
+
+ int dot = 0;
+ public int getDot()
+ { return dot; }
+ public void moveDot(int dot)
+ { setDot(dot); }
+ public void setDot(int dot)
+ {
+ this.dot = dot;
+ repaint();
+ }
+
+ boolean vis = true;
+ public boolean isVisible()
+ { return vis; }
+ public void setVisible(boolean v)
+ {
+ vis = v;
+ repaint();
+ }
+}
+
+
+
diff --git a/javax/swing/text/DefaultEditorKit.java b/javax/swing/text/DefaultEditorKit.java
new file mode 100644
index 000000000..246135466
--- /dev/null
+++ b/javax/swing/text/DefaultEditorKit.java
@@ -0,0 +1,52 @@
+package javax.swing.text;
+
+import javax.swing.*;
+import java.io.*;
+
+public class DefaultEditorKit extends EditorKit
+{
+ void deinstall(JEditorPane c)
+ {
+ // Called when the kit is being removed from the JEditorPane.
+ }
+ void install(JEditorPane c)
+ {
+ }
+
+ Caret createCaret()
+ {
+ return null;
+ }
+ Document createDefaultDocument()
+ {
+ return new PlainDocument();
+ }
+
+ Action[] getActions()
+ {
+ return null;
+ }
+
+ String getContentType()
+ {
+ return "text/plain";
+ }
+
+ ViewFactory getViewFactory()
+ {
+ return null;
+ }
+ void read(InputStream in, Document doc, int pos)
+ {
+ }
+ void read(Reader in, Document doc, int pos)
+ {
+ }
+ void write(OutputStream out, Document doc, int pos, int len)
+ {
+ }
+ void write(Writer out, Document doc, int pos, int len)
+ {
+ }
+}
+
diff --git a/javax/swing/text/Document.java b/javax/swing/text/Document.java
new file mode 100644
index 000000000..6848a4266
--- /dev/null
+++ b/javax/swing/text/Document.java
@@ -0,0 +1,25 @@
+package javax.swing.text;
+
+
+import javax.swing.event.*;
+
+public interface Document
+{
+ void addDocumentListener(DocumentListener listener);
+ void addUndoableEditListener(UndoableEditListener listener);
+ Position createPosition(int offs);
+ Element getDefaultRootElement();
+ Position getEndPosition();
+ int getLength();
+ Object getProperty(Object key);
+ Element[] getRootElements();
+ Position getStartPosition();
+ String getText(int offset, int length);
+ void getText(int offset, int length, Segment txt);
+ void insertString(int offset, String str, AttributeSet a);
+ void putProperty(Object key, Object value);
+ void remove(int offs, int len);
+ void removeDocumentListener(DocumentListener listener);
+ void removeUndoableEditListener(UndoableEditListener listener);
+ void render(Runnable r);
+}
diff --git a/javax/swing/text/EditorKit.java b/javax/swing/text/EditorKit.java
new file mode 100644
index 000000000..feed4fae1
--- /dev/null
+++ b/javax/swing/text/EditorKit.java
@@ -0,0 +1,34 @@
+package javax.swing.text;
+
+import javax.swing.*;
+import java.io.*;
+
+public abstract class EditorKit implements Cloneable
+{
+ EditorKit()
+ {
+ }
+
+ EditorKit(EditorKit kit)
+ {
+ }
+
+ void deinstall(JEditorPane c)
+ {
+ // Called when the kit is being removed from the JEditorPane.
+ }
+ void install(JEditorPane c)
+ {
+ }
+
+ abstract Caret createCaret();
+ abstract Document createDefaultDocument();
+ abstract Action[] getActions();
+ abstract String getContentType();
+ abstract ViewFactory getViewFactory();
+ abstract void read(InputStream in, Document doc, int pos);
+ abstract void read(Reader in, Document doc, int pos);
+ abstract void write(OutputStream out, Document doc, int pos, int len);
+ abstract void write(Writer out, Document doc, int pos, int len);
+}
+
diff --git a/javax/swing/text/Element.java b/javax/swing/text/Element.java
new file mode 100644
index 000000000..e9c2656c4
--- /dev/null
+++ b/javax/swing/text/Element.java
@@ -0,0 +1,17 @@
+package javax.swing.text;
+
+
+
+public interface Element
+{
+ AttributeSet getAttributes();
+ Document getDocument();
+ Element getElement(int index);
+ int getElementCount();
+ int getElementIndex(int offset);
+ int getEndOffset();
+ String getName();
+ Element getParentElement();
+ int getStartOffset();
+ boolean isLeaf();
+ }
diff --git a/javax/swing/text/GapContent.java b/javax/swing/text/GapContent.java
new file mode 100644
index 000000000..a0d6e3d2b
--- /dev/null
+++ b/javax/swing/text/GapContent.java
@@ -0,0 +1,67 @@
+package javax.swing.text;
+
+// too lazy to make a real gapcontent.
+// lets just use a stringbuffer instead.
+
+import javax.swing.undo.*;
+
+
+public class GapContent implements AbstractDocument.Content
+{
+ StringBuffer buf = new StringBuffer();
+
+ GapContent()
+ {
+ this(10);
+ }
+
+ GapContent(int size)
+ {
+ }
+
+ public Position createPosition(final int offset) throws BadLocationException
+ {
+ return new Position()
+ {
+ int off = offset;
+ public int getOffset()
+ {
+ return off;
+ }
+ };
+ }
+
+ public int length()
+ {
+ return buf.length();
+ }
+
+ public UndoableEdit insertString(int where, String str) throws BadLocationException
+ {
+ buf.insert(where, str);
+ return null;
+ }
+
+ public UndoableEdit remove(int where, int nitems) throws BadLocationException
+ {
+ buf.delete(where, where + nitems);
+ return null;
+ }
+
+ public String getString(int where, int len) throws BadLocationException
+ {
+ return buf.toString();
+ }
+
+ public void getChars(int where, int len, Segment txt) throws BadLocationException
+ {
+ txt.array = new char[len];
+
+ System.arraycopy(buf.getValue(), where,
+ txt.array, 0,
+ len);
+
+ txt.count = len;
+ txt.offset = 0;
+ }
+}
diff --git a/javax/swing/text/JTextComponent.java b/javax/swing/text/JTextComponent.java
new file mode 100644
index 000000000..70e3b7569
--- /dev/null
+++ b/javax/swing/text/JTextComponent.java
@@ -0,0 +1,222 @@
+package javax.swing.text;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.plaf.*;
+
+
+public class JTextComponent extends JComponent
+{
+ class KeyBinding
+ {
+ char from, to;
+ }
+
+ int icon_gap;
+ Icon icon;
+ int align;
+ Document doc;
+
+ JTextComponent()
+ {
+ this("", null, 0);
+ }
+
+ JTextComponent(Icon image)
+ {
+ this("", image, 0);
+ }
+
+ JTextComponent(Icon image, int horizontalAlignment)
+ {
+ this("", image, horizontalAlignment);
+ }
+
+ JTextComponent(String text)
+ {
+ this(text, null, 0);
+ }
+
+ JTextComponent(String text, int horizontalAlignment)
+ {
+ this(text, null, horizontalAlignment);
+ }
+
+ JTextComponent(String text, Icon icon, int horizontalAlignment)
+ {
+ setDocument(new PlainDocument());
+
+ // do the work.....
+ setText(text);
+ this.icon = icon;
+ this.align = horizontalAlignment;
+
+ // its an editor, so:
+ enableEvents(AWTEvent.KEY_EVENT_MASK);
+ updateUI();
+ }
+
+ void setDocument(Document s)
+ {
+ doc = s;
+ revalidate();
+ repaint();
+ }
+
+ Document getDocument()
+ {
+ if (doc == null)
+ System.out.println("doc == null !!!");
+ return doc;
+ }
+
+ protected int checkHorizontalKey(int key, String message)
+ {
+ // Verify that key is a legal value for the horizontalAlignment properties.
+ return 0;
+ }
+ protected int checkVerticalKey(int key, String message)
+ {
+ // Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties.
+ return 0;
+ }
+ AccessibleContext getAccessibleContext()
+ {
+ // Get the AccessibleContext of this object
+ return null;
+ }
+ Icon getDisabledIcon()
+ {
+ return null;
+ }
+ int getDisplayedMnemonic()
+ {
+ // Return the keycode that indicates a mnemonic key.
+ return 0;
+ }
+ int getHorizontalAlignment()
+ {
+ // Returns the alignment of the label's contents along the X axis.
+ return 0;
+ }
+ int getHorizontalTextPosition()
+ {
+ // Returns the horizontal position of the label's text, relative to its image.
+ return 0;
+ }
+
+ Icon getIcon()
+ { return icon; }
+ int getIconTextGap()
+ { return icon_gap; }
+
+
+ Component getLabelFor()
+ {
+ // Get the component this is labelling.
+ return null;
+ }
+
+ void setText(String text)
+ {
+ getDocument().remove(0,doc.getLength());
+ getDocument().insertString(0, text, null);
+ }
+
+ public String getText()
+ {
+ return getDocument().getText(0,
+ getDocument().getLength());
+ }
+
+ String getUIClassID()
+ {
+ // Returns a string that specifies the name of the l&f class that renders this component.
+ return "JTextComponent";
+ }
+ int getVerticalAlignment()
+ {
+ // Returns the alignment of the label's contents along the Y axis.
+ return 0;
+ }
+ int getVerticalTextPosition()
+ {
+ // Returns the vertical position of the label's text, relative to its image.
+ return 0;
+ }
+
+ public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
+ {
+ // This is overriden to return false if the current Icon's Image is not equal to the passed in Image img.
+ return (img == icon);
+ }
+ protected String paramString()
+ {
+ // Returns a string representation of this JTextComponent.
+ return "JTextComponent";
+ }
+ void setDisabledIcon(Icon disabledIcon)
+ {
+ // Set the icon to be displayed if this JTextComponent is "disabled" (JTextComponent.setEnabled(false)).
+ }
+ void setDisplayedMnemonic(char aChar)
+ {
+ // Specifies the displayedMnemonic as a char value.
+ }
+ void setDisplayedMnemonic(int key)
+ {
+ // Specify a keycode that indicates a mnemonic key.
+ }
+ void setHorizontalAlignment(int alignment)
+ {
+ // Sets the alignment of the label's contents along the X axis.
+ }
+ void setHorizontalTextPosition(int textPosition)
+ {
+ // Sets the horizontal position of the label's text, relative to its image.
+ }
+ void setIcon(Icon icon)
+ {
+ // Defines the icon this component will display.
+ }
+ void setIconTextGap(int iconTextGap)
+ {
+ // If both the icon and text properties are set, this property defines the space between them.
+ }
+
+ void setLabelFor(Component c)
+ {
+ // Set the component this is labelling.
+ }
+
+ void setVerticalAlignment(int alignment)
+ {
+ // Sets the alignment of the label's contents along the Y axis.
+ }
+ void setVerticalTextPosition(int textPosition)
+ {
+ // Sets the vertical position of the label's text, relative to its image.
+ }
+
+ TextUI getUI()
+ { return (TextUI) ui;
+ }
+
+ void updateUI()
+ {
+ TextUI b = (TextUI)UIManager.getUI(this);
+ setUI(b);
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/javax/swing/text/Keymap.java b/javax/swing/text/Keymap.java
new file mode 100644
index 000000000..3216d8303
--- /dev/null
+++ b/javax/swing/text/Keymap.java
@@ -0,0 +1,22 @@
+package javax.swing.text;
+
+import javax.swing.*;
+
+public interface Keymap
+{
+ void addActionForKeyStroke(KeyStroke key, Action a);
+ Action getAction(KeyStroke key);
+ Action[] getBoundActions();
+ KeyStroke[] getBoundKeyStrokes();
+ Action getDefaultAction();
+ KeyStroke[] getKeyStrokesForAction(Action a);
+ String getName();
+ Keymap getResolveParent();
+ boolean isLocallyDefined(KeyStroke key);
+ void removeBindings();
+ void removeKeyStrokeBinding(KeyStroke keys);
+ void setDefaultAction(Action a);
+ void setResolveParent(Keymap parent);
+}
+
+
diff --git a/javax/swing/text/PlainDocument.java b/javax/swing/text/PlainDocument.java
new file mode 100644
index 000000000..70588b266
--- /dev/null
+++ b/javax/swing/text/PlainDocument.java
@@ -0,0 +1,21 @@
+package javax.swing.text;
+
+
+public class PlainDocument extends AbstractDocument
+{
+ PlainDocument()
+ {
+ super(new GapContent());
+ }
+
+ public Element getDefaultRootElement()
+ {
+ return null;
+ }
+
+ public Element getParagraphElement(int pos)
+ {
+ return null;
+ }
+}
+
diff --git a/javax/swing/text/PlainEditorKit.java b/javax/swing/text/PlainEditorKit.java
new file mode 100644
index 000000000..05cf8c821
--- /dev/null
+++ b/javax/swing/text/PlainEditorKit.java
@@ -0,0 +1,62 @@
+package javax.swing.text;
+
+import javax.swing.*;
+import java.io.*;
+
+public class PlainEditorKit extends EditorKit
+{
+ PlainEditorKit()
+ {
+ }
+
+ PlainEditorKit(PlainEditorKit kit)
+ {
+ super(kit);
+ }
+
+ protected Object clone()
+ {
+ return new PlainEditorKit(this);
+ }
+ void deinstall(JEditorPane c)
+ {
+ // Called when the kit is being removed from the JEditorPane.
+ }
+ void install(JEditorPane c)
+ {
+ }
+
+ Caret createCaret()
+ {
+ return null;
+ }
+ Document createDefaultDocument()
+ {
+ return null;
+ }
+ Action[] getActions()
+ {
+ return null;
+ }
+ String getContentType()
+ {
+ return null;
+ }
+ ViewFactory getViewFactory()
+ {
+ return null;
+ }
+ void read(InputStream in, Document doc, int pos)
+ {
+ }
+ void read(Reader in, Document doc, int pos)
+ {
+ }
+ void write(OutputStream out, Document doc, int pos, int len)
+ {
+ }
+ void write(Writer out, Document doc, int pos, int len)
+ {
+ }
+}
+
diff --git a/javax/swing/text/Position.java b/javax/swing/text/Position.java
new file mode 100644
index 000000000..28ff02560
--- /dev/null
+++ b/javax/swing/text/Position.java
@@ -0,0 +1,11 @@
+package javax.swing.text;
+
+
+public interface Position
+{
+ static class Bias
+ {
+ }
+
+ int getOffset();
+}
diff --git a/javax/swing/text/Segment.java b/javax/swing/text/Segment.java
new file mode 100644
index 000000000..c568809f7
--- /dev/null
+++ b/javax/swing/text/Segment.java
@@ -0,0 +1,73 @@
+package javax.swing.text;
+
+import java.util.*;
+
+
+public class Segment implements Cloneable, CharacterIterator
+{
+ char[] array;
+ int count;
+ int offset;
+
+ public Object clone()
+ {
+ try {
+ return super.clone();
+ } catch (Exception e) {
+ System.err.println("Huuuhhh, this class implements cloneable !!!!!!");
+ System.err.println("I think there is a bug in this JVM somewhere");
+ }
+ return null;
+ }
+
+ public char current()
+ {
+ return array[getIndex()];
+ }
+
+ public char first()
+ {
+ offset = getBeginIndex();
+ return array[offset];
+ }
+
+ public int getBeginIndex()
+ {
+ return offset;
+ }
+
+ public int getEndIndex()
+ {
+ return offset + count;
+ }
+ public int getIndex()
+ {
+ return offset;
+ }
+ public char last()
+ {
+ offset = getEndIndex() - 1;
+ return array[offset];
+ }
+ public char next()
+ {
+ offset++;
+ return array[offset];
+ }
+ public char previous()
+ {
+ offset--;
+ return array[offset];
+ }
+ public char setIndex(int position)
+ {
+ offset = position;
+ return array[offset];
+ }
+
+ public String toString()
+ {
+ return new String(array, offset, count);
+ }
+}
+
diff --git a/javax/swing/text/Style.java b/javax/swing/text/Style.java
new file mode 100644
index 000000000..403ca1013
--- /dev/null
+++ b/javax/swing/text/Style.java
@@ -0,0 +1,10 @@
+package javax.swing.text;
+
+import javax.swing.event.*;
+
+public interface Style
+{
+ void addChangeListener(ChangeListener l);
+ String getName();
+ void removeChangeListener(ChangeListener l);
+}
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;
+ }
+ }
+ }
+}
+
diff --git a/javax/swing/text/ViewFactory.java b/javax/swing/text/ViewFactory.java
new file mode 100644
index 000000000..4e3532381
--- /dev/null
+++ b/javax/swing/text/ViewFactory.java
@@ -0,0 +1,7 @@
+package javax.swing.text;
+
+
+public interface ViewFactory
+{
+ public View create(Element elem);
+}
diff --git a/javax/swing/tree/TreeNode.java b/javax/swing/tree/TreeNode.java
new file mode 100644
index 000000000..89eb5e5f9
--- /dev/null
+++ b/javax/swing/tree/TreeNode.java
@@ -0,0 +1,16 @@
+package javax.swing.tree;
+
+import java.util.*;
+
+public interface TreeNode
+{
+ Enumeration children();
+ boolean getAllowsChildren();
+ TreeNode getChildAt(int childIndex);
+ int getChildCount();
+ int getIndex(TreeNode node);
+ TreeNode getParent();
+ boolean isLeaf();
+}
+
+
diff --git a/javax/swing/undo/UndoableEdit.java b/javax/swing/undo/UndoableEdit.java
new file mode 100644
index 000000000..e07470ade
--- /dev/null
+++ b/javax/swing/undo/UndoableEdit.java
@@ -0,0 +1,6 @@
+package javax.swing.undo;
+
+
+public interface UndoableEdit
+{
+}