Java Code Examples for javax.swing.plaf.metal.MetalLabelUI

The following examples show how to use javax.swing.plaf.metal.MetalLabelUI. These examples are extracted from open source projects. 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
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());



        } catch (Exception e) {
            throw new RuntimeException(e);
Example 2
Source Project: consulo   Source File:    License: Apache License 2.0 5 votes vote down vote up
private void init() {

  setUI(new MetalLabelUI() {
    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;