uimanager

Customizing Tree.collapsedIcon for a single JTree

倖福魔咒の 提交于 2019-12-17 07:53:13
问题 I know that you can change the Tree.collapsedIcon for a all JTrees in an application using Swing using the UImanager . For example: UIManager.put("Tree.collapsedIcon",closedcabinet); I would like the flexibility of changing the Tree.collapsedIcon for individual JTrees in the same application with the end result being that the Tree.collpasedIcon could appear differently for different trees in the same application. I know how to customize individual icons using a custom renderer. For example, I

Overriding LookAndFeel

吃可爱长大的小学妹 提交于 2019-12-13 00:35:42
问题 Hello I am trying to change the colors of my swing progress bar in java. Initially I tried using the following code: UIManager.put("ProgressBar.selectionBackground", Color.black); UIManager.put("ProgressBar.selectionForeground", Color.white); UIManager.put("ProgressBar.background", Color.white); UIManager.put("ProgressBar.foreground", Color.RED); m_progressBar.setBackground(Color.BLACK); m_progressBar.setForeground(Color.red); But none of the commands seemed to have any effect!!! Unless I set

overrides nimbus properties

拜拜、爱过 提交于 2019-12-12 01:49:21
问题 I'm trying to overrides some of the nimbus properties for JLabel. UIDefaults labelDefault = new UIDefaults(); labelDefault.put("Label.font", new FontUIResource("Arial", Font.PLAIN, 14)); labelDefault.put("Label.foreground", new ColorUIResource(210, 210, 210)); label.putClientProperty("Nimbus.Overrides", labelDefault); label.putClientProperty("Nimbus.Overrides.InheritDefaults",false); For the font it works correctly, but not for the color. Is it possible to change the color this way ? Thank

UIManager in Java Swing not working consistently? / JOptionPane Message Background

試著忘記壹切 提交于 2019-12-12 01:48:05
问题 I'm trying to set the background color in my custom JOptionPane and no matter what, I cannot get the message part of the option pane to change color. Attempt #1 was to set the pane background and opaque. Attempt #2 was to also loop through the pane's components, and set the opaque and/or background attributes if they were JPanel or JLabel. This did not work for the message part. From what I can see, the JPanel does not even exist as one of the components. Attempt #3 was to use UIManager,

JTree ignoring LaF overrides

醉酒当歌 提交于 2019-12-11 09:09:06
问题 I have recently been attempting to convert a system to a unified look and feel (In this case Nimbus). However certain components require alteration from the defaults and I don't want to just change the defaults because of a single component. I am trying to override the row highlight colour for a JTree component. I have managed to switch it off entirely but this is not what I am after. From reading the various questions on here I have tried using: UIDefaults overrides = new UIDefaults();

Swing: Resizing RadioButton

拜拜、爱过 提交于 2019-12-11 08:40:17
问题 I need to implement font size switching in my app. But when I increase font's size RadioButtons remain same size and on small screen with high resolution my customer just can't hit it easily. Is there a way to resize RadioButton's round thing programmatically without diging into L&F and redrawing Icons manually (it's complicated since app targets multiple platforms with different UIs and each of them must have 7 icons). Perfect solution could look like this: Extraction of native UI icon.

Change JComboBox colours WITHOUT renderer

泪湿孤枕 提交于 2019-12-11 03:41:20
问题 I can change the ComboBox background color using: UIManager.put("ComboBox.background", Color.RED); and it works. But to change the [selected].background , having a look at Nimbus Defaults the property is called ComboBox:"ComboBox.listRenderer"[Selected].background , so I tried with: UIManager.put("ComboBox:\"ComboBox.listRenderer\"[Selected].background", Color.RED); but it doesn't work. I want to do this with a renderer (which I have tried and gives many problems into a long code I even hadn

How to globally change the ActionMap of Swing JTextFields?

让人想犯罪 __ 提交于 2019-12-10 23:57:17
问题 I want to change the ActionMap of Swing JTextFields in my entire Application by replacing a few actions by my custom implmentations. For an explanation why you can refer to the following post: How do I make the caret of a JTextComponent skip selected text? This works well if I do this: ActionMap map = (ActionMap)UIManager.get("TextField.actionMap"); map.put(DefaultEditorKit.backwardAction, new MyCustomAction()); The only remaining problem now is that so far I have only gotten this to work,

How to setup night mode drawables to work as expected

不羁的心 提交于 2019-12-10 21:39:34
问题 I what to change background as night mode changes. I have /values and /values-night folder, that contain "colors.xml" with different values. ` <color name="grey1">#ebebeb</color> <color name="grey2">#c7c7c7</color> <color name="grey3">#999999</color> <color name="hover1">#8bb065</color> <color name="red1">#ba0000</color> <color name="red2">#ff0000</color> <color name="green1">#336600</color> <color name="text1">#000000</color> and other is <color name="grey1">#999999</color> <color name=

Java Nimbus Button.foreground not working

元气小坏坏 提交于 2019-12-10 17:16:53
问题 I am using the Nimbus LAF on my application and I want to change all buttons foreground colors. I do this setting: UIManager.put("Button.foreground", Color.WHITE); But this is not working. Maybe it is because I should only use the primary and secondary Nimbus colors? Could anyone help me please? Thanks a lot. 回答1: simple way 1) you can set Color once by put value to UIManager , then will be valid for whole (for example JLabel) instance 2) dynamically set and override UIManager repeatedly most