Questions tagged [uimanager]

UIManager manages the current look and feel and its defaults.

The UIManager manages the current look and feel, the set of available look and feels, PropertyChangeListeners that are notified when the look and feel changes, look and feel defaults, and convenience methods for obtaining various default values.

Specifying the look and feel

The look and feel can be specified in two distinct ways: by specifying the fully qualified name of the class for the look and feel, or by creating an instance of LookAndFeel and passing it to setLookAndFeel.

Setting the look and feel to the system look and feel:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Setting the look and feel based on class name:

UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");

Defaults

UIManager manages three sets of UIDefaults. They are:

1. Developer defaults - With few exceptions Swing does not alter the developer defaults; these are intended to be modified and used by the developer.
2. Look and feel defaults - The look and feel defaults are supplied by the look and feel at the time it is installed as the current look and feel (setLookAndFeel() is invoked). The look and feel defaults can be obtained using the getLookAndFeelDefaults() method.
3. System defaults - The system defaults are provided by Swing.

179 questions
73
votes
12 answers

Setting the Default Font of Swing Program

I was wondering how to set the default font for my entire Java swing program. From my research it appears it can be done with UIManager, something to do with LookAndFeel, but I can't find specifically how to do it, and the UIManager appears pretty…
Connor Neville
  • 1,028
  • 2
  • 9
  • 13
21
votes
4 answers

Swing UIManager.getColor() keys

Is there a list somewhere of the UIManager.getColor() keys for Swing? I can't seem to find it online, just occasional references to strings like "Panel.background" and "Table.selectionBackground".
Jason S
  • 184,598
  • 164
  • 608
  • 970
21
votes
5 answers

List of Java Swing UI properties?

There seem to be a ton of UI properties that can be set with UIManager.put("key", value); Is there a list somewhere of all keys that can be set?
Epaga
  • 38,231
  • 58
  • 157
  • 245
11
votes
5 answers

How to set jframe look and feel

I am kind of confused on where to put this : try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch(Exception e){ } I did not…
Yayatcm
  • 193
  • 2
  • 3
  • 14
11
votes
6 answers

Changing the background color of a selected JToggleButton

I am trying to change the color of a JToggleButton when it has been selected in a reliable, look and feel independent way. If using the Metal L&F, then using the UIManager is an approach: UIManager.put("ToggleButton.selected", Color.RED); Note: Iyy…
pickypg
  • 22,034
  • 5
  • 72
  • 84
8
votes
4 answers

Java UIManager key list

I've seen people use UIManager to change strings of some pre-created swing components (e.g. JFileChooser). Where can I find some kind of reference that will tell me which strings in which components are changeable, and how can I access them? To…
Karlovsky120
  • 6,212
  • 8
  • 41
  • 94
7
votes
1 answer

Changing the thumb color and background color of a JScrollPane?

I am having trouble styling a JScrollPane. I just want to be able to change the color of both the thumb and the background (and also remove the increase/decrease buttons). So far I have tried the following: this.setBackground(new Color(0,0,0)); …
user1270235
  • 359
  • 3
  • 4
  • 11
7
votes
1 answer

How to setup night mode drawables to work as expected

I what to change background as night mode changes. I have /values and /values-night folder, that contain "colors.xml" with different values. ` #ebebeb #c7c7c7
Solata
  • 1,444
  • 3
  • 28
  • 42
7
votes
3 answers

Undecorated JDialog border

I have a question regarding the border around an undecorated JDialog using the Metal L&F. Look at this picture to see the border that is on this window: I'm trying to figure out how to either get rid of or change the color of the blue border…
Mark
  • 418
  • 1
  • 4
  • 13
7
votes
2 answers

How to change the default font size of Java swing components

When doing Java JFrame design, I need to edit the font size and font type manually each time drag and drop from the Swing palette. The default font of Java Swing components is Tahoma 11 plain. What I want is the font size and font type to be set to…
6
votes
4 answers

Changing colour of panel title in Java Swing

I am running a Swing application on Win7 using a 144 dpi flatscreen monitor. The titles of my frames, option panes, etc., all appear in white on a transparent background (Aero?). I like Aero in general, but the white titles are very hard to read! …
Paul Morrison
  • 1,694
  • 3
  • 20
  • 35
6
votes
2 answers

How do I use a default Nimbus color with UIManager?

I have a custom ListCellRenderer and would like to use the default Nimbus selection backround color. I can lookup the color with: Color selectionBackground = UIManager.getColor("nimbusSelectionBackground"); and if I print it, it has the same values…
Jonas
  • 121,568
  • 97
  • 310
  • 388
5
votes
1 answer

Is there a way to change font color of Jradiobuttons using the UImanager

I know I how to change the font of a JRadioButton using UIManager and I know how to change the color of a JRadioButton, one button at a time. However is there a way, using the UIManager to change all JradioButtons in my application so that the…
Elliott
  • 5,523
  • 10
  • 48
  • 87
5
votes
3 answers

How to change the background color for JPanels with Nimbus Look and Feel?

I want to use a different background color for all my JPanels in an application. How can I do that when using Nimbus Look and Feel? I follow Changing the Color Theme to change the color of components in Nimbus Look and Feel. It only works sometimes,…
Jonas
  • 121,568
  • 97
  • 310
  • 388
5
votes
1 answer

App crash with error: Unable to find JSIModule for class UIManager, after touch event on ad

I've created a component to show ads in my react-native app using react-native-admob-native-ads. It's running perfectly on most of the app screens, but on some screens, the app crashes just after the touch event on the ad, I don't understand the…
Archit garg
  • 61
  • 1
  • 5
1
2 3
11 12