本文整理汇总了Java中net.sf.freecol.client.gui.label.UnitLabel.setTransferHandler方法的典型用法代码示例。如果您正苦于以下问题:Java UnitLabel.setTransferHandler方法的具体用法?Java UnitLabel.setTransferHandler怎么用?Java UnitLabel.setTransferHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.freecol.client.gui.label.UnitLabel
的用法示例。
在下文中一共展示了UnitLabel.setTransferHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import net.sf.freecol.client.gui.label.UnitLabel; //导入方法依赖的package包/类
/**
* Update this DestinationPanel.
*/
public void update() {
removeAll();
HighSeas highSeas = getMyPlayer().getHighSeas();
if (highSeas != null) {
for (Unit unit : highSeas.getUnitList()) {
boolean belongs;
if (destination instanceof Europe) {
belongs = unit.getDestination() == destination;
} else if (destination instanceof Map) {
belongs = unit.getDestination() == destination
|| (unit.getDestination() != null
&& unit.getDestination().getTile() != null
&& unit.getDestination().getTile().getMap()
== destination);
} else {
logger.warning("Bogus DestinationPanel location: "
+ destination
+ " for unit: " + unit);
belongs = false;
}
if (belongs) {
UnitLabel unitLabel
= new UnitLabel(getFreeColClient(), unit);
unitLabel.setTransferHandler(defaultTransferHandler);
unitLabel.addMouseListener(pressListener);
add(unitLabel);
}
}
}
// "ship" is a tag, not a key
Utility.localizeBorder(this, Unit.getDestinationLabel("ship",
destination, getMyPlayer()));
revalidate();
}
示例2: update
import net.sf.freecol.client.gui.label.UnitLabel; //导入方法依赖的package包/类
/**
* Update this unit panel.
*/
public void update() {
removeAll();
if (portPanel != null) {
for (Unit unit : transform(portPanel.getUnitList(),
u -> accepts(u))) {
UnitLabel unitLabel
= new UnitLabel(portPanel.getFreeColClient(), unit);
TradeRoute tradeRoute = unit.getTradeRoute();
if (tradeRoute != null) {
unitLabel.setDescriptionLabel(unit
.getDescription(Unit.UnitLabelType.NATIONAL)
+ " (" + tradeRoute.getName() + ")");
}
if (editable) {
unitLabel.setTransferHandler(portPanel.getTransferHandler());
unitLabel.addMouseListener(portPanel.getPressListener());
}
add(unitLabel);
}
}
selectLabel();
revalidate();
repaint();
}
示例3: update
import net.sf.freecol.client.gui.label.UnitLabel; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void update() {
super.update();
if (ColonyPanel.this.isEditable()) {
for (UnitLabel unitLabel : getUnitLabels()) {
unitLabel.setTransferHandler(defaultTransferHandler);
unitLabel.addMouseListener(pressListener);
}
}
}