public static void setIconOnFrame(JFrame frame) { if (logoImage == null) { URL logoResourceURL = frame.getClass().getResource("/resources/SkyggeLogo.png"); ImageIcon logoImageIcon = new ImageIcon(logoResourceURL); logoImage = logoImageIcon.getImage(); } frame.setIconImage(logoImage); }
public JFrame createFrame() { final JFrame frame = new JFrame("Commandes clients"); // Actions frame.getContentPane().add(createAllOrderPanel()); final SQLElement eltCmd = Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT"); FrameUtil.setBounds(frame); final File file = IListFrame.getConfigFile(eltCmd, frame.getClass()); if (file != null) new WindowStateManager(frame, file).loadState(); return frame; }
ThemeManager(final JFrame frame) { // this line needs to be implemented in order to make JWS work properly UIManager.getLookAndFeelDefaults().put("ClassLoader", frame.getClass().getClassLoader()); try { // This could fail if JGoodies is not available com.jgoodies.looks.Options.setPopupDropShadowEnabled(true); // Enabled JGoodies drop shadow } catch (Exception e) { Logger.getLogger(ThemeManager.class.getName()) .log(Level.FINE, "JGoodies L&F was not found", e); } Preferences pref = Preferences.userNodeForPackage(ThemeManager.class); setLookAndFeel(pref.get(LF, UIManager.getCrossPlatformLookAndFeelClassName())); }
public static void setAutoRequestFocus(JFrame window, boolean autoRequestFocus) { try { Method setAutoRequestFocusMethod = window.getClass().getMethod("setAutoRequestFocus", boolean.class); setAutoRequestFocusMethod.invoke(window, autoRequestFocus); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } catch (SecurityException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } }
/** * Coloca o ícone do sistema no canto superior esquerdo de um frame. * * <p>Estando o path na variável: {@link tolteco.sigma.view.ViewUtils#logoResource}. * * @param frame para colocar a logo do sistema. */ public static void setSIGMAIcon(JFrame frame) { frame.setIconImage( Toolkit.getDefaultToolkit().getImage(frame.getClass().getResource(logoResource))); }