1473 |
if (g.getClip() == null) |
if (g.getClip() == null) |
1474 |
g.setClip(0, 0, getWidth(), getHeight()); |
g.setClip(0, 0, getWidth(), getHeight()); |
1475 |
paintComponent(g); |
paintComponent(g); |
|
paintChildren(g); |
|
1476 |
paintBorder(g); |
paintBorder(g); |
1477 |
|
paintChildren(g); |
1478 |
} |
} |
1479 |
} |
} |
1480 |
|
|
2869 |
*/ |
*/ |
2870 |
public void reshape(int x, int y, int w, int h) |
public void reshape(int x, int y, int w, int h) |
2871 |
{ |
{ |
2872 |
|
int oldX = getX(); |
2873 |
|
int oldY = getY(); |
2874 |
super.reshape(x, y, w, h); |
super.reshape(x, y, w, h); |
2875 |
|
// Notify AncestorListeners. |
2876 |
|
if (oldX != getX() || oldY != getY()) |
2877 |
|
fireAncestorEvent(this, AncestorEvent.ANCESTOR_MOVED); |
2878 |
|
} |
2879 |
|
|
2880 |
|
/** |
2881 |
|
* Fires an AncestorEvent to this component's and all of its child |
2882 |
|
* component's AncestorListeners. |
2883 |
|
* |
2884 |
|
* @param ancestor the component that triggered the event |
2885 |
|
* @param id the kind of ancestor event that should be fired |
2886 |
|
*/ |
2887 |
|
void fireAncestorEvent(JComponent ancestor, int id) |
2888 |
|
{ |
2889 |
|
// Fire event for registered ancestor listeners of this component. |
2890 |
|
AncestorListener[] listeners = getAncestorListeners(); |
2891 |
|
if (listeners.length > 0) |
2892 |
|
{ |
2893 |
|
AncestorEvent ev = new AncestorEvent(this, id, |
2894 |
|
ancestor, ancestor.getParent()); |
2895 |
|
for (int i = 0; i < listeners.length; i++) |
2896 |
|
{ |
2897 |
|
switch (id) |
2898 |
|
{ |
2899 |
|
case AncestorEvent.ANCESTOR_MOVED: |
2900 |
|
listeners[i].ancestorMoved(ev); |
2901 |
|
break; |
2902 |
|
case AncestorEvent.ANCESTOR_ADDED: |
2903 |
|
listeners[i].ancestorAdded(ev); |
2904 |
|
break; |
2905 |
|
case AncestorEvent.ANCESTOR_REMOVED: |
2906 |
|
listeners[i].ancestorRemoved(ev); |
2907 |
|
break; |
2908 |
|
} |
2909 |
|
} |
2910 |
|
} |
2911 |
|
// Dispatch event to all children. |
2912 |
|
Component[] children = getComponents(); |
2913 |
|
for (int i = 0; i < children.length; i++) |
2914 |
|
{ |
2915 |
|
if (!(children[i] instanceof JComponent)) |
2916 |
|
continue; |
2917 |
|
JComponent jc = (JComponent) children[i]; |
2918 |
|
jc.fireAncestorEvent(ancestor, id); |
2919 |
|
} |
2920 |
} |
} |
2921 |
} |
} |