List of usage examples for javax.swing.plaf InsetsUIResource InsetsUIResource
public InsetsUIResource(int top, int left, int bottom, int right)
From source file:Main.java
public Main() { UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(1, 0, 0, 0)); UIManager.put("TabbedPane.contentAreaColor", new ColorUIResource(Color.GREEN)); UIManager.put("TabbedPane.focus", new ColorUIResource(Color.ORANGE)); UIManager.put("TabbedPane.selected", new ColorUIResource(Color.YELLOW)); UIManager.put("TabbedPane.darkShadow", new ColorUIResource(Color.DARK_GRAY)); UIManager.put("TabbedPane.borderHightlightColor", new ColorUIResource(Color.LIGHT_GRAY)); UIManager.put("TabbedPane.light", new ColorUIResource(Color.WHITE)); UIManager.put("TabbedPane.tabAreaBackground", new ColorUIResource(Color.CYAN)); UIManager.put("ToolTip.background", Color.WHITE); UIManager.put("ToolTip.border", new BorderUIResource(new LineBorder(Color.BLACK))); this.updateUI(); this.setBackground(Color.BLUE); JPanel testPanel = new JPanel(); testPanel.setLayout(new BorderLayout()); testPanel.add(new JLabel("Hello World"), BorderLayout.NORTH); testPanel.add(new JTextArea("Looks nice out there :)"), BorderLayout.CENTER); JPanel testPanel2 = new JPanel(); testPanel2.setLayout(new BorderLayout()); testPanel2.add(new JLabel("Good Bye World"), BorderLayout.NORTH); testPanel2.add(new JTextArea("OK"), BorderLayout.CENTER); this.addTab("Hello World", testPanel); this.addTab("World", testPanel2); }
From source file:com.mirth.connect.client.ui.Mirth.java
public static void initUIManager() { try {/*from www . ja va 2 s . co m*/ PlasticLookAndFeel.setPlasticTheme(new MirthTheme()); PlasticXPLookAndFeel look = new PlasticXPLookAndFeel(); UIManager.setLookAndFeel(look); UIManager.put("win.xpstyle.name", "metallic"); LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class); /* * MIRTH-1225 and MIRTH-2019: Create alternate key bindings if CTRL is not the same as * the menu shortcut key (i.e. COMMAND on OSX) */ if (InputEvent.CTRL_MASK != Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) { createAlternateKeyBindings(); } if (SystemUtils.IS_OS_MAC) { OSXAdapter.setAboutHandler(Mirth.class, Mirth.class.getDeclaredMethod("aboutMac", (Class[]) null)); OSXAdapter.setQuitHandler(Mirth.class, Mirth.class.getDeclaredMethod("quitMac", (Class[]) null)); } } catch (Exception e) { e.printStackTrace(); } // keep the tooltips from disappearing ToolTipManager.sharedInstance().setDismissDelay(3600000); // TabbedPane defaults // UIManager.put("TabbedPane.selected", new Color(0xffffff)); // UIManager.put("TabbedPane.background",new Color(225,225,225)); // UIManager.put("TabbedPane.tabAreaBackground",new Color(225,225,225)); UIManager.put("TabbedPane.highlight", new Color(225, 225, 225)); UIManager.put("TabbedPane.selectHighlight", new Color(0xc3c3c3)); UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(0, 0, 0, 0)); // TaskPane defaults UIManager.put("TaskPane.titleBackgroundGradientStart", new Color(0xffffff)); UIManager.put("TaskPane.titleBackgroundGradientEnd", new Color(0xffffff)); // Set fonts UIManager.put("TextPane.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("ToggleButton.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("Panel.font", UIConstants.DIALOG_FONT); UIManager.put("PopupMenu.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("OptionPane.font", UIConstants.DIALOG_FONT); UIManager.put("Label.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("Tree.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("ScrollPane.font", UIConstants.DIALOG_FONT); UIManager.put("TextField.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("Viewport.font", UIConstants.DIALOG_FONT); UIManager.put("MenuBar.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("FormattedTextField.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("DesktopIcon.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("TableHeader.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("ToolTip.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("PasswordField.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("TaskPane.font", UIConstants.TEXTFIELD_BOLD_FONT); UIManager.put("Table.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("TabbedPane.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("ProgressBar.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("CheckBoxMenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("ColorChooser.font", UIConstants.DIALOG_FONT); UIManager.put("Button.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("TextArea.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("Spinner.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("RadioButton.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("TitledBorder.font", UIConstants.TEXTFIELD_BOLD_FONT); UIManager.put("EditorPane.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("RadioButtonMenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("ToolBar.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("MenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("CheckBox.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("JXTitledPanel.title.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("Menu.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("ComboBox.font", UIConstants.TEXTFIELD_PLAIN_FONT); UIManager.put("JXLoginPanel.banner.font", UIConstants.BANNER_FONT); UIManager.put("List.font", UIConstants.TEXTFIELD_PLAIN_FONT); InputMap im = (InputMap) UIManager.get("Button.focusInputMap"); im.put(KeyStroke.getKeyStroke("pressed ENTER"), "pressed"); im.put(KeyStroke.getKeyStroke("released ENTER"), "released"); try { UIManager.put("wizard.sidebar.image", ImageIO.read(com.mirth.connect.client.ui.Frame.class.getResource("images/wizardsidebar.png"))); } catch (IOException e) { e.printStackTrace(); } }
From source file:org.ut.biolab.medsavant.MedSavantClient.java
private static void setLAF() { try {/* w ww.j a v a 2 s. co m*/ if (ClientMiscUtils.MAC) { customizeForMac(); } // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); //Metal works with sliders. //UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); //GTK doesn't work with sliders. //UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); //Nimbus doesn't work with sliders. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { LOG.debug("Installed LAF: " + info.getName() + " class: " + info.getClassName()); } LOG.debug("System LAF is: " + UIManager.getSystemLookAndFeelClassName()); LOG.debug("Cross platform LAF is: " + UIManager.getCrossPlatformLookAndFeelClassName()); LookAndFeelFactory.addUIDefaultsInitializer(new LookAndFeelFactory.UIDefaultsInitializer() { public void initialize(UIDefaults defaults) { Map<String, Object> defaultValues = new HashMap<String, Object>(); defaultValues.put("Slider.trackWidth", new Integer(7)); defaultValues.put("Slider.majorTickLength", new Integer(6)); defaultValues.put("Slider.highlight", new ColorUIResource(255, 255, 255)); defaultValues.put("Slider.horizontalThumbIcon", javax.swing.plaf.metal.MetalIconFactory.getHorizontalSliderThumbIcon()); defaultValues.put("Slider.verticalThumbIcon", javax.swing.plaf.metal.MetalIconFactory.getVerticalSliderThumbIcon()); defaultValues.put("Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0)); for (Map.Entry<String, Object> e : defaultValues.entrySet()) { if (defaults.get(e.getKey()) == null) { LOG.debug("Missing key " + e.getKey() + ", using default value " + e.getValue()); defaults.put(e.getKey(), e.getValue()); } else { LOG.debug("Found key " + e.getKey() + " with value " + defaults.get(e.getKey())); } } } }); if (MiscUtils.WINDOWS) { UIManager.put("CheckBox.background", new javax.swing.plaf.ColorUIResource(Color.WHITE)); UIManager.put("Panel.background", new javax.swing.plaf.ColorUIResource(Color.WHITE)); LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE_WITHOUT_MENU); /*UIManager.put("JideTabbedPane.tabAreaBackground", new javax.swing.plaf.ColorUIResource(Color.WHITE)); UIManager.put("JideTabbedPane.background", new javax.swing.plaf.ColorUIResource(Color.WHITE)); UIManager.put("SidePane.background", new javax.swing.plaf.ColorUIResource(Color.WHITE));*/ } else { LookAndFeelFactory.installJideExtension(); } LookAndFeelFactory.installDefaultLookAndFeelAndExtension(); System.setProperty("awt.useSystemAAFontSettings", "on"); System.setProperty("swing.aatext", "true"); UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0)); //tooltips UIManager.put("ToolTip.background", new ColorUIResource(255, 255, 255)); ToolTipManager.sharedInstance().setDismissDelay(8000); ToolTipManager.sharedInstance().setInitialDelay(500); } catch (Exception x) { LOG.error("Unable to install look & feel.", x); } }