本文整理了Java中javax.swing.UIManager.put()
方法的一些代码示例,展示了UIManager.put()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UIManager.put()
方法的具体详情如下:
包路径:javax.swing.UIManager
类名称:UIManager
方法名:put
暂无
代码示例来源:origin: kiegroup/optaplanner
protected static void configureNimbusToTangoColors() {
UIManager.put("control", ALUMINIUM_1);
UIManager.put("info", BUTTER_1);
UIManager.put("nimbusAlertYellow", BUTTER_2);
UIManager.put("nimbusBase", SKY_BLUE_3);
UIManager.put("nimbusDisabledText", ALUMINIUM_4);
UIManager.put("nimbusFocus", SKY_BLUE_1);
UIManager.put("nimbusGreen", CHAMELEON_1);
UIManager.put("nimbusInfoBlue", SKY_BLUE_2);
UIManager.put("nimbusLightBackground", Color.WHITE);
UIManager.put("nimbusOrange", ORANGE_2);
UIManager.put("nimbusRed", SCARLET_2);
UIManager.put("nimbusSelectedText", Color.WHITE);
UIManager.put("nimbusSelectionBackground", SKY_BLUE_2);
UIManager.put("text", Color.BLACK);
UIManager.put("activeCaption", ALUMINIUM_3);
UIManager.put("background", ALUMINIUM_2);
UIManager.put("controlDkShadow", ALUMINIUM_4);
UIManager.put("controlHighlight", ALUMINIUM_1);
UIManager.put("controlLHighlight", ALUMINIUM_6);
UIManager.put("controlShadow", ALUMINIUM_2);
UIManager.put("controlText", Color.BLACK);
UIManager.put("desktop", SKY_BLUE_1);
UIManager.put("inactiveCaption", ALUMINIUM_3);
UIManager.put("infoText", Color.BLACK);
UIManager.put("menu", ALUMINIUM_1);
UIManager.put("menuText", Color.BLACK);
UIManager.put("nimbusBlueGrey", ALUMINIUM_1);
UIManager.put("nimbusBorder", ALUMINIUM_4);
代码示例来源:origin: runelite/runelite
/**
* 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");
}
代码示例来源:origin: wiztools/rest-client
private static void setGlobalUIFontSize(final int fontSize){
Font f = new Font(Font.DIALOG, Font.PLAIN, fontSize);
//UIManager.put("Label.font", f);
//UIManager.put("Button.font", f);
//UIManager.put("RadioButton.font", f);
ArrayList<String> excludes = new ArrayList<>();
//excludes.add("TitledBorder.font");
//excludes.add("MenuBar.font");
//excludes.add("MenuItem.font");
//excludes.add("MenuItem.acceleratorFont");
//excludes.add("Menu.font");
//excludes.add("TabbedPane.font");
excludes.add("");
Enumeration itr = UIManager.getDefaults().keys();
while(itr.hasMoreElements()){
Object o = itr.nextElement();
if(o instanceof String) {
String key = (String) o;
Object value = UIManager.get (key);
if ((value instanceof javax.swing.plaf.FontUIResource)
&& (!excludes.contains(key))){
LOG.fine(key);
UIManager.put (key, f);
}
}
}
}
代码示例来源:origin: runelite/runelite
/**
* Sets default Swing font.
* IMPORTANT! Needs to be called before main frame creation
*
* @param font the new font to use
*/
public static void setFont(@Nonnull final Font font)
{
final FontUIResource f = new FontUIResource(font);
final Enumeration keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements())
{
final Object key = keys.nextElement();
final Object value = UIManager.get(key);
if (value instanceof FontUIResource)
{
UIManager.put(key, f);
}
}
}
代码示例来源:origin: kiegroup/optaplanner
public static void increaseDefaultFont(float multiplier) {
for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value != null && value instanceof FontUIResource) {
FontUIResource fontUIResource = (FontUIResource) value;
UIManager.put(key, fontUIResource.deriveFont(fontUIResource.getSize() * multiplier));
}
}
}
代码示例来源:origin: RipMeApp/ripme
UIManager.put("FileChooser.useSystemExtensionHiding", false);
JFileChooser jfc = new JFileChooser(Utils.getWorkingDirectory());
jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
});
configUrlFileChooserButton.addActionListener(arg0 -> {
UIManager.put("FileChooser.useSystemExtensionHiding", false);
JFileChooser jfc = new JFileChooser(Utils.getWorkingDirectory());
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
代码示例来源:origin: stackoverflow.com
UIManager UI=new UIManager();
UI.put("OptionPane.background", Color.white);
UI.put("Panel.background", Color.white);
JOptionPane.showMessageDialog(null,"Text","SetColor",JOptionPane.INFORMATION_MESSAGE);
代码示例来源:origin: nodebox/nodebox
/**
* Initializes Swing's look and feel to the system native look and feel.
* On Mac, uses the system menu bar.
*/
private void initLookAndFeel() {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignored) {
}
System.setProperty("apple.laf.useScreenMenuBar", "true");
UIManager.put("Table.alternateRowColor", new Color(243, 246, 250));
}
代码示例来源:origin: magefree/mage
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(Constants.TOOLTIPS_DELAY_MS);
UIManager.put("info", tooltipBackground);
}
});
代码示例来源:origin: magefree/mage
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(100 * 1000);
UIManager.put("info", Color.DARK_GRAY);
}
代码示例来源:origin: magefree/mage
public static void setDefaultFont (Font font) {
for (Object key : Collections.list(UIManager.getDefaults().keys())) {
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource) {
UIManager.put(key, font);
}
}
}
}
代码示例来源:origin: knowm/XChart
private void showExportAsDialog() {
UIManager.put("FileChooser.saveButtonText", "Export");
UIManager.put("FileChooser.fileNameLabelText", "Export To:");
UIManager.put("FileChooser.saveDialogFileNameLabel.textAndMnemonic", "Export To:");
代码示例来源:origin: Nilhcem/FakeSMTP
@Override
public void run() {
try {
URL envelopeImage = getClass().getResource(Configuration.INSTANCE.get("application.icon.path"));
if (envelopeImage != null) {
Application.getApplication().setDockIconImage(Toolkit.getDefaultToolkit().getImage(envelopeImage));
}
} catch (RuntimeException e) {
LOGGER.debug("Error: {} - This is probably because we run on a non-Mac platform and these components are not implemented", e.getMessage());
} catch (Exception e) {
LOGGER.error("", e);
}
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", Configuration.INSTANCE.get("application.name"));
UIManager.put("swing.boldMetal", Boolean.FALSE);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
LOGGER.error("", e);
}
new MainFrame();
}
});
代码示例来源:origin: stackoverflow.com
UIManager.put("Button.disabledText", new Color(40,40,255));
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Get the InputMap to use for the UI.<p>
*
* This method is not named <code>getInputMap()</code> because there is
* a package-private method in <code>BasicTextAreaUI</code> with that name.
* Thus, creating a new method with that name causes certain compilers to
* issue warnings that you are not actually overriding the original method
* (since it is package-private).
*/
protected InputMap getRTextAreaInputMap() {
InputMap map = new InputMapUIResource();
InputMap shared = (InputMap)UIManager.get(SHARED_INPUT_MAP_NAME);
if (shared==null) {
shared = new RTADefaultInputMap();
UIManager.put(SHARED_INPUT_MAP_NAME, shared);
}
//KeyStroke[] keys = shared.allKeys();
//for (int i=0; i<keys.length; i++)
// System.err.println(keys[i] + " -> " + shared.get(keys[i]));
map.setParent(shared);
return map;
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Get the InputMap to use for the UI.<p>
*
* This method is not named <code>getInputMap()</code> because there is
* a package-private method in <code>BasicTextAreaUI</code> with that name.
* Thus, creating a new method with that name causes certain compilers to
* issue warnings that you are not actually overriding the original method
* (since it is package-private).
*/
@Override
protected InputMap getRTextAreaInputMap() {
InputMap map = new InputMapUIResource();
InputMap shared = (InputMap)UIManager.get(SHARED_INPUT_MAP_NAME);
if (shared==null) {
shared = new RSyntaxTextAreaDefaultInputMap();
UIManager.put(SHARED_INPUT_MAP_NAME, shared);
}
//KeyStroke[] keys = shared.allKeys();
//for (int i=0; i<keys.length; i++)
// System.err.println(keys[i] + " -> " + shared.get(keys[i]));
map.setParent(shared);
return map;
}
代码示例来源:origin: stackoverflow.com
UIManager.put("Button.margin", new Insets(10, 10, 10, 10) );
ButtonCalculator frame = new ButtonCalculator();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
代码示例来源:origin: magefree/mage
public AbilityPicker() {
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
initComponents();
jScrollPane2.setOpaque(false);
jScrollPane2.getViewport().setOpaque(false);
UIManager.put("ScrollBar.width", 17);
jScrollPane2.getHorizontalScrollBar().setUI(new MageScrollbarUI());
jScrollPane2.getVerticalScrollBar().setUI(new MageScrollbarUI());
}
代码示例来源:origin: magefree/mage
public AbilityPicker(List<Object> choices, String message) {
this.choices = choices;
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
if (message != null) {
this.message = message + " (single-click)";
}
initComponents();
jScrollPane2.setOpaque(false);
jScrollPane2.getViewport().setOpaque(false);
UIManager.put("ScrollBar.width", 17);
jScrollPane2.getHorizontalScrollBar().setUI(new MageScrollbarUI());
jScrollPane2.getVerticalScrollBar().setUI(new MageScrollbarUI());
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Returns an action map to use by a text area.<p>
*
* This method is not named <code>getActionMap()</code> because there is
* a package-private method in <code>BasicTextAreaUI</code> with that name.
* Thus, creating a new method with that name causes certain compilers to
* issue warnings that you are not actually overriding the original method
* (since it is package-private).
*
* @return The action map.
* @see #createRTextAreaActionMap()
*/
private ActionMap getRTextAreaActionMap() {
// Get the UIManager-cached action map; if this is the first
// RTextArea created, create the action map and cache it.
ActionMap map = (ActionMap)UIManager.get(getActionMapName());
if (map==null) {
map = createRTextAreaActionMap();
UIManager.put(getActionMapName(), map);
}
ActionMap componentMap = new ActionMapUIResource();
componentMap.put("requestFocus", new FocusAction());
if (map != null) {
componentMap.setParent(map);
}
return componentMap;
}
内容来源于网络,如有侵权,请联系作者删除!