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
5
votes
2 answers

UI properties does not contain some keys

I have the following problem. I need to get an UI properties: UIManager.getString("OptionPane.okButtonText") that returns the string "OK", and it works. However, if I iterate through the UIDefaults keyset, I never get the key…
Alberto
  • 1,569
  • 1
  • 22
  • 41
5
votes
2 answers

Set JButton background color on windows

I have a JButton which I want to set the background to a color. JButton button = new JButton(); button.setVisible(true); button.setPreferredSize(new Dimension(student_scroll.getWidth(),…
Moon Cheesez
  • 2,489
  • 3
  • 24
  • 38
5
votes
1 answer

Swing UI does not have native OS look

I am building an application in java swing and I am using the following code to give the UI a native OS look try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } On a…
Virat Kadaru
  • 2,216
  • 4
  • 23
  • 28
5
votes
1 answer

Why does UIManager.getDefaults().keySet() return different values than UIManager.getDefaults().keys()?

I'm using the code from this stackOverflow post, which does what I expect: Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value =…
Alex Pritchard
  • 4,260
  • 5
  • 33
  • 48
5
votes
2 answers

JProgressBar Changing Bar Color dynamically

I am using JProgressBar component along with the Nimbus UI Defaults. The problem is that When I want to manually change each progressbar's Bar color, I use BasicProgressBarUI by setting JProgressBar.setUI() function. This makes more trouble because…
mbasol
  • 105
  • 1
  • 2
  • 9
5
votes
3 answers

Swing: remove focus border from dialogues' buttons

I wonder how can I remove this grey border from buttons in dialogues? For simple JButtons I found a solution - just use button.setFocusPainted(false); But is there a simple way to perform the same for all buttons in all dialogues? I tried to look…
Kirill Smirnov
  • 1,452
  • 2
  • 21
  • 28
5
votes
2 answers

JTextField with JLabel style using GTKLookAndFeel

I need a JTextField with a JLabel style (in other words, I need a JLabel but I want to be able to select the text). JTextField value = new…
Ivan
  • 1,477
  • 3
  • 18
  • 36
4
votes
1 answer

Java Nimbus Button.foreground not working

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…
Lucas
  • 113
  • 6
4
votes
4 answers

How to set all Java Swing GUI component backgrounds and foreground(fonts) colors at once?

I have tons of jbuttons, jtextfields, jlabels, jmenus, gui items and it is extremely time consuming to set the background color and foreground color one at a time. I want to be able to color the fonts(foreground) and backgrounds all the jmenus,…
Philip Nguyen
  • 871
  • 2
  • 10
  • 29
4
votes
4 answers

Invariant Violation: RNCSafeAreaProvider was not found in the UIManager

I'm new to react native and have some experience with using regular React and am trying to get react native navigation setup but am running into the following error when following the docs. I've tried starting from scratch and reinstalling…
Harry Redding
  • 61
  • 1
  • 3
4
votes
2 answers

Expo: UIManager throwing warning UIManager

This message seems like some package is using UIManager["RCTView"] which is no longer supported but I am not sure how to fix this Accessing view manager configs directly off UIManager via UIManager['RCTView'] is no longer supported. Use …
LittleFunny
  • 8,155
  • 15
  • 87
  • 198
4
votes
1 answer

Change color of JTabbedPane border

I'm trying to change the color of the default blue-gray border on my JTabbedPane. You can see the border circled in the image below. I want to make this a dark gray color. I've tried using the following UIManager properties (which result in the UI…
petehallw
  • 1,014
  • 6
  • 21
  • 49
4
votes
2 answers

Change JButton's Disabled Foreground (Font) Color for Windows

I realize this sounds a LOT like many of the questions already posted out there, but please read on; this has a seemingly similar problem but has not worked with many solutions already provided. I am currently writing in Java with Eclipse on both OS…
user2323030
  • 1,193
  • 4
  • 16
  • 37
4
votes
1 answer

Java Metal Look & Feel hides Windows toolbar when maximized

In my application we use CrossPlatform L&F (metal) and we want to launch the main JFrame maximized. When executing I find the windows toolbar hidden. This does not happen if I use System L&F. Why is this so? Is there any way to avoid this? Code…
4
votes
2 answers

TitledBorder border color and width using UIManager

To change all TitledBorder fonts, I am using UIManager: UIManager.put("TitledBorder.font", new Font("Tahoma", Font.BOLD, 11)); But what to put to TitledBorder.border property to change only the color of the border (or maybe even it's width)? Cheers
radzi0_0
  • 1,250
  • 2
  • 14
  • 24
1
2
3
11 12