1 /* JComponent.java -- Every component in swing inherits from this class.
2    Copyright (C) 2002 Free Software Foundation, Inc.
3 
4 This file is part of GNU Classpath.
5 
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
20 
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25 
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37 
38 
39 package javax.swing;
40 
41 import java.awt.AWTEvent;
42 import java.awt.Color;
43 import java.awt.Component;
44 import java.awt.Container;
45 import java.awt.Dimension;
46 import java.awt.FlowLayout;
47 import java.awt.Font;
48 import java.awt.Graphics;
49 import java.awt.Insets;
50 import java.awt.Point;
51 import java.awt.Rectangle;
52 import java.awt.event.ActionListener;
53 import java.awt.event.ContainerEvent;
54 import java.awt.event.ContainerListener;
55 import java.awt.event.FocusEvent;
56 import java.awt.event.FocusListener;
57 import java.awt.event.KeyEvent;
58 import java.awt.event.MouseEvent;
59 import java.awt.peer.LightweightPeer;
60 import java.beans.PropertyChangeListener;
61 import java.beans.PropertyVetoException;
62 import java.beans.VetoableChangeListener;
63 import java.io.Serializable;
64 import java.util.Vector;
65 import java.util.Hashtable;
66 import javax.accessibility.Accessible;
67 import javax.accessibility.AccessibleContext;
68 import javax.accessibility.AccessibleExtendedComponent;
69 import javax.accessibility.AccessibleRole;
70 import javax.accessibility.AccessibleStateSet;
71 import javax.swing.event.AncestorListener;
72 import javax.swing.event.EventListenerList;
73 import javax.swing.border.Border;
74 import javax.swing.plaf.ComponentUI;
75 
76 /**
77  * Every component in swing inherits from this class (JLabel, JButton, etc).
78  * It contains generic methods to manage events, properties and sizes.
79  * Actual drawing of the component is channeled to a look-and-feel class
80  * that is implemented elsewhere.
81  *
82  * @author Ronald Veldema (rveldema@cs.vu.nl)
83  */
84 public abstract class JComponent extends Container implements Serializable
85 {
86   static final long serialVersionUID = -5242478962609715464L;
87         /**
88          * accessibleContext
89          */
90         protected AccessibleContext accessibleContext;
91 
92 	Dimension pref,min,max;
93 	Border border;
94 	JToolTip tooltip;
95 	String tool_tip_text;
96 	boolean use_double_buffer, opaque;
97 	protected ComponentUI ui;
98 
99 	Vector ancestor_list;
100 	Vector veto_list;
101 	Vector change_list;
102 	Hashtable prop_hash;
103 
104 	/**
105 	 * AccessibleJComponent
106 	 */
107 	public abstract class AccessibleJComponent
108 		extends AccessibleAWTContainer {
109 
110 		//-------------------------------------------------------------
111 		// Classes ----------------------------------------------------
112 		//-------------------------------------------------------------
113 
114 		/**
115 		 * AccessibleFocusHandler
116 		 */
117 		protected class AccessibleFocusHandler implements FocusListener {
118 			/**
119 			 * Constructor AccessibleFocusHandler
120 			 * @param component TODO
121 			 */
AccessibleFocusHandler(AccessibleJComponent component)122 			protected AccessibleFocusHandler(AccessibleJComponent component) {
123 				// TODO
124 			} // AccessibleFocusHandler()
125 
126 			/**
127 			 * focusGained
128 			 * @param event TODO
129 			 */
focusGained(FocusEvent event)130 			public void focusGained(FocusEvent event) {
131 				// TODO
132 			} // focusGained()
133 
134 			/**
135 			 * focusLost
136 			 * @param event TODO
137 			 */
focusLost(FocusEvent valevent)138 			public void focusLost(FocusEvent valevent) {
139 				// TODO
140 			} // focusLost()
141 		} // AccessibleFocusHandler
142 
143 		/**
144 		 * AccessibleContainerHandler
145 		 */
146 		protected class AccessibleContainerHandler implements ContainerListener {
147 			/**
148 			 * Constructor AccessibleContainerHandler
149 			 * @param component TODO
150 			 */
AccessibleContainerHandler(AccessibleJComponent component)151 			protected AccessibleContainerHandler(AccessibleJComponent component) {
152 				// TODO
153 			} // AccessibleContainerHandler()
154 
155 			/**
156 			 * componentAdded
157 			 * @param event TODO
158 			 */
componentAdded(ContainerEvent event)159 			public void componentAdded(ContainerEvent event) {
160 				// TODO
161 			} // componentAdded()
162 
163 			/**
164 			 * componentRemoved
165 			 * @param event TODO
166 			 */
componentRemoved(ContainerEvent valevent)167 			public void componentRemoved(ContainerEvent valevent) {
168 				// TODO
169 			} // componentRemoved()
170 		} // AccessibleContainerHandler
171 
172 		/**
173 		 * accessibleContainerHandler
174 		 */
175 		protected ContainerListener accessibleContainerHandler;
176 
177 		/**
178 		 * accessibleFocusHandler
179 		 */
180 		protected FocusListener accessibleFocusHandler;
181 
182 		/**
183 		 * Constructor AccessibleJComponent
184 		 * @param component TODO
185 		 */
AccessibleJComponent(JComponent component)186 		protected AccessibleJComponent(JComponent component) {
187 //			super((Container)component);
188 			// TODO
189 		} // AccessibleJComponent()
190 
191 		/**
192 		 * addPropertyChangeListener
193 		 * @param listener TODO
194 		 */
addPropertyChangeListener(PropertyChangeListener listener)195 		public void addPropertyChangeListener(PropertyChangeListener listener) {
196 			// TODO
197 		} // addPropertyChangeListener()
198 
199 		/**
200 		 * removePropertyChangeListener
201 		 * @param listener TODO
202 		 */
removePropertyChangeListener(PropertyChangeListener listener)203 		public void removePropertyChangeListener(PropertyChangeListener listener) {
204 			// TODO
205 		} // removePropertyChangeListener()
206 
207 		/**
208 		 * getAccessibleChildrenCount
209 		 * @returns int
210 		 */
getAccessibleChildrenCount()211 		public int getAccessibleChildrenCount() {
212 			return 0; // TODO
213 		} // getAccessibleChildrenCount()
214 
215 		/**
216 		 * getAccessibleChild
217 		 * @param value0 TODO
218 		 * @returns Accessible
219 		 */
getAccessibleChild(int value0)220 		public Accessible getAccessibleChild(int value0) {
221 			return null; // TODO
222 		} // getAccessibleChild()
223 
224 		/**
225 		 * getAccessibleStateSet
226 		 * @returns AccessibleStateSet
227 		 */
getAccessibleStateSet()228 		public AccessibleStateSet getAccessibleStateSet() {
229 			return null; // TODO
230 		} // getAccessibleStateSet()
231 
232 		/**
233 		 * getAccessibleName
234 		 * @returns String
235 		 */
getAccessibleName()236 		public String getAccessibleName() {
237 			return null; // TODO
238 		} // getAccessibleName()
239 
240 		/**
241 		 * getAccessibleDescription
242 		 * @returns String
243 		 */
getAccessibleDescription()244 		public String getAccessibleDescription() {
245 			return null; // TODO
246 		} // getAccessibleDescription()
247 
248 		/**
249 		 * getAccessibleRole
250 		 * @returns AccessibleRole
251 		 */
getAccessibleRole()252 		public AccessibleRole getAccessibleRole() {
253 			return null; // TODO
254 		} // getAccessibleRole()
255 
256 		/**
257 		 * getBorderTitle
258 		 * @param value0 TODO
259 		 * @returns String
260 		 */
getBorderTitle(Border value0)261 		protected String getBorderTitle(Border value0) {
262 			return null; // TODO
263 		} // getBorderTitle()
264 
265 
266 	} // AccessibleJComponent
267 
268 
JComponent()269         public JComponent()
270 	{
271 		super();
272 		super.setLayout(new FlowLayout());
273 
274 		//eventMask |= AWTEvent.COMP_KEY_EVENT_MASK;
275 		enableEvents( AWTEvent.KEY_EVENT_MASK );
276 
277 		//updateUI(); // get a proper ui
278 	}
279 
280 	// protected EventListenerList listenerList
contains(int x, int y)281 	public boolean contains(int x, int y)
282 	{
283 		//return dims.contains(x,y);
284 		return super.contains(x,y);
285 	}
286 
addNotify()287 	public  void addNotify()
288 	{
289 		//Notification to this component that it now has a parent component.
290 		super.addNotify();
291 	}
292 
get_prop_hash()293 	Hashtable get_prop_hash()
294 	{
295 		if (prop_hash == null)
296 			prop_hash = new Hashtable();
297 		return prop_hash;
298 	}
get_veto_list()299 	public Vector get_veto_list()
300 	{
301 		if (veto_list == null)
302 			veto_list = new Vector();
303 		return veto_list;
304 	}
get_change_list()305 	public Vector get_change_list()
306 	{
307 		if (change_list == null)
308 			change_list = new Vector();
309 		return change_list;
310 	}
get_ancestor_list()311 	public Vector get_ancestor_list()
312 	{
313 		if (ancestor_list == null)
314 			ancestor_list = new Vector();
315 		return ancestor_list;
316 	}
317 
getClientProperty(Object key)318 	public Object getClientProperty(Object key)
319         {	return get_prop_hash().get(key);    }
320 
putClientProperty(Object key, Object value)321 	public void putClientProperty(Object key, Object value)
322 	{    get_prop_hash().put(key, value);   }
323 
removeAncestorListener(AncestorListener listener)324 	public void removeAncestorListener(AncestorListener listener)
325 	{  get_ancestor_list().removeElement(listener);  }
326 
removePropertyChangeListener(PropertyChangeListener listener)327         public void removePropertyChangeListener(PropertyChangeListener listener)
328 	{  get_change_list().removeElement(listener);   }
329 
removePropertyChangeListener(String propertyName, PropertyChangeListener listener)330 	public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
331 	{  /* FIXME */   get_change_list().removeElement(listener);   }
332 
removeVetoableChangeListener(VetoableChangeListener listener)333 	public void removeVetoableChangeListener(VetoableChangeListener listener)
334 	{  get_veto_list().removeElement(listener);   }
335 
addAncestorListener(AncestorListener listener)336 	public void addAncestorListener(AncestorListener listener)
337 	{   get_ancestor_list().addElement(listener);  }
338 
addPropertyChangeListener(PropertyChangeListener listener)339 	public void addPropertyChangeListener(PropertyChangeListener listener)
340 	{  get_change_list().addElement(listener);   }
341 
addPropertyChangeListener(String propertyName, PropertyChangeListener listener)342 	public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
343 	{ /* FIXME */ get_change_list().addElement(listener);   }
344 
addVetoableChangeListener(VetoableChangeListener listener)345 	public void addVetoableChangeListener(VetoableChangeListener listener)
346 	{  get_veto_list().addElement(listener);    }
347 
computeVisibleRect(Rectangle rect)348 	public void computeVisibleRect(Rectangle rect)
349 	{
350 		//Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors.
351 		//super.computeVisibleRect(rect);
352 	}
353 
firePropertyChange(String propertyName, boolean oldValue, boolean newValue)354 	public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
355 	{
356 		//Reports a bound property change.
357 	}
firePropertyChange(String propertyName, byte oldValue, byte newValue)358 	public void firePropertyChange(String propertyName, byte oldValue, byte newValue)
359 	{
360 		//    Reports a bound property change.
361 	}
firePropertyChange(String propertyName, char oldValue, char newValue)362 	public void firePropertyChange(String propertyName, char oldValue, char newValue)
363 	{
364 		//Reports a bound property change.
365 	}
366 
firePropertyChange(String propertyName, double oldValue, double newValue)367 	public void firePropertyChange(String propertyName, double oldValue, double newValue)
368 	{
369 		//Reports a bound property change.
370 	}
371 
firePropertyChange(String propertyName, float oldValue, float newValue)372 	public void firePropertyChange(String propertyName, float oldValue, float newValue)
373 	{
374 		//       Reports a bound property change.
375 	}
firePropertyChange(String propertyName, int oldValue, int newValue)376 	public void firePropertyChange(String propertyName, int oldValue, int newValue)
377 	{
378 		//       Reports a bound property change.
379 	}
firePropertyChange(String propertyName, long oldValue, long newValue)380 	public void firePropertyChange(String propertyName, long oldValue, long newValue)
381 	{
382 		//Reports a bound property change. protected
383 	}
384 
firePropertyChange(String propertyName, Object oldValue, Object newValue)385   protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
386 	{
387 		//       Support for reporting bound property changes.
388 	}
firePropertyChange(String propertyName, short oldValue, short newValue)389 	public void firePropertyChange(String propertyName, short oldValue, short newValue)
390 	{
391 		//       Reports a bound property change.
392 	}
393 
fireVetoableChange(String propertyName, Object oldValue, Object newValue)394 	protected  void fireVetoableChange(String propertyName, Object oldValue, Object newValue)
395 	{
396 		//       Support for reporting constrained property changes.
397 	}
398 
getAccessibleContext()399         public AccessibleContext getAccessibleContext()
400 	{
401 		//       Get the AccessibleContext associated with this JComponent
402 		return null;
403 	}
404 
getActionForKeyStroke(KeyStroke aKeyStroke)405         public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)
406 	{
407 		//Return the object that will perform the action registered for a given keystroke.
408 		return null;
409 	}
getAlignmentX()410 	public float getAlignmentX()
411 	{
412 		//    Overrides Container.getAlignmentX to return the vertical alignment.
413 		return 0;
414 	}
415 
getAlignmentY()416 	public float getAlignmentY()
417 	{
418 		//       Overrides Container.getAlignmentY to return the horizontal alignment.
419 		return 0;
420 	}
getAutoscrolls()421 	public boolean getAutoscrolls()
422 	{
423 		//Returns true if this component automatically scrolls its contents when dragged, (when contained in a component that supports scrolling, like JViewport
424 		return false;
425 	}
426 
setBorder(Border border)427 	public void setBorder(Border border)
428 	{
429 		//System.out.println("set border called !, new border = " + border);
430 		this.border = border;
431 		revalidate();
432 		repaint();
433 	}
434 
getBorder()435 	public Border getBorder()
436 	{	return border;    }
437 
438 
getBounds(Rectangle rv)439         public Rectangle getBounds(Rectangle rv)
440 	{
441 		if (rv == null)
442 			return new Rectangle(getX(),getY(),getWidth(),getHeight());
443 		else
444 		{
445 			rv.setBounds(getX(),getY(),getWidth(),getHeight());
446 			return rv;
447 		}
448 	}
449 
getComponentGraphics(Graphics g)450 	protected  Graphics getComponentGraphics(Graphics g)
451 	{      return g;       }
452 
getConditionForKeyStroke(KeyStroke aKeyStroke)453 	public int getConditionForKeyStroke(KeyStroke aKeyStroke)
454 	{
455 		//Return the condition that determines whether a registered action occurs in response to the specified keystroke.
456 		return 0;
457 	}
getDebugGraphicsOptions()458 	public int getDebugGraphicsOptions()
459 	{
460 		return 0;
461 	}
462 
getGraphics()463 	public Graphics getGraphics()
464 	{	return super.getGraphics();    }
465 
466 
467 	//    static MantaNative void DebugMe(Border b);
468 
getInsets()469 	public Insets getInsets()
470 	{
471 		//	System.out.println("watch this border");
472 		//	DebugMe(border);
473 		//	System.out.println("border = " + border);
474 
475 		if (border == null)
476 		{
477 			//System.out.println("compares to null !");
478 			return super.getInsets();
479 		}
480 		//	System.out.println("compare failed !");
481 		return getBorder().getBorderInsets(this);
482 	}
483 
getInsets(Insets insets)484 	public Insets getInsets(Insets insets)
485 	{
486 	    Insets t = getInsets();
487 
488 	    if (insets == null)
489 		return t;
490 
491 
492 	    return new Insets(t.top, t.left, t.bottom, t.right);
493 	}
getLocation(Point rv)494 	public Point getLocation(Point rv)
495 	{
496 		//Store the x,y origin of this component into "return value" rv and return rv.
497 
498 		if (rv == null)
499 			return new Point(getX(),
500 					 getY());
501 
502 		rv.setLocation(getX(),
503 		               getY());
504 		return rv;
505 	}
506 
getMaximumSize()507 	public Dimension getMaximumSize()
508 	{
509 		if (max != null)
510 		{
511 			//System.out.println("HAVE_MAX_SIZE =  " + max);
512 			return max;
513 		}
514 		if (ui != null)
515 		{
516 		    Dimension s = ui.getMaximumSize(this);
517 		    if (s != null)
518 			{
519 				//System.out.println("        UI-MAX = " + s + ", UI = " + ui + ", IM="+this);
520 				return s;
521 			}
522 		}
523 		Dimension p = super.getMaximumSize();
524 		//System.out.println("               MAX = " + p + ", COMP="+this);
525 		return p;
526 	}
527 
getMinimumSize()528 	public Dimension getMinimumSize()
529 	{
530 		if (min != null)
531 		{
532 			//System.out.println("HAVE_MIN_SIZE =  " + min);
533 			return min;
534 		}
535 		if (ui != null)
536 		{
537 			Dimension s = ui.getMinimumSize(this);
538 			if (s != null)
539 			{
540 				//	System.out.println("        UI-MIN = " + s + ", UI = " + ui + ", IM="+this);
541 				return s;
542 			}
543 		}
544 		Dimension p = super.getMinimumSize();
545 		//	System.out.println("              MIN = " + p + ", COMP="+this);
546 		return p;
547 	}
548 
getPreferredSize()549 	public Dimension getPreferredSize()
550 	{
551 		if (pref != null)
552 		{
553 			//System.out.println("HAVE_PREF_SIZE =  " + pref);
554 			return pref;
555 		}
556 
557 		if (ui != null)
558 		{
559 			Dimension s = ui.getPreferredSize(this);
560 			if (s != null)
561 			{
562 				//System.out.println("        UI-PREF = " + s + ", UI = " + ui + ", IM="+this);
563 				return s;
564 			}
565 		}
566 		Dimension p = super.getPreferredSize();
567 		//	System.out.println("              PREF = " + p + ", COMP="+this);
568 		return p;
569 	}
570 
getNextFocusableComponent()571 	public Component getNextFocusableComponent()
572 	{
573 		//          Return the next focusable component or null if the focus manager should choose the next focusable component automatically
574 		return null;
575 	}
576 
577 
getRegisteredKeyStrokes()578 	public KeyStroke[] getRegisteredKeyStrokes()
579 	{
580 		//          Return the KeyStrokes that will initiate registered actions.
581 		return null;
582 	}
583 
getRootPane()584 	public JRootPane getRootPane()
585 	{
586 		JRootPane p = SwingUtilities.getRootPane(this);
587 		System.out.println("root = " + p);
588 		return p;
589 	}
590 
getSize(Dimension rv)591 	public Dimension getSize(Dimension rv)
592 	{
593 		//	System.out.println("JComponent, getsize()");
594 		if (rv == null)
595 			return new Dimension(getWidth(),
596 			                     getHeight());
597 		else
598 		{
599 			rv.setSize(getWidth(),
600 			           getHeight());
601 			return rv;
602 		}
603 	}
604 
createToolTip()605 	public JToolTip createToolTip()
606 	{
607 		if (tooltip == null)
608 			tooltip = new JToolTip(tool_tip_text);
609 		return tooltip;
610 	}
611 
getToolTipLocation(MouseEvent event)612 	public Point getToolTipLocation(MouseEvent event)
613         {	return null;    }
614 
setToolTipText(String text)615 	public void setToolTipText(String text)
616 	{	tool_tip_text = text;    }
617 
getToolTipText()618 	public String getToolTipText()
619 	{	return tool_tip_text;    }
620 
getToolTipText(MouseEvent event)621 	public String getToolTipText(MouseEvent event)
622 	{	return tool_tip_text;    }
623 
getTopLevelAncestor()624 	public Container getTopLevelAncestor()
625 	{
626 		//      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.
627 		System.out.println("JComponent, getTopLevelAncestor()");
628 		return null;
629 	}
630 
getVisibleRect()631 	public Rectangle getVisibleRect()
632 	{
633 		///    Returns the Component's "visible rectangle" - the intersection of this components visible rectangle:
634 		System.out.println("JComponent, getVisibleRect()");
635 		return null;
636 	}
637 
grabFocus()638 	public void grabFocus()
639 	{
640 		//      Set the focus on the receiving component.
641 	}
642 
hasFocus()643 	public boolean hasFocus()
644 	{
645 		//      Returns true if this Component has the keyboard focus.
646 		return false;
647 	}
648 
isDoubleBuffered()649 	public boolean isDoubleBuffered()
650 	{	return use_double_buffer;    }
651 
isFocusCycleRoot()652 	public boolean isFocusCycleRoot()
653 	{
654 		//      Override this method and return true if your component is the root of of a component tree with its own focus cycle.
655 		return false;
656 	}
657 
isFocusTraversable()658 	public boolean isFocusTraversable()
659 	{
660 		//      Identifies whether or not this component can receive the focus.
661 		return false;
662 	}
663 
isLightweightComponent(Component c)664 	public static boolean isLightweightComponent(Component c)
665 	{
666 		return c.getPeer() instanceof LightweightPeer;
667 	}
668 
isManagingFocus()669 	public boolean isManagingFocus()
670 	{
671 		//      Override this method and return true if your JComponent manages focus.
672 		return false;
673 	}
674 
isOpaque()675         public boolean isOpaque()
676 	{	return opaque;    }
677 
isOptimizedDrawingEnabled()678 	public boolean isOptimizedDrawingEnabled()
679 	{
680 		//      Returns true if this component tiles its children,
681 		return true;
682 	}
683 
isPaintingTile()684 	public boolean isPaintingTile()
685 	{
686 		//      Returns true if the receiving component is currently painting a tile.
687 		return false;
688 	}
689 
isRequestFocusEnabled()690 	public boolean isRequestFocusEnabled()
691 	{
692 		//      Return whether the receiving component can obtain the focus by calling requestFocus
693 		return false;
694 	}
695 
isValidateRoot()696 	public boolean isValidateRoot()
697 	{
698 		//      If this method returns true, revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated.
699 		return false;
700 	}
701 
paint(Graphics g)702 	public void paint(Graphics g)
703 	{
704 		//	System.out.println("SWING_PAINT:" + this);
705 
706 		paintBorder(g);
707 		paintComponent(g);
708 		paintChildren(g);
709 	}
710 
paintBorder(Graphics g)711 	protected  void paintBorder(Graphics g)
712 	{
713 		//	System.out.println("PAINT_BORDER      x XXXXXXX x x x x x x x x x x x x:" + getBorder() + ", THIS="+this);
714 
715 		//       Paint the component's border.
716 		if (getBorder() != null)
717 		{
718 			//System.out.println("PAINT_BORDER      x XXXXXXX x x x x x x x x x x x x:" + getBorder() + ", THIS="+this);
719 
720 			getBorder().paintBorder(this,
721 			                        g,
722 			                        0,
723 			                        0,
724 			                        getWidth(),
725 			                        getHeight());
726 		}
727 	}
728 
paintChildren(Graphics g)729 	protected  void paintChildren(Graphics g)
730 	{
731 	    //      Paint this component's children.
732 	    //super.paintChildren(g);
733 	}
734 
paintComponent(Graphics g)735 	protected  void paintComponent(Graphics g)
736 	{
737 		//      If the UI delegate is non-null, call its paint method.
738 		if (ui != null)
739 		{
740 			ui.paint(g, this);
741 		}
742 	}
743 
744     /**
745      * Paint the specified region in this component and all of
746      * its descendants that overlap the region, immediately.
747      */
paintImmediately(int x, int y, int w, int h)748 	public void paintImmediately(int x, int y, int w, int h)
749         {
750 
751 	    //Ronald: this shoudld probably redirect to the PLAF ....
752 	}
753 
paintImmediately(Rectangle r)754 	public void paintImmediately(Rectangle r)
755 	{
756 	    ///      Paint the specified region now.
757 	    paintImmediately((int)r.getX(),
758 			     (int)r.getY(),
759 			     (int)r.getWidth(),
760 			     (int)r.getHeight());
761 	}
paramString()762 	protected  String paramString()
763 	{
764 		//      Returns a string representation of this JComponent.
765 		return "JComponent";
766 	}
processComponentKeyEvent(KeyEvent e)767 	protected  void processComponentKeyEvent(KeyEvent e)
768 	{
769 		//     Process any key events that the component itself recognizes.
770 	    //System.out.println("COMP_KEY-EVENT: " + e);
771 	}
processFocusEvent(FocusEvent e)772 	protected  void processFocusEvent(FocusEvent e)
773 	{
774 		//      Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.
775 	    //System.out.println("FOCUS_EVENT: " + e);
776 	}
777 
processKeyEvent(KeyEvent e)778 	protected  void processKeyEvent(KeyEvent e)
779 	{
780 		//      Override processKeyEvent to process events protected
781 	    //System.out.println("KEY-EVENT: " + e);
782 	}
783 
processMouseMotionEvent(MouseEvent e)784         public void processMouseMotionEvent(MouseEvent e)
785 	{
786 	    //      Processes mouse motion events occurring on this component by dispatching them to any registered MouseMotionListener objects.
787 	    //System.out.println("COMP_MOUSE-EVENT: " + e + ", MEMORY = " + Runtime.getRuntime().freeMemory());
788 	}
789 
registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)790 	public void registerKeyboardAction(ActionListener anAction,
791 	                            KeyStroke aKeyStroke,
792 	                            int aCondition)
793 	{
794 		registerKeyboardAction(anAction,
795 		                       null,
796 		                       aKeyStroke,
797 		                       aCondition);
798 	}
799 
registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)800 	public void registerKeyboardAction(ActionListener anAction,
801 	                            String aCommand,
802 	                            KeyStroke aKeyStroke,
803 	                            int aCondition)
804 	{
805 		//  Register a new keyboard action.
806 	}
807 
808 
removeNotify()809 	public void removeNotify()
810 	{
811 		//      Notification to this component that it no longer has a parent component.
812 	}
813 
repaint(long tm, int x, int y, int width, int height)814 	public void repaint(long tm, int x, int y, int width, int height)
815 	{
816 		//   Adds the specified region to the dirty region list if the component is showing.
817 		//System.out.println("JC: repaint");
818 		super.repaint(tm, x,y,width,height);
819 	}
820 
repaint(Rectangle r)821 	public void repaint(Rectangle r)
822 	{
823 		//      Adds the specified region to the dirty region list if the component is showing.
824 		repaint((long)0,
825 		        (int)r.getX(),
826 		        (int)r.getY(),
827 		        (int)r.getWidth(),
828 		        (int)r.getHeight());
829 	}
830 
requestDefaultFocus()831 	public boolean requestDefaultFocus()
832 	{
833 		//      Request the focus for the component that should have the focus by default.
834 		return false;
835 	}
836 
requestFocus()837 	public void requestFocus()
838 	{
839 		//      Set focus on the receiving component if isRequestFocusEnabled returns true
840 		super.requestFocus();
841 	}
842 
resetKeyboardActions()843 	public void resetKeyboardActions()
844 	{
845 		//      Unregister all keyboard actions
846 	}
847 
reshape(int x, int y, int w, int h)848 	public void reshape(int x, int y, int w, int h)
849 	{
850 		///      Moves and resizes this component.
851 		super.reshape(x,y,w,h);
852 	}
853 
revalidate()854 	public void revalidate()
855 	{
856 		//     Support for deferred automatic layout.
857 		if (getParent() == null)
858 			invalidate();
859 	}
860 
scrollRectToVisible(Rectangle aRect)861 	public void scrollRectToVisible(Rectangle aRect)
862 	{
863 		//      Forwards the scrollRectToVisible() message to the JComponent's parent.
864 	}
865 
setAlignmentX(float alignmentX)866 	public void setAlignmentX(float alignmentX)
867 	{
868 		//      Set the the vertical alignment.
869 	}
870 
setAlignmentY(float alignmentY)871 	public void setAlignmentY(float alignmentY)
872 	{
873 		//      Set the the horizontal alignment.
874 	}
875 
setAutoscrolls(boolean autoscrolls)876 	public void setAutoscrolls(boolean autoscrolls)
877 	{
878 		//      If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport
879 	}
880 
setDebugGraphicsOptions(int debugOptions)881 	public void setDebugGraphicsOptions(int debugOptions)
882 	{
883 		//      Enables or disables diagnostic information about every graphics operation performed within the component or one of its children.
884 	}
885 
setDoubleBuffered(boolean aFlag)886 	public void setDoubleBuffered(boolean aFlag)
887 	{
888 		use_double_buffer = aFlag;
889 	}
890 
setEnabled(boolean enabled)891 	public void setEnabled(boolean enabled)
892 	{
893 		// Sets whether or not this component is enabled.
894 		super.setEnabled(enabled);
895 		repaint();
896 	}
897 
setFont(Font font)898 	public void setFont(Font font)
899 	{
900 		super.setFont(font);
901 		revalidate();
902 		repaint();
903 	}
904 
setBackground(Color bg)905 	public void setBackground(Color bg)
906 	{
907 		super.setBackground(bg);
908 		revalidate();
909 		repaint();
910 	}
setForeground(Color fg)911 	public void setForeground(Color fg)
912 	{
913 		super.setForeground(fg);
914 		revalidate();
915 		repaint();
916 	}
917 
setMaximumSize(Dimension maximumSize)918 	public void setMaximumSize(Dimension maximumSize)
919 	{	max = maximumSize;    }
920 
setMinimumSize(Dimension minimumSize)921 	public void setMinimumSize(Dimension minimumSize)
922 	{   min = minimumSize; }
923 
setPreferredSize(Dimension preferredSize)924 	public void setPreferredSize(Dimension preferredSize)
925 	{   pref = preferredSize;   }
926 
setNextFocusableComponent(Component aComponent)927 	public void setNextFocusableComponent(Component aComponent)
928 	{
929 		//       Specifies the next component to get the focus after this one, for example, when the tab key is pressed.
930 	}
931 
setOpaque(boolean isOpaque)932 	public void setOpaque(boolean isOpaque)
933 	{
934 		opaque = isOpaque;
935 		revalidate();
936 		repaint();
937 	}
938 
939 
setRequestFocusEnabled(boolean aFlag)940 	public void setRequestFocusEnabled(boolean aFlag)
941 	{
942 	}
943 
944 
setVisible(boolean aFlag)945 	public void setVisible(boolean aFlag)
946 	{
947 		//    Makes the component visible or invisible.
948 
949 		super.setVisible(aFlag);
950 		if (getParent() != null)
951 		{
952 			Rectangle dims = getBounds();
953 			getParent().repaint((int)dims.getX(),
954 			                    (int)dims.getY(),
955 			                    (int)dims.getWidth(),
956 			                    (int)dims.getHeight());
957 		}
958 	}
959 
unregisterKeyboardAction(KeyStroke aKeyStroke)960 	public void unregisterKeyboardAction(KeyStroke aKeyStroke)
961 	{
962 		//          Unregister a keyboard action.
963 	}
964 
965 
update(Graphics g)966 	public void update(Graphics g)
967 	{
968 		paint(g);
969 	}
970 
getUIClassID()971         public String getUIClassID()
972 	{
973 		///          Return the UIDefaults key used to look up the name of the swing.
974 		return "JComponent";
975 	}
976 
setUI(ComponentUI newUI)977 	protected void setUI(ComponentUI newUI)
978 	{
979 		if (ui != null)
980 		{
981 			ui.uninstallUI(this);
982 		}
983 
984 		//          Set the look and feel delegate for this component.
985 		ui = newUI;
986 
987 		if (ui != null)
988 		{
989 			ui.installUI(this);
990 		}
991 
992 		revalidate();
993 		repaint();
994 	}
995 
updateUI()996 	public void updateUI()
997 	{
998 		//        Resets the UI property to a value from the current look and feel.
999 		System.out.println("update UI not overwritten in class: " + this);
1000 	}
1001 
1002 }
1003