当前位置: 首页>>代码示例>>Java>>正文


Java MetalLabelUI类代码示例

本文整理汇总了Java中javax.swing.plaf.metal.MetalLabelUI的典型用法代码示例。如果您正苦于以下问题:Java MetalLabelUI类的具体用法?Java MetalLabelUI怎么用?Java MetalLabelUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MetalLabelUI类属于javax.swing.plaf.metal包,在下文中一共展示了MetalLabelUI类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAndShowGUI

import javax.swing.plaf.metal.MetalLabelUI; //导入依赖的package包/类
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);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:TitledBorderLabelUITest.java

示例2: getTableCellRendererComponent

import javax.swing.plaf.metal.MetalLabelUI; //导入依赖的package包/类
public Component getTableCellRendererComponent(JTable table,
		Object value, boolean isSelected, boolean hasFocus, int row,
		int column) {
	
	 Component def = table.getDefaultRenderer(String.class).getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        c.setBackground(def.getBackground());
        
        //click pe celula pe vertical highlight  <=> click pe diagonala principala
        
        //System.out.println(VerticalMatrix.getColCounter()    + "     "+column+"   4value: "+value);
        if(hasFocus ){
       	 VerticalTextForHorizontalMatrixCellRenderer.setSelectedCellCol(row);
		 VerticalColorCellRenderer.setSelectedCellCol(row);
		 ColorDSMRenderer.simulateClickOn(row,row);
        }
        
        boolean alreadySet=false;
        //daca celula se expand i jos atunci inseamna ca am parinte cu copii expandati si trebuie scris pe verticala
        if(row+1 < VerticalMatrix.getRowCounter()){
       	 if(EntityVerticalMatrix.getValueAt(row, column) == EntityVerticalMatrix.getValueAt(row+1, column)){
       		 setUI(new VerticalLabelUI(false));
       		 alreadySet=true;
       	 }
        }else{
       	 if(row-1>=0){
       		 if(EntityVerticalMatrix.getValueAt(row, column) == EntityVerticalMatrix.getValueAt(row-1, column)){
        		 setUI(new VerticalLabelUI(false));
        		 alreadySet=true;
        	 }
       	 }
        }
       	 
        if(!alreadySet){
       	 setUI(new MetalLabelUI());	 
        }
        
        
	//get maxDepth
	int maxTreeDepth = EntityCatalog.getMaxTreeDepth();
	int cellDepth = EntityVerticalMatrix.getValueAt(row, column).getTreeDepth();
	
	if(selectedCellRow == row && VerticalMatrix.isAPrintedEntity(row, column)){
		//this entity was somehow cliked and needs to be highlighted
		c.setBackground(Colors.clickedColor);
	}else{
		c.setBackground(Colors.getColor4Depth(cellDepth));
	}
	
           return c;
}
 
开发者ID:ileontiuc,项目名称:DSM,代码行数:52,代码来源:VerticalColorCellRenderer.java


注:本文中的javax.swing.plaf.metal.MetalLabelUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。