2321 private static synchronized boolean isUpdatePending() {
2322 return updatePending;
2323 }
2324
2325 protected void updateUI() {
2326 if (!isUpdatePending()) {
2327 setUpdatePending(true);
2328 Runnable uiUpdater = new Runnable() {
2329 public void run() {
2330 updateAllUIs();
2331 setUpdatePending(false);
2332 }
2333 };
2334 SwingUtilities.invokeLater(uiUpdater);
2335 }
2336 }
2337 }
2338
2339 // From the JLF Design Guidelines:
2340 // http://www.oracle.com/technetwork/java/jlf-135985.html
2341 private static class MetalLayoutStyle extends DefaultLayoutStyle {
2342 private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
2343
2344 @Override
2345 public int getPreferredGap(JComponent component1,
2346 JComponent component2, ComponentPlacement type, int position,
2347 Container parent) {
2348 // Checks args
2349 super.getPreferredGap(component1, component2, type, position,
2350 parent);
2351
2352 int offset = 0;
2353
2354 switch(type) {
2355 case INDENT:
2356 // Metal doesn't spec this.
2357 if (position == SwingConstants.EAST ||
2358 position == SwingConstants.WEST) {
2359 int indent = getIndent(component1, position);
2360 if (indent > 0) {
|
2321 private static synchronized boolean isUpdatePending() {
2322 return updatePending;
2323 }
2324
2325 protected void updateUI() {
2326 if (!isUpdatePending()) {
2327 setUpdatePending(true);
2328 Runnable uiUpdater = new Runnable() {
2329 public void run() {
2330 updateAllUIs();
2331 setUpdatePending(false);
2332 }
2333 };
2334 SwingUtilities.invokeLater(uiUpdater);
2335 }
2336 }
2337 }
2338
2339 // From the JLF Design Guidelines:
2340 // http://www.oracle.com/technetwork/java/jlf-135985.html
2341 @SuppressWarnings("fallthrough")
2342 private static class MetalLayoutStyle extends DefaultLayoutStyle {
2343 private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
2344
2345 @Override
2346 public int getPreferredGap(JComponent component1,
2347 JComponent component2, ComponentPlacement type, int position,
2348 Container parent) {
2349 // Checks args
2350 super.getPreferredGap(component1, component2, type, position,
2351 parent);
2352
2353 int offset = 0;
2354
2355 switch(type) {
2356 case INDENT:
2357 // Metal doesn't spec this.
2358 if (position == SwingConstants.EAST ||
2359 position == SwingConstants.WEST) {
2360 int indent = getIndent(component1, position);
2361 if (indent > 0) {
|