List of usage examples for javax.swing UIManager put
public static Object put(Object key, Object value)
From source file:br.com.etec.Main.java
private static void initLookAndFeel() { UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); }
From source file:hr.fer.zemris.vhdllab.platform.support.OSBasedUIManagerConfigurer.java
@Override protected void doInstallCustomDefaults() throws Exception { if (System.getProperty("os.name").equals("Linux")) { try {// www .j a v a 2 s . c o m installJGoodiesLooks(); } catch (UnsupportedLookAndFeelException e) { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); UIManager.put("swing.boldMetal", Boolean.FALSE); } } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } }
From source file:mergedoc.Application.java
/** * ? Look & Feel ???//from w ww . ja va2 s . c o m * @throws ClassNotFoundException LookAndFeel ???????? * @throws InstantiationException ???????????? * @throws IllegalAccessException ???????????? * @throws UnsupportedLookAndFeelException lnf.isSupportedLookAndFeel() ? false ?? */ private static void initSystemLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); Toolkit.getDefaultToolkit().setDynamicLayout(true); // Windows ??? String osName = System.getProperty("os.name", ""); if (osName.indexOf("Windows") != -1) { Object propoFont = new FontUIResource("MS UI Gothic", Font.PLAIN, 12); Object fixedFont = new FontUIResource("MS Gothic", Font.PLAIN, 12); // ?????????? // ????? instanceof FontUIResource ? // ???UIDefaults ? Lazy Value ?????? for (Object keyObj : UIManager.getLookAndFeelDefaults().keySet()) { String key = keyObj.toString(); if (key.endsWith("font") || key.endsWith("Font")) { UIManager.put(key, propoFont); } } // ????? UIManager.put("OptionPane.messageFont", fixedFont); UIManager.put("TextPane.font", fixedFont); UIManager.put("TextArea.font", fixedFont); } }
From source file:de.uzk.hki.da.sb.SIPBuilder.java
/** * Starts the SIP-Builder in GUI mode/*from ww w . j a va 2s. co m*/ * * @param confFolderPath Path to conf folder * @param dataFolderPath Path to data folder */ private static void startGUIMode(String confFolderPath, String dataFolderPath) { try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { return; } UIManager.put("Label.disabledForeground", Color.LIGHT_GRAY); UIManager.put("ComboBox.disabledForeground", Color.LIGHT_GRAY); UIManager.put("CheckBox.disabledText", Color.LIGHT_GRAY); Gui gui = new Gui(confFolderPath, dataFolderPath); gui.setBounds(100, 100, 750, 520); gui.setResizable(false); gui.setVisible(true); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setTitle("DA NRW SIP-Builder"); }
From source file:com.mirth.connect.client.ui.Mirth.java
/** * Construct and show the application./* w w w. j a va2s . c o m*/ */ public Mirth(Client mirthClient) throws ClientException { PlatformUI.MIRTH_FRAME = new Frame(); UIManager.put("Tree.leafIcon", UIConstants.LEAF_ICON); UIManager.put("Tree.openIcon", UIConstants.OPEN_ICON); UIManager.put("Tree.closedIcon", UIConstants.CLOSED_ICON); userPreferences = Preferences.userNodeForPackage(Mirth.class); LoginPanel.getInstance().setStatus("Loading components..."); PlatformUI.MIRTH_FRAME.setupFrame(mirthClient); boolean maximized; int width; int height; if (SystemUtils.IS_OS_MAC) { /* * The window is only maximized when there is no width or height preference saved. * Previously, we just set the dimensions on mac and didn't bother with the maximized * state because the user could maximize the window then manually resize it, leaving the * maximum state as true. As of MIRTH-3691, this no longer happens. */ maximized = (userPreferences.get("width", null) == null || userPreferences.get("height", null) == null) || (userPreferences.getInt("maximizedState", Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH); width = userPreferences.getInt("width", UIConstants.MIRTH_WIDTH); height = userPreferences.getInt("height", UIConstants.MIRTH_WIDTH); } else { /* * Maximize it if it's supposed to be maximized or if there is no maximized preference * saved. Unmaximizing will bring the window back to default size. */ maximized = (userPreferences.getInt("maximizedState", Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH); if (maximized) { // If it is maximized, use the default width and height for unmaximizing width = UIConstants.MIRTH_WIDTH; height = UIConstants.MIRTH_HEIGHT; } else { // If it's not maximized, get the saved width and height width = userPreferences.getInt("width", UIConstants.MIRTH_WIDTH); height = userPreferences.getInt("height", UIConstants.MIRTH_HEIGHT); } } // Now set the width and height (saved or default) PlatformUI.MIRTH_FRAME.setSize(width, height); PlatformUI.MIRTH_FRAME.setLocationRelativeTo(null); if (maximized) { PlatformUI.MIRTH_FRAME.setExtendedState(Frame.MAXIMIZED_BOTH); } PlatformUI.MIRTH_FRAME.setVisible(true); }
From source file:jshm.gui.GuiUtil.java
/** * This sets the default L&F as well as sets some icons *//*from ww w . ja v a 2s .c om*/ public static void init() { try { // Set the Look & Feel to match the current system UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } // http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingaJOptionPaneLookandFeel.htm UIManager.put("OptionPane.errorIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete.png"))); UIManager.put("OptionPane.informationIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/infoabout.png"))); UIManager.put("OptionPane.questionIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/help.png"))); UIManager.put("OptionPane.warningIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/pause.png"))); UIManager.put("OptionPane.yesIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/accept32.png"))); UIManager.put("OptionPane.noIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete32.png"))); float scale = Config.getFloat("font.scale"); if (1f != scale) { LOG.finest("setting ui font scale to + " + scale); Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { FontUIResource f = (FontUIResource) value; f = new FontUIResource(f.deriveFont(scale * f.getSize2D())); UIManager.put(key, f); } } } // hook into the wizard displayer System.setProperty("WizardDisplayer.default", "jshm.gui.wizards.displayer.WizardDisplayerImpl"); }
From source file:com.haulmont.cuba.desktop.sys.JXErrorPaneExt.java
public JXErrorPaneExt() { Configuration configuration = AppBeans.get(Configuration.NAME); ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); Messages messages = AppBeans.get(Messages.NAME); Locale locale = App.getInstance().getLocale(); UIManager.put("JXErrorPane.details_expand_text", messages.getMainMessage("JXErrorPane.details_expand_text", locale)); UIManager.put("JXErrorPane.details_contract_text", messages.getMainMessage("JXErrorPane.details_contract_text", locale)); UIManager.put("JXErrorPane.ok_button_text", messages.getMainMessage("JXErrorPane.ok_button_text", locale)); UIManager.put("JXErrorPane.fatal_button_text", messages.getMainMessage("JXErrorPane.fatal_button_text", locale)); UIManager.put("JXErrorPane.report_button_text", messages.getMainMessage("JXErrorPane.report_button_text", locale)); UIManager.put("JXErrorPane.copy_to_clipboard_button_text", messages.getMainMessage("JXErrorPane.copy_to_clipboard_button_text", locale)); ErrorPaneUIExt ui = new ErrorPaneUIExt(); setUI(ui);/* www . ja va 2s.c om*/ JButton copyButton = ui.getCopyToClipboardButton(); copyToClipboardListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { TopLevelFrame mainFrame = App.getInstance().getMainFrame(); mainFrame.showNotification(messages.getMainMessage("errorPane.copingSuccessful", locale), Frame.NotificationType.TRAY); } }; copyButton.addActionListener(copyToClipboardListener); UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME); Security security = AppBeans.get(Security.NAME); if (userSessionSource == null || !security.isSpecificPermitted("cuba.gui.showExceptionDetails")) { copyButton.setVisible(false); } String supportEmail = null; if (App.getInstance().getConnection().isConnected()) { supportEmail = clientConfig.getSupportEmail(); } if (StringUtils.isNotBlank(supportEmail)) { setErrorReporter(new ErrorReporter() { @Override public void reportError(ErrorInfo info) throws NullPointerException { sendSupportEmail(info); ((ErrorPaneUIExt) getUI()).setEnabled(false); } }); } }
From source file:BasicDnD.java
public static void main(String[] args) { // Schedule a job for the event-dispatching thread: // creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { // Turn off metal's use of bold fonts UIManager.put("swing.boldMetal", Boolean.FALSE); createAndShowGUI();//from w ww.ja v a 2s. c o m } }); }
From source file:components.TextSamplerDemo.java
public static void main(String[] args) { //Schedule a job for the event dispatching thread: //creating and showing this application's GUI. SwingUtilities.invokeLater(new Runnable() { public void run() { //Turn off metal's use of bold fonts UIManager.put("swing.boldMetal", Boolean.FALSE); createAndShowGUI();/*from w ww .j a v a 2 s.c o m*/ } }); }
From source file:WeatherWizard.java
public void init() { /* Turn off metal's use of bold fonts */ UIManager.put("swing.boldMetal", Boolean.FALSE); }