Java Code Examples for javax.swing.UIManager#put()
The following examples show how to use
javax.swing.UIManager#put() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Fonts.java From gcs with Mozilla Public License 2.0 | 7 votes |
/** Loads the current font settings from the preferences file. */ public static void loadFromPreferences() { String name = getDefaultFont().getName(); register(KEY_LABEL_PRIMARY, I18n.Text("Primary Labels"), new Font(name, Font.PLAIN, 9)); register(KEY_LABEL_SECONDARY, I18n.Text("Secondary Labels"), new Font(name, Font.PLAIN, 8)); register(KEY_FIELD_PRIMARY, I18n.Text("Primary Fields"), new Font(name, Font.PLAIN, 9)); register(KEY_FIELD_SECONDARY, I18n.Text("Secondary Fields"), new Font(name, Font.PLAIN, 8)); register(KEY_FOOTER_PRIMARY, I18n.Text("Primary Footer"), new Font(name, Font.BOLD, 8)); register(KEY_FOOTER_SECONDARY, I18n.Text("Secondary Footer"), new Font(name, Font.PLAIN, 6)); Preferences prefs = Preferences.getInstance(); for (String key : KEYS) { Info info = prefs.getFontInfo(key); if (info != null) { UIManager.put(key, info.create()); } } }
Example 2
Source File: ColorHelper.java From netbeans with Apache License 2.0 | 6 votes |
public static Color getJxdatetimepickerSelectedForeground() { Color managerColor = UIManager.getColor("nb.dataview.jxdatetimepicker.selectedForeground"); if (managerColor == null) { if (isDarkTheme()) { if (UIManager.getColor("Table[Enabled+Selected].textForeground") != null) { UIManager.put("nb.dataview.jxdatetimepicker.selectedForeground", new RelativeColor(new Color(0, 0, 0), new Color(0, 0, 0), "Table[Enabled+Selected].textForeground")); //NOI18N } else { UIManager.put("nb.dataview.jxdatetimepicker.selectedForeground", new RelativeColor(new Color(0, 0, 0), new Color(0, 0, 0), "Table.selectionForeground")); //NOI18N } } else { UIManager.put("nb.dataview.jxdatetimepicker.selectedForeground", UIManager.getColor("JXMonthView.selectedForeground")); } return UIManager.getColor("nb.dataview.jxdatetimepicker.selectedForeground"); //NOI18N } else { return managerColor; } }
Example 3
Source File: Metalworks.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { UIManager.put("swing.boldMetal", Boolean.FALSE); JDialog.setDefaultLookAndFeelDecorated(true); JFrame.setDefaultLookAndFeelDecorated(true); Toolkit.getDefaultToolkit().setDynamicLayout(true); System.setProperty("sun.awt.noerasebackground", "true"); try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { System.out.println( "Metal Look & Feel not supported on this platform. \n" + "Program Terminated"); System.exit(0); } JFrame frame = new MetalworksFrame(); frame.setVisible(true); }
Example 4
Source File: __UI__.java From beautyeye with Apache License 2.0 | 6 votes |
/** * Ui impl. */ public static void uiImpl() { // UIManager.put("CheckBox.border",new BorderUIResource(new BERoundBorder().setArcWidth(0))); UIManager.put("CheckBox.margin",new InsetsUIResource(4,3,4,3)); UIManager.put("RadioButton.margin",new InsetsUIResource(4,3,4,3));//2, 2, 2, 2)); UIManager.put("RadioButton.background",new ColorUIResource(BeautyEyeLNFHelper.commonBackgroundColor)); UIManager.put("CheckBox.background",new ColorUIResource(BeautyEyeLNFHelper.commonBackgroundColor)); UIManager.put("CheckBox.foreground",new ColorUIResource(BeautyEyeLNFHelper.commonForegroundColor)); UIManager.put("RadioButton.foreground",new ColorUIResource(BeautyEyeLNFHelper.commonForegroundColor)); UIManager.put("RadioButton.icon", new RadioButtonIcon()); UIManager.put("CheckBox.icon", new CheckBoxIcon()); //衬距设定 UIManager.put("RadioButton.margin", new InsetsUIResource(1,1,1,1));//默认是2,2,2,2 UIManager.put("CheckBox.margin", new InsetsUIResource(1,1,1,1));//默认是2,2,2,2 }
Example 5
Source File: SwingUtil.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
/** * Sets some sensible defaults for swing. * IMPORTANT! Needs to be called before main frame creation */ public static void setupDefaults() { // Force heavy-weight popups/tooltips. // Prevents them from being obscured by the game applet. ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); ToolTipManager.sharedInstance().setInitialDelay(300); JPopupMenu.setDefaultLightWeightPopupEnabled(false); UIManager.put("Button.foreground", Color.WHITE); UIManager.put("MenuItem.foreground", Color.WHITE); UIManager.put("Panel.background", ColorScheme.DARK_GRAY_COLOR); UIManager.put("ScrollBarUI", CustomScrollBarUI.class.getName()); UIManager.put("TextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT); UIManager.put("TextField.selectionForeground", Color.WHITE); UIManager.put("FormattedTextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT); UIManager.put("FormattedTextField.selectionForeground", Color.WHITE); UIManager.put("TextArea.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT); UIManager.put("TextArea.selectionForeground", Color.WHITE); // Do not render shadows under popups/tooltips. // Fixes black boxes under popups that are above the game applet. System.setProperty("jgoodies.popupDropShadowEnabled", "false"); // Do not fill in background on repaint. Reduces flickering when // the applet is resized. System.setProperty("sun.awt.noerasebackground", "true"); }
Example 6
Source File: ColorHelper.java From netbeans with Apache License 2.0 | 5 votes |
public static Color getJxdatetimepickerMonthStringForeground() { Color managerColor = UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringForeground"); if (managerColor == null) { UIManager.put("nb.dataview.jxdatetimepicker.monthStringForeground", UIManager.getColor("JXMonthView.monthStringForeground")); //NOI18N return UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringForeground"); //NOI18N } else { return managerColor; } }
Example 7
Source File: bug8002077.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); UIManager.put("FileChooser.openButtonMnemonic", KeyEvent.VK_O); UIManager.put("FileChooser.saveButtonMnemonic", KeyEvent.VK_S); runTest(); break; } } }
Example 8
Source File: MenuButton.java From visualvm with GNU General Public License v2.0 | 5 votes |
private void showHover() { originalConsumeEvent = UIManager.get(CONSUME_EVENT_KEY); UIManager.put(CONSUME_EVENT_KEY, Boolean.FALSE); MenuSelectionManager msm = MenuSelectionManager.defaultManager(); msm.setSelectedPath(new MenuElement[] { MenuButton.this }); if (!listening) { msm.addChangeListener(this); listening = true; } repaint(); }
Example 9
Source File: ColorHelper.java From netbeans with Apache License 2.0 | 5 votes |
public static Color getJxdatetimepickerMonthStringBackground() { Color managerColor = UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground"); if (managerColor == null) { UIManager.put("nb.dataview.jxdatetimepicker.monthStringBackground", UIManager.getColor("JXMonthView.monthStringBackground")); //NOI18N return UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground"); //NOI18N } else { return managerColor; } }
Example 10
Source File: Test6860438.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
void test() { int size = UIManager.getDefaults().size(); // create a new value, size increases UIManager.getLookAndFeelDefaults().put(KEY, VALUE); check(KEY, VALUE, true, size + 1); // override the value, size remains the same UIManager.put(KEY, VALUE); check(KEY, VALUE, true, size + 1); // remove the value, size decreases UIManager.getDefaults().remove(KEY); check(KEY, null, false, size); }
Example 11
Source File: CollectEarthUtils.java From collect-earth with MIT License | 5 votes |
private static void setUIFont (javax.swing.plaf.FontUIResource f){ Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get (key); if (value != null && value instanceof javax.swing.plaf.FontUIResource) UIManager.put (key, f); } }
Example 12
Source File: DefaultOutlineCellRendererTest.java From netbeans with Apache License 2.0 | 5 votes |
/** * Test of getTableCellRendererComponent method, of class * DefaultOutlineCellRenderer. */ public void testGetTableCellRendererComponent() { System.out.println("getTableCellRendererComponent"); UIManager.put("Table.alternateRowColor", Color.red); final DefaultMutableTreeNode node1 = new DefaultMutableTreeNode(); final DefaultMutableTreeNode node2 = new DefaultMutableTreeNode(); final Object[][] values = new Object[][]{{node1, "01"}, {node2, "11"}}; final String[] names = new String[]{"col1", "col2"}; TreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode()); DefaultTableModel tableModel = new DefaultTableModel(values, names); OutlineModel model = new DefaultOutlineModel(treeModel, tableModel, false, "Col1") { }; final Outline outline = new Outline(model); ColorRenderDataProvider rdp = new ColorRenderDataProvider(); outline.setRenderDataProvider(rdp); DefaultOutlineCellRenderer instance = new DefaultOutlineCellRenderer(); Component result = instance.getTableCellRendererComponent(outline, node1, false, false, 0, 0); assertEquals("First line backgroundColor defaults to", outline.getBackground(), result.getBackground()); assertEquals("Foreground defaults to", outline.getForeground(), result.getForeground()); result = instance.getTableCellRendererComponent(outline, node2, false, false, 1, 0); assertEquals("Second line backgroundColor defaults to", Color.red, result.getBackground()); assertEquals("Foreground defaults to", outline.getForeground(), result.getForeground()); rdp.backgroundColor = Color.BLUE; // Custom background color rdp.foregroundColor = Color.GREEN; // Custom foreground color result = instance.getTableCellRendererComponent(outline, node1, false, false, 0, 0); assertEquals("First line backgroundColor is set as", Color.BLUE, result.getBackground()); assertEquals("Foreground is set as", Color.GREEN, result.getForeground()); result = instance.getTableCellRendererComponent(outline, node2, false, false, 1, 0); assertEquals("Second line backgroundColor is set as", Color.BLUE, result.getBackground()); assertEquals("Foreground is set as", Color.GREEN, result.getForeground()); }
Example 13
Source File: OptionsManager.java From PolyGlot with MIT License | 5 votes |
private void setDefaultJavaFontSize(double size) { java.util.Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Font newFont = UIManager.getFont(key); if (newFont != null) { UIManager.put(key, newFont.deriveFont((float)size)); } } }
Example 14
Source File: RocPlot.java From rtg-tools with BSD 2-Clause "Simplified" License | 4 votes |
/** * Creates a new swing plot. * @param precisionRecall true defaults to precision recall graph * @param interpolate if true, enable curve interpolation */ RocPlot(boolean precisionRecall, boolean interpolate) { mInterpolate = interpolate; mMainPanel = new JPanel(); UIManager.put("FileChooser.readOnly", Boolean.TRUE); mFileChooser = new JFileChooser(); final Action details = mFileChooser.getActionMap().get("viewTypeDetails"); if (details != null) { details.actionPerformed(null); } mFileChooser.setMultiSelectionEnabled(true); mFileChooser.setFileFilter(new RocFileFilter()); mZoomPP = new RocZoomPlotPanel(); mZoomPP.setOriginIsMin(true); mZoomPP.setTextAntialiasing(true); mProgressBar = new JProgressBar(-1, -1); mProgressBar.setVisible(true); mProgressBar.setStringPainted(true); mProgressBar.setIndeterminate(true); mStatusLabel = new JLabel(); mPopup = new JPopupMenu(); mRocLinesPanel = new RocLinesPanel(this); mScrollPane = new JScrollPane(mRocLinesPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); mScrollPane.setWheelScrollingEnabled(true); mLineWidthSlider = new JSlider(JSlider.HORIZONTAL, LINE_WIDTH_MIN, LINE_WIDTH_MAX, 1); mScoreCB = new JCheckBox("Show Scores"); mScoreCB.setSelected(true); mSelectAllCB = new JCheckBox("Select / Deselect all"); mTitleEntry = new JTextField("ROC"); mTitleEntry.setMaximumSize(new Dimension(Integer.MAX_VALUE, mTitleEntry.getPreferredSize().height)); mOpenButton = new JButton("Open..."); mOpenButton.setToolTipText("Add a new curve from a file"); mCommandButton = new JButton("Cmd..."); mCommandButton.setToolTipText("Send the equivalent rocplot command-line to the terminal"); final ImageIcon icon = createImageIcon("com/rtg/graph/resources/realtimegenomics_logo.png", "RTG Logo"); mIconLabel = new JLabel(icon); mIconLabel.setBackground(new Color(16, 159, 205)); mIconLabel.setForeground(Color.WHITE); mIconLabel.setOpaque(true); mIconLabel.setFont(new Font("Arial", Font.BOLD, 24)); mIconLabel.setHorizontalAlignment(JLabel.LEFT); mIconLabel.setIconTextGap(50); if (icon != null) { mIconLabel.setMinimumSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); } mGraphType = new JComboBox<>(new String[] {ROC_PLOT, PRECISION_SENSITIVITY}); mGraphType.setSelectedItem(precisionRecall ? PRECISION_SENSITIVITY : ROC_PLOT); configureUI(); }
Example 15
Source File: RoomCreationDialog.java From Spark with Apache License 2.0 | 4 votes |
private void showError(String errorMessage) { UIManager.put("OptionPane.okButtonText", Res.getString("ok")); JOptionPane.showMessageDialog(this, errorMessage, Res.getString("title.error"), JOptionPane.ERROR_MESSAGE); }
Example 16
Source File: LuckPopupMenuUIBundle.java From littleluck with Apache License 2.0 | 4 votes |
@Override protected void installColor(UIDefaults table) { UIManager.put(SEPEREATOR_COLOR, getColorRes(215, 220, 222)); }
Example 17
Source File: OptionsDialog.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
protected static void setUIDefaults(Object[] keys, Object value) { for(int i = 0; i < keys.length; i++){ UIManager.put(keys[i], value); } }
Example 18
Source File: Test4887836.java From hottub with GNU General Public License v2.0 | 4 votes |
public void init() { UIManager.put("Label.font", new Font("Perpetua", 0, 36)); // NON-NLS: property and font names add(new JColorChooser(Color.LIGHT_GRAY)); }
Example 19
Source File: RosterDialog.java From Spark with Apache License 2.0 | 4 votes |
/** * Creates a Popupdialog above the Search Button displaying matching * Contacts * * @param byname * , the Searchname, atleast 5 Chars long * @param event * , the MouseEvent which triggered it * @throws XMPPException * @throws InterruptedException */ public void searchForContact(String byname, MouseEvent event) throws XMPPException, SmackException.NotConnectedException, SmackException.NoResponseException, InterruptedException { UIManager.put("OptionPane.okButtonText", Res.getString("ok")); if (byname.contains("@")) { byname = byname.substring(0, byname.indexOf("@")); } if (byname.length() <= 1) { JOptionPane.showMessageDialog(jidField, Res.getString("message.search.input.short"), Res.getString("title.notification"), JOptionPane.ERROR_MESSAGE); } else { JPopupMenu popup = new JPopupMenu(); JMenuItem header = new JMenuItem( Res.getString("group.search.results") + ":"); header.setBackground(UIManager.getColor("List.selectionBackground")); header.setForeground(Color.red); popup.add(header); for (DomainBareJid search : _usersearchservice) { ReportedData data; UserSearchManager usersearchManager = new UserSearchManager( SparkManager.getConnection()); Form f = usersearchManager.getSearchForm(search); Form answer = f.createAnswerForm(); answer.setAnswer("Name", true); answer.setAnswer("Email", true); answer.setAnswer("Username", true); answer.setAnswer("search", byname); data = usersearchManager.getSearchResults(answer, search); ArrayList<String> columnnames = new ArrayList<>(); for ( ReportedData.Column column : data.getColumns() ) { String label = column.getLabel(); columnnames.add(label); } for (ReportedData.Row row : data.getRows() ) { if (!row.getValues(columnnames.get(0)).isEmpty()) { String s = row.getValues(columnnames.get(0)) .get(0).toString(); final JMenuItem item = new JMenuItem(s); popup.add(item); item.addActionListener( e -> { jidField.setText(item.getText()); nicknameField.setText(XmppStringUtils .parseLocalpart(item.getText())); } ); } } } if (popup.getComponentCount() > 2) { popup.setVisible(true); popup.show(_searchForName, event.getX(), event.getY()); } else if (popup.getComponentCount() == 2) { jidField.setText(((JMenuItem) popup.getComponent(1)).getText()); nicknameField.setText(XmppStringUtils.parseLocalpart(((JMenuItem) popup .getComponent(1)).getText())); } else { JOptionPane.showMessageDialog(jidField, Res.getString("message.no.results.found"), Res.getString("title.notification"), JOptionPane.ERROR_MESSAGE); } } }
Example 20
Source File: Messages.java From Pixie with MIT License | 2 votes |
/** * Show info message. * * @param parent the parent * @param message the message * @param title the title */ public static void showInfoMessage(Component parent, String message, String title) { UIManager.put(OPT_PANE_BKG, Color.white); UIManager.put(PANEL_BKG, Color.white); JOptionPane.showMessageDialog(parent, message, title, JOptionPane.INFORMATION_MESSAGE, Icons.INFO_ICON); }