类javax.swing.plaf.metal.MetalLabelUI源码实例Demo

下面列出了怎么用javax.swing.plaf.metal.MetalLabelUI的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openjdk-jdk9   文件: TitledBorderLabelUITest.java
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);
        }
    }
 
源代码2 项目: consulo   文件: DropDownLink.java
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;
    }
  });
}
 
 类所在包
 类方法
 同包方法