Gwt 如何替换此已弃用的方法调用?

Gwt 如何替换此已弃用的方法调用?,gwt,deprecated,Gwt,Deprecated,我正在阅读GWT教程,进入这一行后,我的IDE抱怨说 不推荐调用DateTimeFormat.getMediumDateTimeFormat(): lastUpdatedLabel.setText(“上次更新: " + DateTimeFormat.getMediumDateTimeFormat()格式(新) 日期()) 如何更换电话?根据,您需要使用getFormat(DateTimeFormat.PredefinedFormat.DATE\u MEDIUM)奥利弗·韦勒,我可以听听您的更正或

我正在阅读GWT教程,进入这一行后,我的IDE抱怨说 不推荐调用
DateTimeFormat.getMediumDateTimeFormat()

lastUpdatedLabel.setText(“上次更新: " + DateTimeFormat.getMediumDateTimeFormat()格式(新) 日期())


如何更换电话?

根据,您需要使用
getFormat(DateTimeFormat.PredefinedFormat.DATE\u MEDIUM)

奥利弗·韦勒,我可以听听您的更正或者您的意见吗? 也许对你来说太老了。。。但我是JAVA和GWT新手。。。 我想知道下面的代码是否是这个不推荐使用的方法的一个好而有效的解决方案

谷歌教程提供以下信息:

private void updateTable(股票价格[]价格){
对于(int i=0;i
我把这个放了

  private void updateTable(StockPrice[] prices) {
    for (int i = 0; i < prices.length; i++) {
      updateTable(prices[i]);
    }

    // Display timestamp showing last refresh.
    DateTimeFormat format = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM);
    lastUpdatedLabel.setText("Last update : " + format.format(new Date()));

  }
private void updateTable(股票价格[]价格){
对于(int i=0;i
不知道为什么谷歌没有更新这个教程

请在此处查看确认:

多亏了@qbektrix

我没能找到工作的最后答案。它只需要一个日期戳就可以得到相同的结果

试试这个:

lastUpdatedLabel.setText("Last update: " + 
    DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM)
                .format(new Date()));
@马努,你可以替换

DateTimeFormat.getMediumDateTimeFormat().format(new Date())


这似乎是一个真实的GWT团队答案,因为我在

中找到了它。这应该是一个评论。@qbektrix:看看我的答案。。。第二部分,在“改为放这个”下,说的和你完全一样。否则,谢谢你最后的链接。
DateTimeFormat.getMediumDateTimeFormat().format(new Date())
DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(new Date())