中易网

创建一个名为HelloWorldApp的java application,在屏幕上简单的显示一句话"Hello

答案:1  悬赏:30  
解决时间 2021-01-17 09:55
  • 提问者网友:雨不眠的下
  • 2021-01-16 14:21
创建一个名为HelloWorldApp的java application,在屏幕上简单的显示一句话"Hello
最佳答案
  • 二级知识专家网友:雾月
  • 2021-01-16 15:29
做一个frame,显示窗口是吧
import javax.swing.JFrame;    
import javax.swing.JLabel;    
public class HelloWorld {    
public static void main(String[] args) {    
JFrame frame = new JFrame("HelloWorldSwing");    
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    
// Add the ubiquitous "Hello World" label.    
JLabel label = new JLabel("Hello World");    
frame.getContentPane().add(label);    
// Display the window.    
frame.pack(); // pack -> determine the size of the window    
frame.setVisible(true);    
}    
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息