本文整理汇总了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);
}
}
示例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;
}