📄 showpicapplet.java
字号:
package com.applet;
import java.awt.*;
import javax.swing.*;
public class ShowPicApplet extends JApplet {
public String content=null;
public boolean isStandalone = false;
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
public ShowPicApplet() {
}
public void init() {
try {
jbInit();
myInit();//自己定义的方法
}
catch(Exception e) {
e.printStackTrace();
}
}
public void jbInit() throws Exception {
this.setSize(new Dimension(400,300));
}
/**
* 自定义的初始化方法,读入系统中的一个文件的内容并保存起来,然后,增加一个
* 可视化的输出框
*/
public void myInit(){
ShowPic showpic=new ShowPic();
content=showpic.content+"\n";
System.out.println(content);
}
//将content内容输入到管道当中去
/*
private void getContent(){
try{
}catch(Exception e){
}
try{
PipedOutputStream pout=new PipedOutputStream();
PipedInputStream pin=new PipedInputStream(pout);
}catch(IOException e){
e.printStackTrace();
}
}
*/
/*
*重载的方法,输出内容
**/
public void paint(Graphics g){
g.drawRoundRect(45, 35, 250, 20, 10, 10);
g.drawString("let's go into applet's world!", 100, 50);
}
public String getAppletInfo() {
return "Applet Information";
}
public String[][] getParameterInfo() {
return null;
}
//static initializer for setting look & feel
static {
try {
}
catch(Exception e) {
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -