Topic: 调试出错( overrides a deprecated API.) |
Print this page |
1.调试出错( overrides a deprecated API.) | Copy to clipboard |
Posted by: wind520sand Posted on: 2005-05-18 00:14 import javax.swing.*; import java.awt.*; import java.awt.geom.*; public class MainFrame { public static void main(String[] args) { InitFrame frame = new InitFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show(); } } class InitPane extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); g.drawString("一生平安",WIDTH,HEIGHT); g.drawRect(100,100,100,80); } private static final int WIDTH=50; private static final int HEIGHT=50; } class InitFrame extends JFrame { public InitFrame() { setTitle("ok"); setSize(WID,HEI); InitPane pane =new InitPane(); Container contentpane = getContentPane(); contentpane.add(pane); } private static final int WID=500; private static final int HEI=500; } 结果就提示如下了 C:\pro>javac MainFrame.java Note: MainFrame.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 我真是不知道该如何了?才请教大家的啊[:(] |
2.Re:调试出错( overrides a deprecated API.) [Re: wind520sand] | Copy to clipboard |
Posted by: wind520sand Posted on: 2005-05-18 00:16 上边代码的那个礼物图象是g,有括号的,怎么变成了礼物了?? 请多多指教 |
3.Re:调试出错( overrides a deprecated API.) [Re: wind520sand] | Copy to clipboard |
Posted by: why Posted on: 2005-05-18 00:27 search for the meaning of deprecated and its implications. Disable Simlies and the 礼物 will display as (g) http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Component.html#show() public void show() Deprecated. As of JDK version 1.1, replaced by setVisible(boolean). |
4.Re:调试出错( overrides a deprecated API.) [Re: wind520sand] | Copy to clipboard |
Posted by: wind520sand Posted on: 2005-05-18 07:51 我知道了,用 setVisible(ture)代替show() 真是技术更新的真快啊 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |