List of usage examples for javax.swing UIManager put
public static Object put(Object key, Object value)
From source file:v800_trainer.JCicloTronic.java
public static void setFontSizeGlobal(String font, int size) { for (Enumeration e = UIManager.getDefaults().keys(); e.hasMoreElements();) { Object key = e.nextElement(); Object value = UIManager.get(key); if (value instanceof Font) { Font f = (Font) value; UIManager.put(key, new javax.swing.plaf.FontUIResource(font, f.getStyle(), size)); }/* w w w. j a va2 s . c om*/ } }
From source file:net.team2xh.crt.gui.util.GUIToolkit.java
/** * Defines the default font for Swing.// ww w.j ava2s . c om * * All Swing elements instantiated after this method call will * use the provided font name and size. * * @param name Name of the font family * @param size Font size */ public static void setDefaultFont(String name, int size) { java.util.Enumeration<Object> keys = UIManager.getDefaults().keys(); Font font = new Font(name, Font.PLAIN, size); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); // Replace all instances of font resources if (value != null && value instanceof javax.swing.plaf.FontUIResource) UIManager.put(key, font); } }
From source file:net.team2xh.crt.gui.util.GUIToolkit.java
/** * Activeate Substance Look&Feel./* w w w . j a va 2s. co m*/ * * Must be called before opening any window. * * @param laf Desired Substance Look&Feel class */ public static void setSubstanceLAF(String laf) { try { UIManager.setLookAndFeel(laf); UIManager.put(SubstanceLookAndFeel.WINDOW_ROUNDED_CORNERS, Boolean.FALSE); JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); // Substance forgot to put a border for JTextArea, // So we give it the same border that TextField has Object border = UIManager.get("TextField.border"); UIManager.put("TextArea.border", border); // Plain title font // SubstanceLookAndFeel.setFontPolicy(new FontPolicy() { // public FontSet getFontSet(String arg0, UIDefaults arg1) { // FontSet fontSet = new FontSet() { // public FontUIResource getWindowTitleFont() { // return new FontUIResource(new Font("Source Sans Pro", Font.PLAIN, 14)); //this is where the title font changes // } // // public FontUIResource getTitleFont() { // return new FontUIResource(new Font("Source Sans Pro", Font.PLAIN, 14)); // } // // public FontUIResource getSmallFont() { // return new FontUIResource(new Font("Source Sans Pro", Font.PLAIN, 14)); // } // // public FontUIResource getMessageFont() { // return new FontUIResource(new Font("Source Sans Pro", Font.PLAIN, 14)); // } // // public FontUIResource getMenuFont() { // return new FontUIResource(new Font("Source Sans Pro", Font.PLAIN, 14)); // } // // public FontUIResource getControlFont() { // return new FontUIResource(new Font("Source Sans Pro", Font.PLAIN, 14)); // } // }; // return fontSet; // } // }); } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException ex) { Logger.getLogger(GUIToolkit.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:net.technicpack.launcher.LauncherMain.java
private static void startLauncher(TechnicSettings settings, StartupParameters startupParameters, LauncherDirectories directories, ResourceLoader resources) { UIManager.put("ComboBox.disabledBackground", LauncherFrame.COLOR_FORMELEMENT_INTERNAL); UIManager.put("ComboBox.disabledForeground", LauncherFrame.COLOR_GREY_TEXT); System.setProperty("xr.load.xml-reader", "org.ccil.cowan.tagsoup.Parser"); final SplashScreen splash = new SplashScreen(resources.getImage("launch_splash.png"), 0); splash.pack();/*from ww w . j a v a 2s. com*/ splash.setLocationRelativeTo(null); splash.setVisible(true); IUserStore<MojangUser> users = TechnicUserStore .load(new File(directories.getLauncherDirectory(), "users.json")); UserModel userModel = new UserModel(users, new AuthenticationService()); MirrorStore mirrorStore = new MirrorStore(userModel); mirrorStore.addSecureMirror("mirror.technicpack.net", new JsonWebSecureMirror("http://mirror.technicpack.net/", "mirror.technicpack.net")); IModpackResourceType iconType = new IconResourceType(); IModpackResourceType logoType = new LogoResourceType(); IModpackResourceType backgroundType = new BackgroundResourceType(); PackResourceMapper iconMapper = new PackResourceMapper(directories, resources.getImage("icon.png"), iconType); ImageRepository<ModpackModel> iconRepo = new ImageRepository<ModpackModel>(iconMapper, new PackImageStore(iconType, mirrorStore, userModel)); ImageRepository<ModpackModel> logoRepo = new ImageRepository<ModpackModel>( new PackResourceMapper(directories, resources.getImage("modpack/ModImageFiller.png"), logoType), new PackImageStore(logoType, mirrorStore, userModel)); ImageRepository<ModpackModel> backgroundRepo = new ImageRepository<ModpackModel>( new PackResourceMapper(directories, null, backgroundType), new PackImageStore(backgroundType, mirrorStore, userModel)); ImageRepository<IUserType> skinRepo = new ImageRepository<IUserType>( new TechnicFaceMapper(directories, resources), new MinotarFaceImageStore("https://minotar.net/", mirrorStore)); ImageRepository<AuthorshipInfo> avatarRepo = new ImageRepository<AuthorshipInfo>( new TechnicAvatarMapper(directories, resources), new WebAvatarImageStore(mirrorStore)); ISolderApi solder = new HttpSolderApi(settings.getClientId(), userModel); HttpPlatformApi platform = new HttpPlatformApi("http://beta.technicpack.net/", mirrorStore); IInstalledPackRepository packStore = TechnicInstalledPackStore .load(new File(directories.getLauncherDirectory(), "installedPacks")); IAuthoritativePackSource packInfoRepository = new PlatformPackInfoRepository(platform, solder); ArrayList<IMigrator> migrators = new ArrayList<IMigrator>(1); migrators.add(new InitialV3Migrator(platform)); SettingsFactory.migrateSettings(settings, packStore, directories, users, migrators); PackLoader packList = new PackLoader(directories, packStore, packInfoRepository); ModpackSelector selector = new ModpackSelector(resources, packList, new SolderPackSource("http://solder.technicpack.net/api/", solder, true), solder, platform, iconRepo); selector.setBorder(BorderFactory.createEmptyBorder()); userModel.addAuthListener(selector); DiscoverInfoPanel discoverInfoPanel = new DiscoverInfoPanel(resources, startupParameters.getDiscoverUrl(), platform, splash); MinecraftLauncher launcher = new MinecraftLauncher(platform, directories, userModel, settings.getClientId()); ModpackInstaller modpackInstaller = new ModpackInstaller(platform, settings.getClientId()); Installer installer = new Installer(startupParameters, mirrorStore, directories, modpackInstaller, launcher, settings, iconMapper); LauncherFrame frame = new LauncherFrame(resources, skinRepo, userModel, settings, selector, iconRepo, logoRepo, backgroundRepo, installer, avatarRepo, platform, directories, packStore, startupParameters, discoverInfoPanel); userModel.addAuthListener(frame); LoginFrame login = new LoginFrame(resources, settings, userModel, skinRepo); userModel.addAuthListener(login); userModel.addAuthListener(new IAuthListener() { @Override public void userChanged(Object user) { if (user == null) splash.dispose(); } }); userModel.initAuth(); }
From source file:nl.tudelft.goal.SimpleIDE.SimpleIDE.java
/** * Sets look and feel. Gets preference settings from * {@link GUIandFilePreferencePanel}.// ww w . ja v a 2 s . c o m */ private void setLookAndFeel() { if (IDEPreferences.getLAF().equals("Nimbus")) { //$NON-NLS-1$ try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { //$NON-NLS-1$ UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { new Warning(Resources.get(WarningStrings.FAILED_LAF_NIMBUS), e); } } UIManager.put("TextArea.font", UIManager.getFont("TextArea.font") //$NON-NLS-1$ //$NON-NLS-2$ .deriveFont((float) IDEPreferences.getConsoleFontSize())); }
From source file:no.java.ems.client.swing.EmsClient.java
@Override protected void initialize(final String[] args) { new CustomUncaughtExceptionHandler(getMainFrame()); UIManager.put("TextArea.font", UIManager.getFont("TextField.font")); connectionURI = System.getProperty("ems-host", "http://localhost:3000/ems"); emsService = new RestEmsService(connectionURI); emsService.setRequestCallback(new EmsClientRequestCallback()); logger.info("Ems host address set to " + connectionURI); AuthenticationDialog authenticationDialog = runAuthenticationDialog(null); emsService.setCredentials(authenticationDialog.getUsername(), authenticationDialog.getPassword()); }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
public void setFormFont(Font theFont) { theStandardFont = theFont;/*from w ww.ja va 2 s .co m*/ UIManager.put("OptionPane.messageFont", theStandardFont); UIManager.put("OptionPane.buttonFont", theStandardFont); UIManager.put("TextField.font", theStandardFont); FormUtilities.setFormFont(this, theStandardFont); depositPresenter.setStandardFont(theStandardFont); }
From source file:nz.govt.natlib.ndha.manualdeposit.metadata.MetaDataConfigurator.java
public void setFormFont(final Font theFont) { UIManager.put("OptionPane.messageFont", theFont); UIManager.put("OptionPane.buttonFont", theFont); UIManager.put("TextField.font", theFont); FormUtilities.setFormFont(this, theFont); }
From source file:op.OPDE.java
public static void setStandardFont() { UIManager.put("Button.font", SYSConst.ARIAL14); UIManager.put("ToggleButton.font", SYSConst.ARIAL14); UIManager.put("RadioButton.font", SYSConst.ARIAL14); UIManager.put("CheckBox.font", SYSConst.ARIAL14); UIManager.put("ColorChooser.font", SYSConst.ARIAL14); UIManager.put("ComboBox.font", SYSConst.ARIAL14); UIManager.put("Label.font", SYSConst.ARIAL14); UIManager.put("List.font", SYSConst.ARIAL14); UIManager.put("MenuBar.font", SYSConst.ARIAL14); UIManager.put("MenuItem.font", SYSConst.ARIAL14); UIManager.put("RadioButtonMenuItem.font", SYSConst.ARIAL14); UIManager.put("CheckBoxMenuItem.font", SYSConst.ARIAL14); UIManager.put("Menu.font", SYSConst.ARIAL14); UIManager.put("PopupMenu.font", SYSConst.ARIAL14); UIManager.put("OptionPane.font", SYSConst.ARIAL14); UIManager.put("Panel.font", SYSConst.ARIAL14); UIManager.put("ProgressBar.font", SYSConst.ARIAL14); UIManager.put("ScrollPane.font", SYSConst.ARIAL14); UIManager.put("Viewport.font", SYSConst.ARIAL14); UIManager.put("TabbedPane.font", SYSConst.ARIAL14); UIManager.put("Table.font", SYSConst.ARIAL14); UIManager.put("TableHeader.font", SYSConst.ARIAL14); UIManager.put("TextField.font", SYSConst.ARIAL14); UIManager.put("PasswordField.font", SYSConst.ARIAL14); UIManager.put("TextArea.font", SYSConst.ARIAL14); UIManager.put("TextPane.font", SYSConst.ARIAL14); UIManager.put("EditorPane.font", SYSConst.ARIAL14); UIManager.put("TitledBorder.font", SYSConst.ARIAL14); UIManager.put("ToolBar.font", SYSConst.ARIAL14); UIManager.put("ToolTip.font", SYSConst.ARIAL14); UIManager.put("Tree.font", SYSConst.ARIAL14); }
From source file:org.apache.oodt.cas.workflow.gui.WorkflowGUI.java
public static void main(String[] args) { UIManager.put("TabbedPane.selected", new Color(238, 238, 238)); SwingUtilities.invokeLater(new Runnable() { public void run() { WorkflowGUI gui;/* w w w . j a va 2s .c om*/ try { gui = new WorkflowGUI(); gui.pack(); gui.setVisible(true); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage()); } } }); }