equal
deleted
inserted
replaced
114 throw new RuntimeException("Problem with test case - never got OOME"); |
114 throw new RuntimeException("Problem with test case - never got OOME"); |
115 } |
115 } |
116 |
116 |
117 System.out.println("Got OOME"); |
117 System.out.println("Got OOME"); |
118 } |
118 } |
|
119 |
|
120 /** |
|
121 * Find a sub component by class name. |
|
122 * Always run this method on the EDT thread |
|
123 */ |
|
124 public static Component findSubComponent(Component parent, String className) { |
|
125 String parentClassName = parent.getClass().getName(); |
|
126 |
|
127 if (parentClassName.contains(className)) { |
|
128 return parent; |
|
129 } |
|
130 |
|
131 if (parent instanceof Container) { |
|
132 for (Component child : ((Container) parent).getComponents()) { |
|
133 Component subComponent = findSubComponent(child, className); |
|
134 |
|
135 if (subComponent != null) { |
|
136 return subComponent; |
|
137 } |
|
138 } |
|
139 } |
|
140 |
|
141 return null; |
|
142 } |
119 } |
143 } |