src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java

Print this page




2344          */
2345         private static synchronized boolean isUpdatePending() {
2346             return updatePending;
2347     }
2348 
2349         protected void updateUI() {
2350             if (!isUpdatePending()) {
2351                 setUpdatePending(true);
2352                 Runnable uiUpdater = new Runnable() {
2353                         public void run() {
2354                             updateAllUIs();
2355                             setUpdatePending(false);
2356                         }
2357                     };
2358                 SwingUtilities.invokeLater(uiUpdater);
2359             }
2360         }
2361     }
2362 
2363     // From the JLF Design Guidelines:
2364     // http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html
2365     private static class MetalLayoutStyle extends DefaultLayoutStyle {
2366         private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
2367 
2368         @Override
2369         public int getPreferredGap(JComponent component1,
2370                 JComponent component2, ComponentPlacement type, int position,
2371                 Container parent) {
2372             // Checks args
2373             super.getPreferredGap(component1, component2, type, position,
2374                                   parent);
2375 
2376             int offset = 0;
2377 
2378             switch(type) {
2379             case INDENT:
2380                 // Metal doesn't spec this.
2381                 if (position == SwingConstants.EAST ||
2382                         position == SwingConstants.WEST) {
2383                     int indent = getIndent(component1, position);
2384                     if (indent > 0) {




2344          */
2345         private static synchronized boolean isUpdatePending() {
2346             return updatePending;
2347     }
2348 
2349         protected void updateUI() {
2350             if (!isUpdatePending()) {
2351                 setUpdatePending(true);
2352                 Runnable uiUpdater = new Runnable() {
2353                         public void run() {
2354                             updateAllUIs();
2355                             setUpdatePending(false);
2356                         }
2357                     };
2358                 SwingUtilities.invokeLater(uiUpdater);
2359             }
2360         }
2361     }
2362 
2363     // From the JLF Design Guidelines:
2364     // http://www.oracle.com/technetwork/java/jlf-135985.html
2365     private static class MetalLayoutStyle extends DefaultLayoutStyle {
2366         private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
2367 
2368         @Override
2369         public int getPreferredGap(JComponent component1,
2370                 JComponent component2, ComponentPlacement type, int position,
2371                 Container parent) {
2372             // Checks args
2373             super.getPreferredGap(component1, component2, type, position,
2374                                   parent);
2375 
2376             int offset = 0;
2377 
2378             switch(type) {
2379             case INDENT:
2380                 // Metal doesn't spec this.
2381                 if (position == SwingConstants.EAST ||
2382                         position == SwingConstants.WEST) {
2383                     int indent = getIndent(component1, position);
2384                     if (indent > 0) {