初次接触C,JAVA 。感觉很有趣,好象很有信心去学。可是还没有发现有类似的网络平台去学西,也没有什么大鸟级的人物学习、研发的过程,去学习。也很希望自己将来成了大虾后,能留下些东西,让后人学习。
Apple import java.applet.Applet; import java.awt.Graphics; public class Apple extends Applet ...{ StringBuffer buffer; public
void
init() ...{ buffer
=
new
StringBuffer(); addItem(
"
initializing...
"
); } public
void
start() ...{ addItem(
"
starting...
"
); } public
void
stop() ...{ addItem(
"
stopping...
"
); } public
void
destroy() ...{ addItem(
"
preparing for unloading...
"
); }
void
addItem(String newWord) ...{ System.out.println(newWord); buffer.append(newWord); repaint(); } public
void
paint(Graphics g) ...{
//
Draw a Rectangle around the applet's display area. g.drawRect(0, 0, size().width - 1, size().height - 1); //Draw the current string inside the rectangle. g.drawString(buffer.toString(), 5, 15); } } MyApplet import java.awt.*; import java.applet.*; public class MyApplet extends Applet { public void init() { this.setBackground(Color.blue); this.setLayout(new FlowLayout()); this.add(new Button("Button1")); this.add(new Button("Button2")); } } MyApplet2 import java.awt.*; import java.applet.*; public class MyApplet2 extends Applet { public void paint(Graphics g) { g.drawString("hello there", 200, 250); } } FirstApp import java.awt.*; public class FirstApp extends Frame { public FirstApp(String title) { super(title); } public static void main(String argv[]) { FirstApp fa = new FirstApp("First Application"); Button b = new Button("Ok"); fa.add(b); fa.setSize(400, 160); fa.setVisible(true); } } MyClass import java.awt.*; import java.applet.*; public class MyClass extends Frame { public static void main(String argv[]) { Applet applet = new MyApplet(); Frame f = new Frame("Applet as an Application"); f.add(applet); f.setSize(400, 160); f.setVisible(true); applet.init(); applet.start(); } }