12 |
import java.util.*; |
import java.util.*; |
13 |
import java.beans.*; |
import java.beans.*; |
14 |
|
|
15 |
|
/** |
16 |
|
* Every component in swing inherits from this class (JLabel, JButton, etc). |
17 |
|
* It contains generic methods to manage events, properties and sizes. |
18 |
|
* Actual drawing of the component is channeled to a look-and-feel class |
19 |
|
* that is implemented elsewhere. |
20 |
|
* |
21 |
|
* @author Ronald Veldema (rveldema@cs.vu.nl) |
22 |
|
*/ |
23 |
|
|
24 |
public abstract class JComponent extends Container implements Serializable |
public abstract class JComponent extends Container implements Serializable |
25 |
{ |
{ |
26 |
Dimension pref,min,max; |
Dimension pref,min,max; |
35 |
Vector change_list; |
Vector change_list; |
36 |
Hashtable prop_hash; |
Hashtable prop_hash; |
37 |
|
|
38 |
JComponent() |
public JComponent() |
39 |
{ |
{ |
40 |
super(); |
super(); |
41 |
super.setLayout(new FlowLayout()); |
super.setLayout(new FlowLayout()); |
42 |
|
|
43 |
//eventMask |= AWTEvent.COMP_KEY_EVENT_MASK; |
//eventMask |= AWTEvent.COMP_KEY_EVENT_MASK; |
44 |
eventMask |= AWTEvent.KEY_EVENT_MASK; |
enableEvents( AWTEvent.KEY_EVENT_MASK ); |
45 |
|
|
46 |
//updateUI(); // get a proper ui |
//updateUI(); // get a proper ui |
47 |
} |
} |
68 |
prop_hash = new Hashtable(); |
prop_hash = new Hashtable(); |
69 |
return prop_hash; |
return prop_hash; |
70 |
} |
} |
71 |
Vector get_veto_list() |
public Vector get_veto_list() |
72 |
{ |
{ |
73 |
if (veto_list == null) |
if (veto_list == null) |
74 |
veto_list = new Vector(); |
veto_list = new Vector(); |
75 |
return veto_list; |
return veto_list; |
76 |
} |
} |
77 |
Vector get_change_list() |
public Vector get_change_list() |
78 |
{ |
{ |
79 |
if (change_list == null) |
if (change_list == null) |
80 |
change_list = new Vector(); |
change_list = new Vector(); |
81 |
return change_list; |
return change_list; |
82 |
} |
} |
83 |
Vector get_ancestor_list() |
public Vector get_ancestor_list() |
84 |
{ |
{ |
85 |
if (ancestor_list == null) |
if (ancestor_list == null) |
86 |
ancestor_list = new Vector(); |
ancestor_list = new Vector(); |
87 |
return ancestor_list; |
return ancestor_list; |
88 |
} |
} |
89 |
|
|
90 |
Object getClientProperty(Object key) |
public Object getClientProperty(Object key) |
91 |
{ return get_prop_hash().get(key); } |
{ return get_prop_hash().get(key); } |
92 |
|
|
93 |
void putClientProperty(Object key, Object value) |
public void putClientProperty(Object key, Object value) |
94 |
{ get_prop_hash().put(key, value); } |
{ get_prop_hash().put(key, value); } |
95 |
|
|
96 |
|
|
97 |
void removeAncestorListener(AncestorListener listener) |
public void removeAncestorListener(AncestorListener listener) |
98 |
{ get_ancestor_list().removeElement(listener); } |
{ get_ancestor_list().removeElement(listener); } |
99 |
|
|
100 |
void removePropertyChangeListener(PropertyChangeListener listener) |
public void removePropertyChangeListener(PropertyChangeListener listener) |
101 |
{ get_change_list().removeElement(listener); } |
{ get_change_list().removeElement(listener); } |
102 |
|
|
103 |
void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) |
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) |
104 |
{ /* FIXME */ get_change_list().removeElement(listener); } |
{ /* FIXME */ get_change_list().removeElement(listener); } |
105 |
|
|
106 |
void removeVetoableChangeListener(VetoableChangeListener listener) |
public void removeVetoableChangeListener(VetoableChangeListener listener) |
107 |
{ get_veto_list().removeElement(listener); } |
{ get_veto_list().removeElement(listener); } |
108 |
|
|
109 |
void addAncestorListener(AncestorListener listener) |
public void addAncestorListener(AncestorListener listener) |
110 |
{ get_ancestor_list().addElement(listener); } |
{ get_ancestor_list().addElement(listener); } |
111 |
|
|
112 |
void addPropertyChangeListener(PropertyChangeListener listener) |
public void addPropertyChangeListener(PropertyChangeListener listener) |
113 |
{ get_change_list().addElement(listener); } |
{ get_change_list().addElement(listener); } |
114 |
|
|
115 |
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) |
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) |
116 |
{ /* FIXME */ get_change_list().addElement(listener); } |
{ /* FIXME */ get_change_list().addElement(listener); } |
117 |
|
|
118 |
void addVetoableChangeListener(VetoableChangeListener listener) |
public void addVetoableChangeListener(VetoableChangeListener listener) |
119 |
{ get_veto_list().addElement(listener); } |
{ get_veto_list().addElement(listener); } |
120 |
|
|
121 |
void computeVisibleRect(Rectangle rect) |
public void computeVisibleRect(Rectangle rect) |
122 |
{ |
{ |
123 |
//Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors. |
//Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors. |
124 |
//super.computeVisibleRect(rect); |
//super.computeVisibleRect(rect); |
125 |
} |
} |
126 |
|
|
127 |
|
|
128 |
void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) |
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) |
129 |
{ |
{ |
130 |
//Reports a bound property change. |
//Reports a bound property change. |
131 |
} |
} |
132 |
void firePropertyChange(String propertyName, byte oldValue, byte newValue) |
public void firePropertyChange(String propertyName, byte oldValue, byte newValue) |
133 |
{ |
{ |
134 |
// Reports a bound property change. |
// Reports a bound property change. |
135 |
} |
} |
136 |
void firePropertyChange(String propertyName, char oldValue, char newValue) |
public void firePropertyChange(String propertyName, char oldValue, char newValue) |
137 |
{ |
{ |
138 |
//Reports a bound property change. |
//Reports a bound property change. |
139 |
} |
} |
140 |
|
|
141 |
void firePropertyChange(String propertyName, double oldValue, double newValue) |
public void firePropertyChange(String propertyName, double oldValue, double newValue) |
142 |
{ |
{ |
143 |
//Reports a bound property change. |
//Reports a bound property change. |
144 |
} |
} |
145 |
|
|
146 |
void firePropertyChange(String propertyName, float oldValue, float newValue) |
public void firePropertyChange(String propertyName, float oldValue, float newValue) |
147 |
{ |
{ |
148 |
// Reports a bound property change. |
// Reports a bound property change. |
149 |
} |
} |
150 |
void firePropertyChange(String propertyName, int oldValue, int newValue) |
public void firePropertyChange(String propertyName, int oldValue, int newValue) |
151 |
{ |
{ |
152 |
// Reports a bound property change. |
// Reports a bound property change. |
153 |
} |
} |
154 |
void firePropertyChange(String propertyName, long oldValue, long newValue) |
public void firePropertyChange(String propertyName, long oldValue, long newValue) |
155 |
{ |
{ |
156 |
//Reports a bound property change. protected |
//Reports a bound property change. protected |
157 |
} |
} |
158 |
|
|
159 |
void firePropertyChange(String propertyName, Object oldValue, Object newValue) |
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) |
160 |
{ |
{ |
161 |
// Support for reporting bound property changes. |
// Support for reporting bound property changes. |
162 |
} |
} |
163 |
void firePropertyChange(String propertyName, short oldValue, short newValue) |
public void firePropertyChange(String propertyName, short oldValue, short newValue) |
164 |
{ |
{ |
165 |
// Reports a bound property change. |
// Reports a bound property change. |
166 |
} |
} |
171 |
// Support for reporting constrained property changes. |
// Support for reporting constrained property changes. |
172 |
} |
} |
173 |
|
|
174 |
AccessibleContext getAccessibleContext() |
public AccessibleContext getAccessibleContext() |
175 |
{ |
{ |
176 |
// Get the AccessibleContext associated with this JComponent |
// Get the AccessibleContext associated with this JComponent |
177 |
return null; |
return null; |
178 |
} |
} |
179 |
ActionListener getActionForKeyStroke(KeyStroke aKeyStroke) |
|
180 |
|
public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke) |
181 |
{ |
{ |
182 |
//Return the object that will perform the action registered for a given keystroke. |
//Return the object that will perform the action registered for a given keystroke. |
183 |
return null; |
return null; |
193 |
// Overrides Container.getAlignmentY to return the horizontal alignment. |
// Overrides Container.getAlignmentY to return the horizontal alignment. |
194 |
return 0; |
return 0; |
195 |
} |
} |
196 |
boolean getAutoscrolls() |
public boolean getAutoscrolls() |
197 |
{ |
{ |
198 |
//Returns true if this component automatically scrolls its contents when dragged, (when contained in a component that supports scrolling, like JViewport |
//Returns true if this component automatically scrolls its contents when dragged, (when contained in a component that supports scrolling, like JViewport |
199 |
return false; |
return false; |
211 |
{ return border; } |
{ return border; } |
212 |
|
|
213 |
|
|
214 |
Rectangle getBounds(Rectangle rv) |
public Rectangle getBounds(Rectangle rv) |
215 |
{ |
{ |
216 |
if (rv == null) |
if (rv == null) |
217 |
return new Rectangle(x,y,width,height); |
return new Rectangle(getX(),getY(),getWidth(),getHeight()); |
218 |
else |
else |
219 |
{ |
{ |
220 |
rv.setBounds(x,y,width, height); |
rv.setBounds(getX(),getY(),getWidth(),getHeight()); |
221 |
return rv; |
return rv; |
222 |
} |
} |
223 |
} |
} |
225 |
protected Graphics getComponentGraphics(Graphics g) |
protected Graphics getComponentGraphics(Graphics g) |
226 |
{ return g; } |
{ return g; } |
227 |
|
|
228 |
int getConditionForKeyStroke(KeyStroke aKeyStroke) |
public int getConditionForKeyStroke(KeyStroke aKeyStroke) |
229 |
{ |
{ |
230 |
//Return the condition that determines whether a registered action occurs in response to the specified keystroke. |
//Return the condition that determines whether a registered action occurs in response to the specified keystroke. |
231 |
return 0; |
return 0; |
232 |
} |
} |
233 |
int getDebugGraphicsOptions() |
public int getDebugGraphicsOptions() |
234 |
{ |
{ |
235 |
return 0; |
return 0; |
236 |
} |
} |
256 |
return getBorder().getBorderInsets(this); |
return getBorder().getBorderInsets(this); |
257 |
} |
} |
258 |
|
|
259 |
Insets getInsets(Insets insets) |
public Insets getInsets(Insets insets) |
260 |
{ |
{ |
261 |
if (insets == null) |
Insets t = getInsets(); |
262 |
return getInsets(); |
|
263 |
return new Insets(getInsets()); |
if (insets == null) |
264 |
|
return t; |
265 |
|
|
266 |
|
|
267 |
|
return new Insets(t.top, t.left, t.bottom, t.right); |
268 |
} |
} |
269 |
Point getLocation(Point rv) |
public Point getLocation(Point rv) |
270 |
{ |
{ |
271 |
//Store the x,y origin of this component into "return value" rv and return rv. |
//Store the x,y origin of this component into "return value" rv and return rv. |
272 |
|
|
273 |
if (rv == null) |
if (rv == null) |
274 |
return new Point(x,y); |
return new Point(getX(), |
275 |
|
getY()); |
276 |
|
|
277 |
rv.setLocation(x, |
rv.setLocation(getX(), |
278 |
y); |
getY()); |
279 |
return rv; |
return rv; |
280 |
} |
} |
281 |
|
|
288 |
} |
} |
289 |
if (ui != null) |
if (ui != null) |
290 |
{ |
{ |
291 |
Dimension s = ui.getMaximumSize(this); |
Dimension s = ui.getMaximumSize(this); |
292 |
if (s != null) |
if (s != null) |
293 |
{ |
{ |
294 |
//System.out.println(" UI-MAX = " + s + ", UI = " + ui + ", IM="+this); |
//System.out.println(" UI-MAX = " + s + ", UI = " + ui + ", IM="+this); |
295 |
return s; |
return s; |
343 |
return p; |
return p; |
344 |
} |
} |
345 |
|
|
346 |
Component getNextFocusableComponent() |
public Component getNextFocusableComponent() |
347 |
{ |
{ |
348 |
// Return the next focusable component or null if the focus manager should choose the next focusable component automatically |
// Return the next focusable component or null if the focus manager should choose the next focusable component automatically |
349 |
return null; |
return null; |
350 |
} |
} |
351 |
|
|
352 |
|
|
353 |
KeyStroke[] getRegisteredKeyStrokes() |
public KeyStroke[] getRegisteredKeyStrokes() |
354 |
{ |
{ |
355 |
// Return the KeyStrokes that will initiate registered actions. |
// Return the KeyStrokes that will initiate registered actions. |
356 |
return null; |
return null; |
357 |
} |
} |
358 |
|
|
359 |
JRootPane getRootPane() |
public JRootPane getRootPane() |
360 |
{ |
{ |
361 |
JRootPane p = SwingUtilities.getRootPane(this); |
JRootPane p = SwingUtilities.getRootPane(this); |
362 |
System.out.println("root = " + p); |
System.out.println("root = " + p); |
363 |
return p; |
return p; |
364 |
} |
} |
365 |
|
|
366 |
Dimension getSize(Dimension rv) |
public Dimension getSize(Dimension rv) |
367 |
{ |
{ |
368 |
// System.out.println("JComponent, getsize()"); |
// System.out.println("JComponent, getsize()"); |
369 |
if (rv == null) |
if (rv == null) |
387 |
* |
* |
388 |
**************************************/ |
**************************************/ |
389 |
|
|
390 |
JToolTip createToolTip() |
public JToolTip createToolTip() |
391 |
{ |
{ |
392 |
if (tooltip == null) |
if (tooltip == null) |
393 |
tooltip = new JToolTip(tool_tip_text); |
tooltip = new JToolTip(tool_tip_text); |
395 |
} |
} |
396 |
|
|
397 |
public Point getToolTipLocation(MouseEvent event) |
public Point getToolTipLocation(MouseEvent event) |
398 |
{ return null; } |
{ return null; } |
399 |
|
|
400 |
void setToolTipText(String text) |
public void setToolTipText(String text) |
401 |
{ tool_tip_text = text; } |
{ tool_tip_text = text; } |
402 |
|
|
403 |
String getToolTipText() |
public String getToolTipText() |
404 |
{ return tool_tip_text; } |
{ return tool_tip_text; } |
405 |
|
|
406 |
public String getToolTipText(MouseEvent event) |
public String getToolTipText(MouseEvent event) |
415 |
**************************************/ |
**************************************/ |
416 |
|
|
417 |
|
|
418 |
Container getTopLevelAncestor() |
public Container getTopLevelAncestor() |
419 |
{ |
{ |
420 |
// 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. |
// 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. |
421 |
System.out.println("JComponent, getTopLevelAncestor()"); |
System.out.println("JComponent, getTopLevelAncestor()"); |
422 |
return null; |
return null; |
423 |
} |
} |
424 |
|
|
425 |
Rectangle getVisibleRect() |
public Rectangle getVisibleRect() |
426 |
{ |
{ |
427 |
/// Returns the Component's "visible rectangle" - the intersection of this components visible rectangle: |
/// Returns the Component's "visible rectangle" - the intersection of this components visible rectangle: |
428 |
System.out.println("JComponent, getVisibleRect()"); |
System.out.println("JComponent, getVisibleRect()"); |
429 |
return null; |
return null; |
430 |
} |
} |
431 |
|
|
432 |
|
public void grabFocus() |
|
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() |
|
433 |
{ |
{ |
434 |
// Set the focus on the receiving component. |
// Set the focus on the receiving component. |
435 |
} |
} |
436 |
|
|
437 |
boolean hasFocus() |
public boolean hasFocus() |
438 |
{ |
{ |
439 |
// Returns true if this Component has the keyboard focus. |
// Returns true if this Component has the keyboard focus. |
440 |
return false; |
return false; |
443 |
public boolean isDoubleBuffered() |
public boolean isDoubleBuffered() |
444 |
{ return use_double_buffer; } |
{ return use_double_buffer; } |
445 |
|
|
446 |
boolean isFocusCycleRoot() |
public boolean isFocusCycleRoot() |
447 |
{ |
{ |
448 |
// Override this method and return true if your component is the root of of a component tree with its own focus cycle. |
// Override this method and return true if your component is the root of of a component tree with its own focus cycle. |
449 |
return false; |
return false; |
455 |
return false; |
return false; |
456 |
} |
} |
457 |
|
|
458 |
static boolean isLightweightComponent(Component c) |
public static boolean isLightweightComponent(Component c) |
459 |
{ |
{ |
460 |
return c.getPeer() instanceof LightweightPeer; |
return c.getPeer() instanceof LightweightPeer; |
461 |
} |
} |
462 |
|
|
463 |
boolean isManagingFocus() |
public boolean isManagingFocus() |
464 |
{ |
{ |
465 |
// Override this method and return true if your JComponent manages focus. |
// Override this method and return true if your JComponent manages focus. |
466 |
return false; |
return false; |
467 |
} |
} |
468 |
|
|
469 |
boolean isOpaque() |
public boolean isOpaque() |
470 |
{ return opaque; } |
{ return opaque; } |
471 |
|
|
472 |
boolean isOptimizedDrawingEnabled() |
public boolean isOptimizedDrawingEnabled() |
473 |
{ |
{ |
474 |
// Returns true if this component tiles its children, |
// Returns true if this component tiles its children, |
475 |
return true; |
return true; |
476 |
} |
} |
477 |
|
|
478 |
boolean isPaintingTile() |
public boolean isPaintingTile() |
479 |
{ |
{ |
480 |
// Returns true if the receiving component is currently painting a tile. |
// Returns true if the receiving component is currently painting a tile. |
481 |
return false; |
return false; |
482 |
} |
} |
483 |
|
|
484 |
boolean isRequestFocusEnabled() |
public boolean isRequestFocusEnabled() |
485 |
{ |
{ |
486 |
// Return whether the receiving component can obtain the focus by calling requestFocus |
// Return whether the receiving component can obtain the focus by calling requestFocus |
487 |
return false; |
return false; |
488 |
} |
} |
489 |
|
|
490 |
boolean isValidateRoot() |
public boolean isValidateRoot() |
491 |
{ |
{ |
492 |
// If this method returns true, revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated. |
// If this method returns true, revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated. |
493 |
return false; |
return false; |
522 |
|
|
523 |
protected void paintChildren(Graphics g) |
protected void paintChildren(Graphics g) |
524 |
{ |
{ |
525 |
// Paint this component's children. |
// Paint this component's children. |
526 |
super.paintChildren(g); |
//super.paintChildren(g); |
527 |
} |
} |
528 |
|
|
529 |
protected void paintComponent(Graphics g) |
protected void paintComponent(Graphics g) |
534 |
ui.paint(g, this); |
ui.paint(g, this); |
535 |
} |
} |
536 |
} |
} |
537 |
|
|
538 |
void paintImmediately(int x, int y, int w, int h) |
/** |
539 |
{ |
* Paint the specified region in this component and all of |
540 |
// Paint the specified region in this component and all of its descendants that overlap the region, immediately. |
* its descendants that overlap the region, immediately. |
541 |
} |
*/ |
542 |
|
public void paintImmediately(int x, int y, int w, int h) |
543 |
void paintImmediately(Rectangle r) |
{ |
544 |
{ |
|
545 |
/// Paint the specified region now. |
//Ronald: this shoudld probably redirect to the PLAF .... |
546 |
paintImmediately(r.x, |
} |
547 |
r.y, |
|
548 |
r.width, |
public void paintImmediately(Rectangle r) |
549 |
r.height); |
{ |
550 |
|
/// Paint the specified region now. |
551 |
|
paintImmediately((int)r.getX(), |
552 |
|
(int)r.getY(), |
553 |
|
(int)r.getWidth(), |
554 |
|
(int)r.getHeight()); |
555 |
} |
} |
556 |
protected String paramString() |
protected String paramString() |
557 |
{ |
{ |
581 |
//System.out.println("COMP_MOUSE-EVENT: " + e + ", MEMORY = " + Runtime.getRuntime().freeMemory()); |
//System.out.println("COMP_MOUSE-EVENT: " + e + ", MEMORY = " + Runtime.getRuntime().freeMemory()); |
582 |
} |
} |
583 |
|
|
584 |
void registerKeyboardAction(ActionListener anAction, |
public void registerKeyboardAction(ActionListener anAction, |
585 |
KeyStroke aKeyStroke, |
KeyStroke aKeyStroke, |
586 |
int aCondition) |
int aCondition) |
587 |
{ |
{ |
591 |
aCondition); |
aCondition); |
592 |
} |
} |
593 |
|
|
594 |
void registerKeyboardAction(ActionListener anAction, |
public void registerKeyboardAction(ActionListener anAction, |
595 |
String aCommand, |
String aCommand, |
596 |
KeyStroke aKeyStroke, |
KeyStroke aKeyStroke, |
597 |
int aCondition) |
int aCondition) |
612 |
super.repaint(tm, x,y,width,height); |
super.repaint(tm, x,y,width,height); |
613 |
} |
} |
614 |
|
|
615 |
void repaint(Rectangle r) |
public void repaint(Rectangle r) |
616 |
{ |
{ |
617 |
// Adds the specified region to the dirty region list if the component is showing. |
// Adds the specified region to the dirty region list if the component is showing. |
618 |
repaint(0, |
repaint((long)0, |
619 |
r.x, |
(int)r.getX(), |
620 |
r.y, |
(int)r.getY(), |
621 |
r.width, |
(int)r.getWidth(), |
622 |
r.height); |
(int)r.getHeight()); |
623 |
} |
} |
624 |
|
|
625 |
boolean requestDefaultFocus() |
public boolean requestDefaultFocus() |
626 |
{ |
{ |
627 |
// Request the focus for the component that should have the focus by default. |
// Request the focus for the component that should have the focus by default. |
628 |
return false; |
return false; |
634 |
super.requestFocus(); |
super.requestFocus(); |
635 |
} |
} |
636 |
|
|
637 |
void resetKeyboardActions() |
public void resetKeyboardActions() |
638 |
{ |
{ |
639 |
// Unregister all keyboard actions |
// Unregister all keyboard actions |
640 |
} |
} |
645 |
super.reshape(x,y,w,h); |
super.reshape(x,y,w,h); |
646 |
} |
} |
647 |
|
|
648 |
void revalidate() |
public void revalidate() |
649 |
{ |
{ |
650 |
// Support for deferred automatic layout. |
// Support for deferred automatic layout. |
651 |
if (getParent() == null) |
if (getParent() == null) |
652 |
invalidate(); |
invalidate(); |
653 |
} |
} |
654 |
|
|
655 |
void scrollRectToVisible(Rectangle aRect) |
public void scrollRectToVisible(Rectangle aRect) |
656 |
{ |
{ |
657 |
// Forwards the scrollRectToVisible() message to the JComponent's parent. |
// Forwards the scrollRectToVisible() message to the JComponent's parent. |
658 |
} |
} |
659 |
|
|
660 |
void setAlignmentX(float alignmentX) |
public void setAlignmentX(float alignmentX) |
661 |
{ |
{ |
662 |
// Set the the vertical alignment. |
// Set the the vertical alignment. |
663 |
} |
} |
664 |
|
|
665 |
void setAlignmentY(float alignmentY) |
public void setAlignmentY(float alignmentY) |
666 |
{ |
{ |
667 |
// Set the the horizontal alignment. |
// Set the the horizontal alignment. |
668 |
} |
} |
669 |
|
|
670 |
void setAutoscrolls(boolean autoscrolls) |
public void setAutoscrolls(boolean autoscrolls) |
671 |
{ |
{ |
672 |
// If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport |
// If true this component will automatically scroll its contents when dragged, if contained in a component that supports scrolling, such as JViewport |
673 |
} |
} |
674 |
|
|
675 |
|
|
676 |
void setDebugGraphicsOptions(int debugOptions) |
public void setDebugGraphicsOptions(int debugOptions) |
677 |
{ |
{ |
678 |
// Enables or disables diagnostic information about every graphics operation performed within the component or one of its children. |
// Enables or disables diagnostic information about every graphics operation performed within the component or one of its children. |
679 |
} |
} |
680 |
|
|
681 |
void setDoubleBuffered(boolean aFlag) |
public void setDoubleBuffered(boolean aFlag) |
682 |
{ |
{ |
683 |
use_double_buffer = aFlag; |
use_double_buffer = aFlag; |
684 |
} |
} |
709 |
repaint(); |
repaint(); |
710 |
} |
} |
711 |
|
|
712 |
void setMaximumSize(Dimension maximumSize) |
public void setMaximumSize(Dimension maximumSize) |
713 |
{ max = maximumSize; } |
{ max = maximumSize; } |
714 |
|
|
715 |
void setMinimumSize(Dimension minimumSize) |
public void setMinimumSize(Dimension minimumSize) |
716 |
{ min = minimumSize; } |
{ min = minimumSize; } |
717 |
|
|
718 |
void setPreferredSize(Dimension preferredSize) |
public void setPreferredSize(Dimension preferredSize) |
719 |
{ pref = preferredSize; } |
{ pref = preferredSize; } |
720 |
|
|
721 |
void setNextFocusableComponent(Component aComponent) |
public void setNextFocusableComponent(Component aComponent) |
722 |
{ |
{ |
723 |
// Specifies the next component to get the focus after this one, for example, when the tab key is pressed. |
// Specifies the next component to get the focus after this one, for example, when the tab key is pressed. |
724 |
} |
} |
725 |
|
|
726 |
void setOpaque(boolean isOpaque) |
public void setOpaque(boolean isOpaque) |
727 |
{ |
{ |
728 |
opaque = isOpaque; |
opaque = isOpaque; |
729 |
revalidate(); |
revalidate(); |
731 |
} |
} |
732 |
|
|
733 |
|
|
734 |
void setRequestFocusEnabled(boolean aFlag) |
public void setRequestFocusEnabled(boolean aFlag) |
735 |
{ |
{ |
736 |
} |
} |
737 |
|
|
744 |
if (getParent() != null) |
if (getParent() != null) |
745 |
{ |
{ |
746 |
Rectangle dims = getBounds(); |
Rectangle dims = getBounds(); |
747 |
getParent().repaint(dims.x, |
getParent().repaint((int)dims.getX(), |
748 |
dims.y, |
(int)dims.getY(), |
749 |
dims.width, |
(int)dims.getWidth(), |
750 |
dims.height); |
(int)dims.getHeight()); |
751 |
} |
} |
752 |
} |
} |
753 |
|
|
754 |
void unregisterKeyboardAction(KeyStroke aKeyStroke) |
public void unregisterKeyboardAction(KeyStroke aKeyStroke) |
755 |
{ |
{ |
756 |
// Unregister a keyboard action. |
// Unregister a keyboard action. |
757 |
} |
} |
772 |
* |
* |
773 |
*********/ |
*********/ |
774 |
|
|
775 |
String getUIClassID() |
public String getUIClassID() |
776 |
{ |
{ |
777 |
/// Return the UIDefaults key used to look up the name of the swing. |
/// Return the UIDefaults key used to look up the name of the swing. |
778 |
return "JComponent"; |
return "JComponent"; |
797 |
repaint(); |
repaint(); |
798 |
} |
} |
799 |
|
|
800 |
void updateUI() |
public void updateUI() |
801 |
{ |
{ |
802 |
// Resets the UI property to a value from the current look and feel. |
// Resets the UI property to a value from the current look and feel. |
803 |
System.out.println("update UI not overwritten in class: " + this); |
System.out.println("update UI not overwritten in class: " + this); |