How you can change fields in Nimbus Look and Feel

I'm trying to use Nimbus Look and Feel, and I can't just plug it in to replace another Look and feel, because it adds an external add-on to each component.

So, I would like to remove this add-on. This is the default list that you can change, but the following code does not change anything.

UIManager.put("Button.contentMargins", new Insets(0, 0, 0, 0));

Other values ​​work as expected.

How to remove this add-on?

EDIT

I believe the content fields are internal filling.

EDIT

Looking at the source code , the external add-on looks tough. I believe this is added to provide a focus select property.

? L & F , ( , ).

+3
2

, , ( , - ):

 {   UIManager.setLookAndFeel( "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel" );   UIManager.getLookAndFeelDefaults(). Put ( "Table.cellNoFocusBorder",   (0,0,0,0));   UIManager.getLookAndFeelDefaults(). Put ( "Table.focusCellHighlightBorder",   (0,0,0,0));    Insets =   (3, 6, 3, 6);   UIManager.getLookAndFeelDefaults(). Put ( "Button.contentMargins", buttonInsets);
}
catch ( e) {   e.printStackTrace();
}

, "LookAndFeelDefaults", "".

+4

nimbus , getDefaults():

NimbusLookAndFeel laf = new NimbusLookAndFeel();
UIManager.setLookAndFeel(laf);
UIDefaults def = laf.getDefaults();
def.put("Button.contentMargins", new Insets(0,0,0,0));
def.put("DesktopIcon.contentMargins", new Insets(0,0,0,0));
def.put("Label.contentMargins", new Insets(0,0,0,0));

UIManager.put() nimbus, .

0

Source: https://habr.com/ru/post/1705931/


All Articles