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


Java ComponentAdapter.getValue方法代码示例

本文整理汇总了Java中org.jdesktop.swingx.decorator.ComponentAdapter.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentAdapter.getValue方法的具体用法?Java ComponentAdapter.getValue怎么用?Java ComponentAdapter.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdesktop.swingx.decorator.ComponentAdapter的用法示例。


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

示例1: highlight

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
@Override
public Component highlight(Component comp, ComponentAdapter compAdapter) {
	Color bg = comp.getBackground();
	JPanel panel = new JPanel(new MigLayout("ins 3"));
	panel.setOpaque(true);
	panel.setBackground(bg);
	try {
		Object val = compAdapter.getValue();
		Integer intVal = Integer.parseInt(val.toString());
		Color clr = new Color(intVal);
		JLabel lb = new JLabel();
		lb.setPreferredSize(new Dimension(24, 16));
		lb.setOpaque(true);
		lb.setBackground(clr);
		panel.add(lb);
		return panel;
	} catch (NumberFormatException e) {
		return panel;
	}
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:21,代码来源:ColorHighlighter.java

示例2: highlight

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
public Component highlight( Component component, ComponentAdapter adapter ) {
    if ( adapter.getValue() instanceof Ticket ) {
        Ticket ticket = (Ticket) adapter.getValue();

        switch( ticket.getPriority() ) {
            case 1:
                component.setBackground( new Color( 0xAA, 0xAA, 0xFF ) );
                break;
            case 2:
                component.setBackground( new Color( 0xDD, 0xDD, 0xFF ) );
                break;
            case 3:
                component.setBackground( new Color( 0xFF, 0xFF, 0xFF ) );
                break;
            case 4:
                component.setBackground( new Color( 0xFF, 0xDD, 0xDD ) );
                break;
            case 5:
                component.setBackground( new Color( 0xFF, 0xAA, 0xAA ) );
                break;
            default:
                System.out.println( "WARNING: unknown priority!" );
        }

        if ( ticket.getStatus().equals( "closed" ) ) {
            component.setForeground( new Color( 0x33, 0x33, 0x33 ) );
        }
        else if ( ticket.getStatus().equals( "resolved" ) ) {
            component.setForeground( new Color( 0x00, 0x88, 0x00 ) );
        }
        else {
            component.setForeground( new Color( 0x00, 0x00, 0x00 ) );
            Font f = component.getFont();
            component.setFont( f.deriveFont( f.getStyle() ^ Font.BOLD ) );
        }
    }

    return component;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:40,代码来源:TicketHighlighter.java

示例3: isHighlighted

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
@Override
// <snip> JXList rollover support
// custom HighlightPredicate which compare the current value
// against a fixed value and returns true if "near"
public boolean isHighlighted(Component renderer,
        ComponentAdapter adapter) {
    if (compare == null) return false;
    if (!(adapter.getValue() instanceof Contributor)) return false;
    Contributor contributor = (Contributor) adapter.getValue();
    return contributor.getMerits() >= compare.getMerits() - 5 && 
        contributor.getMerits() <= compare.getMerits() + 5;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:13,代码来源:XListDemo.java

示例4: getNumber

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
@Override
protected Number getNumber(ComponentAdapter adapter) {
    if (!(adapter.getValue(getValueColumn()) instanceof Contributor)) {
        return null;
    }
    return ((Contributor) adapter.getValue(getValueColumn())).getMerits();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:8,代码来源:HighlighterExtDemo.java

示例5: highlight

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
@Override
public Component highlight(Component comp, ComponentAdapter compAdapter) {
	DateLabel lb = new DateLabel();
	Color bg = comp.getBackground();
	lb.setBackground(bg);
	try {
		Object val = compAdapter.getValue();
		lb.setDate((Date) val);
		return lb;
	} catch (Exception e) {
		return lb;
	}
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:14,代码来源:DateHighlighter.java

示例6: applyBackground

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
@Override
protected void applyBackground(Component renderer, ComponentAdapter adapter) {
	if (!adapter.isSelected()) {
		Color ok, error, disabled;
		if (adapter.getDepth() == 1) {
			ok = new Color(157, 204, 88);
			error = new Color(204, 0, 20);
			disabled = Color.darkGray;
		} else {
			ok = new Color(208, 217, 146);
			error = new Color(230, 80, 70);
			disabled = Color.lightGray;
		}
		Object value = adapter.getValue(PluginInformationPane.UID_INDEX);
		if (value instanceof String) {
			String uid = (String) value;
			if (PluginManager.getInstance().isActive(uid) && PluginManager.getInstance().isCurrentlyEnabled(uid)) {
				renderer.setBackground(ok);
			} else if (!PluginManager.getInstance().isCurrentlyEnabled(uid)) {
				renderer.setBackground(disabled);
			} else if (!PluginManager.getInstance().isActive(uid)) {
				renderer.setBackground(error);
			}
		}
	}
	super.applyBackground(renderer, adapter);
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:28,代码来源:PluginInformationPane.java

示例7: isHighlighted

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
public boolean isHighlighted(java.awt.Component component, ComponentAdapter adapter) {
    Object value = adapter.getValue();
    boolean isNegative = false;
    try {
        double number = Double.parseDouble(value.toString());
        if (number < 0) {
            isNegative = true;
        }
    } catch (NumberFormatException ignore) {}
    return isNegative;
}
 
开发者ID:objektwerks,项目名称:swing,代码行数:12,代码来源:NegativeNumberHighlighter.java

示例8: getNumber

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
/**
 * @param adapter
 * @return
 */
protected Number getNumber(ComponentAdapter adapter) {
    if (adapter.getValue() instanceof Number)
        return (Number) adapter.getValue(valueColumn);
    return null;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:10,代码来源:RelativePainterHighlighter.java

示例9: getNumber

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
/**
 * Returns a Number representation of the cell value or null if it
 * doesn't have any. Subclasses are meant to override this for custom
 * mappings.
 * <p>
 * 
 * This implementation checks and returns the type of the current cell.
 * 
 * @param adapter the ComponentAdapter which defines the current cell.
 * @return a Number representing the current cell or null
 */
// <snip> Relativizer
// simple value-to-Number mapping which handles Number types.
protected Number getNumber(ComponentAdapter adapter) {
    if (adapter.getValue() instanceof Number)
        return (Number) adapter.getValue(valueColumn);
    return null;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:RelativePainterHighlighter.java

示例10: getNumber

import org.jdesktop.swingx.decorator.ComponentAdapter; //导入方法依赖的package包/类
/** 
 * Returns a Number representation of the cell value or null if it 
 * doesn't have any. Subclasses are meant to override this for custom 
 * mappings. 
 * <p> 
 *  
 * This implementation checks and returns the type of the current cell. 
 *  
 * @param adapter the ComponentAdapter which defines the current cell. 
 * @return a Number representing the current cell or null 
 */ 
// <snip> Relativizer 
// simple value-to-Number mapping which handles Number types. 
protected Number getNumber(ComponentAdapter adapter) { 
    if (adapter.getValue() instanceof Number) 
        return (Number) adapter.getValue(valueColumn); 
    return null; 
}
 
开发者ID:dbunibas,项目名称:BART,代码行数:19,代码来源:RelativePainterHighlighter.java


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