编写一个完整的Java applet程序,程序功能为:在屏幕上输出“欢迎光临Java世界!”的字符串信息。
4个回答
展开全部
import java.awt.*;
public class test extends javax.swing.JApplet{
public void paint(Graphics comp){
Graphics2D gt=(Graphics2D)comp;
gt.drawString("欢迎光临Java世界",getSize().width/2-60,getSize().height/2);
}
}
public class test extends javax.swing.JApplet{
public void paint(Graphics comp){
Graphics2D gt=(Graphics2D)comp;
gt.drawString("欢迎光临Java世界",getSize().width/2-60,getSize().height/2);
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-03-29
展开全部
/**
* @(#)Myapplet.java
* @author
* @version 1.00 2010/3/13
*/import java.awt.*;
import java.awt.Graphics;
import javax.swing.JApplet;
public class Myapplet extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
// TODO start asynchronous download of heavy resources
} public void paint(Graphics g) {
g.drawString("欢迎光临Java世界!",50,60);
}
} Myapplte.html<HTML> <APPLET CODE="Myapplet.class" WIDTH=250 HEIGHT=100>
</APPLET>
</HTML>
* @(#)Myapplet.java
* @author
* @version 1.00 2010/3/13
*/import java.awt.*;
import java.awt.Graphics;
import javax.swing.JApplet;
public class Myapplet extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
// TODO start asynchronous download of heavy resources
} public void paint(Graphics g) {
g.drawString("欢迎光临Java世界!",50,60);
}
} Myapplte.html<HTML> <APPLET CODE="Myapplet.class" WIDTH=250 HEIGHT=100>
</APPLET>
</HTML>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class Demo{
public static void main(String[] args) {
System.out.println("欢迎光临java世界!");
}
}
public static void main(String[] args) {
System.out.println("欢迎光临java世界!");
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
* into the browser.
*/
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询