1 7 8 package com.sun.java.swing.plaf.windows; 9 10 import javax.swing.plaf.*; 11 import javax.swing.*; 12 import java.awt.*; 13 14 20 21 class WindowsUtils { 22 26 static boolean isLeftToRight( Component c ) { 27 return c.getComponentOrientation().isLeftToRight(); 28 } 29 30 34 static void repaintMnemonicsInWindow(Window w) { 35 if(w == null || !w.isShowing()) { 36 return; 37 } 38 39 Window[] ownedWindows = w.getOwnedWindows(); 40 for(int i=0;i<ownedWindows.length;i++) { 41 repaintMnemonicsInWindow(ownedWindows[i]); 42 } 43 44 repaintMnemonicsInContainer(w); 45 } 46 47 51 static void repaintMnemonicsInContainer(Container cont) { 52 Component c; 53 for(int i=0; i<cont.getComponentCount(); i++) { 54 c = cont.getComponent(i); 55 if(c == null || !c.isVisible()) { 56 continue; 57 } 58 if(c instanceof AbstractButton 59 && ((AbstractButton)c).getMnemonic() != '\0') { 60 c.repaint(); 61 continue; 62 } else if(c instanceof JLabel 63 && ((JLabel)c).getDisplayedMnemonic() != '\0') { 64 c.repaint(); 65 continue; 66 } 67 if(c instanceof Container) { 68 repaintMnemonicsInContainer((Container)c); 69 } 70 } 71 } 72 } 73 | Popular Tags |