Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 实战错误讨论  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 简单问题请教:程序运行后不能显示
yxh520





发贴: 3
积分: 0
于 2005-06-16 12:22 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
请教高手:此程序可编译,运行,但显示不出来。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class tianshi
{
public static void main(String[] args)
{
tsF frame = new tsF();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}

//A frame that contains a message panel
class tsF extends JFrame
{
public tsF()
{
setTitle("tianshi");

// add panel to frame
tsP panel = new tsP();
Container contentPane = getContentPane();
contentPane.add(panel);

// get screen dimensions
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;

// center frame in screen
setSize(screenWidth / 2, screenHeight / 2);
setLocation(screenWidth / 4, screenHeight / 4);

// set frame icon and title
Image img = kit.getImage("001.gif");
setIconImage(img);
}
}

/**
A panel that displays a message.
*/

class tsP extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponentPresent;

g.drawString("tianshi",
MESSAGE_X, MESSAGE_Y);
}

public static final int MESSAGE_X = 75;
public static final int MESSAGE_Y = 100;
}




JSR 371——Java EE 8新的MVC框架

话题树型展开
人气 标题 作者 字数 发贴时间
7030 简单问题请教:程序运行后不能显示 yxh520 1601 2005-06-16 12:22
5729 Re:简单问题请教:程序运行后不能显示 ysonic 27 2005-06-16 15:53
5587 Re:简单问题请教:程序运行后不能显示 yxh520 59 2005-06-16 16:38
5624 Re:简单问题请教:程序运行后不能显示 snowbird2005 13 2005-06-16 20:09
6501 Re:简单问题请教:程序运行后不能显示 andys_king 6 2005-07-08 01:29

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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