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


Java CargoPanel类代码示例

本文整理汇总了Java中net.sf.freecol.client.gui.panel.CargoPanel的典型用法代码示例。如果您正苦于以下问题:Java CargoPanel类的具体用法?Java CargoPanel怎么用?Java CargoPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CargoPanel类属于net.sf.freecol.client.gui.panel包,在下文中一共展示了CargoPanel类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCargo

import net.sf.freecol.client.gui.panel.CargoPanel; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Component addCargo(Component comp, Unit carrier, CargoPanel cargoPanel) {
    MarketLabel label = (MarketLabel) comp;
    Player player = carrier.getOwner();
    if (!player.canTrade(label.getType())) {
        cargoPanel.igc().payArrears(label.getType());
        return null;
    }
    int loadable = carrier.getLoadableAmount(label.getType());
    if (loadable <= 0) return null;
    if (loadable > label.getAmount()) loadable = label.getAmount();
    cargoPanel.igc().buyGoods(label.getType(), loadable, carrier);
    cargoPanel.igc().nextModelMessage();
    cargoPanel.update();
    return comp;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:20,代码来源:MarketLabel.java

示例2: addCargo

import net.sf.freecol.client.gui.panel.CargoPanel; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Component addCargo(Component comp, Unit carrier, CargoPanel cargoPanel) {
    Goods goods = ((GoodsLabel) comp).getGoods();
    int loadable = carrier.getLoadableAmount(goods.getType());
    if (loadable <= 0) return null;
    if (loadable > goods.getAmount()) loadable = goods.getAmount();
    Goods toAdd = new Goods(goods.getGame(), goods.getLocation(),
                            goods.getType(), loadable);
    goods.setAmount(goods.getAmount() - loadable);
    cargoPanel.igc().loadCargo(toAdd, carrier);
    cargoPanel.update();
    return comp;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:GoodsLabel.java

示例3: removeCargo

import net.sf.freecol.client.gui.panel.CargoPanel; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void removeCargo(Component comp, CargoPanel cargoPanel) {
    Goods g = ((GoodsLabel) comp).getGoods();
    cargoPanel.igc().unloadCargo(g, false);
    cargoPanel.update();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:GoodsLabel.java

示例4: addCargo

import net.sf.freecol.client.gui.panel.CargoPanel; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Component addCargo(Component comp, Unit carrier, CargoPanel cargoPanel) {
    Unit unit = ((UnitLabel)comp).getUnit();
    if (carrier.canAdd(unit)) {
        Container oldParent = comp.getParent();
        if (cargoPanel.igc().boardShip(unit, carrier)) {
            ((UnitLabel) comp).setSmall(false);
            if (oldParent != null) oldParent.remove(comp);
            cargoPanel.update();
            return comp;
        }
    }
    return null;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:18,代码来源:UnitLabel.java

示例5: removeCargo

import net.sf.freecol.client.gui.panel.CargoPanel; //导入依赖的package包/类
@Override
public void removeCargo(Component comp, CargoPanel cargoPanel) {
    Unit unit = ((UnitLabel)comp).getUnit();
    cargoPanel.igc().leaveShip(unit);
    cargoPanel.update();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:7,代码来源:UnitLabel.java

示例6: addCargo

import net.sf.freecol.client.gui.panel.CargoPanel; //导入依赖的package包/类
/**
 * The {@code Component} to add to a {@code CargoPanel}.
 *
 * @param comp The input Component to add.
 * @param carrier The Carrier to add the component too.
 * @param cargoPanel The CargoPanel to affect.
 * @return The output Component to add.
 */
public Component addCargo(Component comp, Unit carrier, CargoPanel cargoPanel);
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:CargoLabel.java

示例7: removeCargo

import net.sf.freecol.client.gui.panel.CargoPanel; //导入依赖的package包/类
/**
 * The {@code Component} to remove from a {@code CargoPanel}.
 *
 * @param comp The Component to remove.
 * @param cargoPanel The {@link CargoPanel} to affect.
 */
public default void removeCargo(Component comp, CargoPanel cargoPanel) {
    cargoPanel.update();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:CargoLabel.java


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