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