如何制作一个包含java按钮的未修饰窗口?

时间:2015-11-22 06:35:31

标签: java swing user-interface awt

我用java创建了一个圆窗,它没有装饰..问题是当我试图在框架中添加一个按钮或标签时,里面没有显示任何内容。

有人可以帮助我吗?

编辑

这是我制作的代码:

public static List<EnergyUsageData> process(final Collection<EnergyUsageData> data) {
    final Map<EnergyType, Map<YearMonth, BigDecimal>> tempMap = new HashMap<>();
    final List<EnergyUsageData> energyUsageData = data.stream()
            .flatMap(d -> d.getBillsMap().entrySet().stream().map(
                    dd -> new FlatData(d.getType(), dd.getKey(), dd.getValue())))
            .filter(d -> {
                final Map<YearMonth, BigDecimal> map = tempMap.get(d.type);
                if (map != null) {
                    final BigDecimal amount = map.get(d.yearMonth);
                    map.put(d.yearMonth, amount.add(d.amount));
                    return false;
                }
                return true;
            })
            .map(d -> {
                final HashMap<YearMonth, BigDecimal> billsMap = new HashMap<>();
                billsMap.put(d.yearMonth, d.amount);
                tempMap.put(d.type, billsMap);
                return new EnergyUsageData(d.type, billsMap);
                //Assuming Constructor of EnergyUsageData will hold
                // the reference of billsMap and will not copy billsMap
            })
            .collect(Collectors.toList());
    return energyUsageData;
}

final class FlatData {
    public final EnergyType type;
    public final YearMonth yearMonth;
    public final BigDecimal amount;

    FlatData(EnergyType type, YearMonth yearMonth, BigDecimal amount) {
        this.type = type;
        this.yearMonth = yearMonth;
        this.amount = amount;
    }
}

}

0 个答案:

没有答案