2254 private static synchronized boolean isUpdatePending() {
2255 return updatePending;
2256 }
2257
2258 protected void updateUI() {
2259 if (!isUpdatePending()) {
2260 setUpdatePending(true);
2261 Runnable uiUpdater = new Runnable() {
2262 public void run() {
2263 updateAllUIs();
2264 setUpdatePending(false);
2265 }
2266 };
2267 SwingUtilities.invokeLater(uiUpdater);
2268 }
2269 }
2270 }
2271
2272 // From the JLF Design Guidelines:
2273 // http://www.oracle.com/technetwork/java/jlf-135985.html
2274 private static class MetalLayoutStyle extends DefaultLayoutStyle {
2275 private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
2276
2277 @Override
2278 public int getPreferredGap(JComponent component1,
2279 JComponent component2, ComponentPlacement type, int position,
2280 Container parent) {
2281 // Checks args
2282 super.getPreferredGap(component1, component2, type, position,
2283 parent);
2284
2285 int offset = 0;
2286
2287 switch(type) {
2288 case INDENT:
2289 // Metal doesn't spec this.
2290 if (position == SwingConstants.EAST ||
2291 position == SwingConstants.WEST) {
2292 int indent = getIndent(component1, position);
2293 if (indent > 0) {
|
2254 private static synchronized boolean isUpdatePending() {
2255 return updatePending;
2256 }
2257
2258 protected void updateUI() {
2259 if (!isUpdatePending()) {
2260 setUpdatePending(true);
2261 Runnable uiUpdater = new Runnable() {
2262 public void run() {
2263 updateAllUIs();
2264 setUpdatePending(false);
2265 }
2266 };
2267 SwingUtilities.invokeLater(uiUpdater);
2268 }
2269 }
2270 }
2271
2272 // From the JLF Design Guidelines:
2273 // http://www.oracle.com/technetwork/java/jlf-135985.html
2274 @SuppressWarnings("fallthrough")
2275 private static class MetalLayoutStyle extends DefaultLayoutStyle {
2276 private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
2277
2278 @Override
2279 public int getPreferredGap(JComponent component1,
2280 JComponent component2, ComponentPlacement type, int position,
2281 Container parent) {
2282 // Checks args
2283 super.getPreferredGap(component1, component2, type, position,
2284 parent);
2285
2286 int offset = 0;
2287
2288 switch(type) {
2289 case INDENT:
2290 // Metal doesn't spec this.
2291 if (position == SwingConstants.EAST ||
2292 position == SwingConstants.WEST) {
2293 int indent = getIndent(component1, position);
2294 if (indent > 0) {
|