javax.swing.plaf.metal.MetalLabelUI Java Examples
The following examples show how to use
javax.swing.plaf.metal.MetalLabelUI.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TitledBorderLabelUITest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void createAndShowGUI() { try { UIManager.setLookAndFeel(new TestLookAndFeel()); JLabel label = new JLabel("Test Label"); label.setSize(SIZE, SIZE); TitledBorder border = new TitledBorder("ABCDEF"); label.setBorder(new TitledBorder(border)); if (useLAF) { UIManager.setLookAndFeel(new NimbusLookAndFeel()); } else { UIManager.getDefaults().put("LabelUI", MetalLabelUI.class.getName()); } SwingUtilities.updateComponentTreeUI(label); paintToImage(label); } catch (Exception e) { throw new RuntimeException(e); } }
Example #2
Source File: DropDownLink.java From consulo with Apache License 2.0 | 5 votes |
private void init() { setIconTextGap(JBUIScale.scale(1)); setHorizontalAlignment(SwingConstants.LEADING); setHorizontalTextPosition(SwingConstants.LEADING); setUI(new MetalLabelUI() { @Override protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR) { String result = super.layoutCL(label, fontMetrics, text, icon, viewR, iconR, textR); iconR.y += JBUIScale.scale(1); return result; } }); }