本文整理汇总了Java中net.sf.freecol.client.gui.panel.Utility.localizeToolTip方法的典型用法代码示例。如果您正苦于以下问题:Java Utility.localizeToolTip方法的具体用法?Java Utility.localizeToolTip怎么用?Java Utility.localizeToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.freecol.client.gui.panel.Utility
的用法示例。
在下文中一共展示了Utility.localizeToolTip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractUnitOptionUI
import net.sf.freecol.client.gui.panel.Utility; //导入方法依赖的package包/类
/**
* Creates a new {@code AbstractUnitOptionUI} for the given
* {@code AbstractUnitOption}.
*
* @param option The {@code AbstractUnitOption} to make a
* user interface for
* @param editable boolean whether user can modify the setting
*/
public AbstractUnitOptionUI(final AbstractUnitOption option,
final boolean editable) {
super(option, editable);
this.panel = new MigPanel();
this.panel.setLayout(new MigLayout());
IntegerOption numberOption = option.getNumber();
UnitTypeOption typeOption = option.getUnitType();
StringOption roleOption = option.getRole();
boolean numberEditable = editable
&& (numberOption.getMaximumValue() > numberOption.getMinimumValue());
this.numberUI = new IntegerOptionUI(numberOption, numberEditable);
Utility.localizeToolTip(this.numberUI.getComponent(), "number");
this.panel.add(this.numberUI.getComponent(), "width 30%");
boolean typeEditable = editable
&& typeOption.getChoices().size() > 1;
this.typeUI = new UnitTypeOptionUI(typeOption, typeEditable);
Utility.localizeToolTip(this.typeUI.getComponent(), "unitType");
this.typeUI.getComponent().addItemListener(this);
this.panel.add(this.typeUI.getComponent(), "width 35%");
roleEditable = editable
&& roleOption.getChoices().size() > 1;
this.roleUI = new StringOptionUI(roleOption, roleEditable);
Utility.localizeToolTip(this.roleUI.getComponent(), "model.role.name");
this.roleUI.getComponent().setRenderer(new RoleRenderer());
this.panel.add(this.roleUI.getComponent(), "width 35%");
initialize();
}
示例2: initialize
import net.sf.freecol.client.gui.panel.Utility; //导入方法依赖的package包/类
/**
* Initialize this label.
*/
private void initialize() {
final Goods goods = getGoods();
final Location location = goods.getLocation();
final Player player = (location instanceof Ownable)
? ((Ownable) location).getOwner()
: null;
final GoodsType type = goods.getType();
final Specification spec = goods.getGame().getSpecification();
if (getAmount() < GoodsContainer.CARGO_SIZE) setPartialChosen(true);
if (player == null
|| !type.isStorable()
|| player.canTrade(type)
|| (location instanceof Colony
&& spec.getBoolean(GameOptions.CUSTOM_IGNORE_BOYCOTT)
&& ((Colony) location).hasAbility(Ability.EXPORT))) {
Utility.localizeToolTip(this, goods.getLabel(true));
} else {
Utility.localizeToolTip(this, goods.getLabel(false));
setIcon(getDisabledIcon());
}
setForeground(getColor(type, goods.getAmount(), location));
setText(String.valueOf(goods.getAmount()));
}