编写一个完整的Java applet程序,程序功能为:在屏幕上输出“欢迎光临Java世界!”的字符串信息。

如题所述

第1个回答  2013-03-28
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);
}
}本回答被网友采纳
第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>
第3个回答  2013-03-28
public class Demo{
public static void main(String[] args) {
System.out.println("欢迎光临java世界!");
}
}
第4个回答  2018-06-15
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/

编写一个JAVA APPLET ,使它能够在浏览器中显示“WELCOME TO JAVA A...
两个文件 HelloWorld.java import java.applet.Applet;import java.awt.Graphics;public class HelloWorld extends Applet { public void paint (Graphics g){ g.drawString ("WELCOME TO JAVA APPLET WORLD!",10,10);} } 另一个网页文件HelloWorld.htm <HTML> <HEAD> <TITLE>Applet HTML 页面<\/TI...

...的程序,用两种方式实现(Application \/Applet)
public static void main(String[] args){ System.out.println("欢迎来到java编程世界");} } Applet 程序如下:import java.awt.Container;import javax.swing.JLabel;import javax.swing.JApplet;import javax.swing.JButton;import javax.swing.JPanel;public class WelcomeApplet extends JApplet { p...

编个Applet小程序,在浏览器上显示字符串“欢迎大家学习Java!”字样...
import java.applet.*;import java.awt.*;public class Hello extends Applet{ public void paint(Graphics g){ g.drawString("欢迎大家学习Java!",100,100);} } \/\/新建Show.html <html> <body> <applet code="Hello.class" width=300 height=200> <\/applet> <\/body> <\/html> 在cmd命令...

...的程序,用两种方式实现(Application \/Applet).
} 这个是application的,这个比较简单,所以就不多说了 下面的是applet的,给你写详细点 你新建一个welcome类,把下面的代码放进去 import java.applet.*;import java.awt.*;public class welcome extends Applet{ public void paint(Graphics g){ g.drawString("欢迎进入Java编程世界!",20,60);} ...

“欢迎进入精彩java世界”用java编程
application:public class Test;public static void main(String args[]){ System.out.println("欢迎进入精彩java世界");} applet:<applet>代码:import java.awt.*;import java.applet.Applet;public class TestApplet extens Applet ;public void paint(Graphics g){ g.drawString("欢迎进入精彩java...

编写Applet程序,在屏幕上输出A到Z的26个字母,排成三行,前两行每生10...
import java.applet.*;\/\/<applet code=Char height=200 width=200><\/applet> public class Char extends Applet { Panel p=new Panel();Label l1=new Label("abcdefghij");Label l2=new Label("klmnopqrst");Label l3=new Label("uvwxyz");public void init(){ p.setLayout(new GridBagLayout...

如何用applet编写“欢迎来学习java”程序
import java.applet.Applet;import java.awt.Graphics;public class FirstApplet extends Applet{ public void paint(Graphics g){ g.drawString("欢迎来学习java", 10, 50);} }

...的程序,用4 种方式实现(Application、Applet、jsp、servlet...
1、application程序 public class a { public static void main(String args[]){ System.out.println("Hello World!");} } 2、applet程序 public class b extends java.applet.Applet { public paint(java.awt.Graphics g){ g.outstring("Hello World!",10,10);} } 3、jsp程序 < out.print...

...的程序,用两种方式实现(Application、Applet)。
1、首先打开VC++6.0编译器,使用快捷键Ctrl+N,或者点击菜单栏的新建, 建立一个工程,选择倒数第三个 console application,给工程命名。2、然后点击建立一个空工程,如图,点击完成。3、然后继续Ctrl+N,新建一个文件,选择C++ source files,命名。4、进入到新建的 .cpp窗口中,切换至英文输入法,...

怎样编写加载运行java applet的简单网页?
Create a new HTML file using a text editor or web development tool.Add the following code to the <head> section of the HTML file:This will include the necessary JavaScript file that will enable the web page to load and run the Java applet.Add an <applet> element to the <...

相似回答