最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
用Applet读写XML配置文件
时间:2022-07-02 17:56:13 编辑:袖梨 来源:一聚教程网
此小程序用DOM来读取XML文件,用DOM4j来写XML文件。
DOM4j下载地址:http://sourceforge.net/projects/dom4j
1、Applet主程序mainFrame.java
package frame;
/**
* @author wls
*/
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class mainFrame
extends Applet {
DomXml domxml = new DomXml();
Button btnExit = new Button("Exit");
Button btnRun = new Button("Save");
Label lblMain = new Label("dynamicroute.xml配置文件");
Label lblSiteinfo = new Label("srcserverid:");
Label lblPath = new Label("destserverid:");
Label lblFilename = new Label("switchserver:");
Label lblSession = new Label("metric:");
Label lblSuccess = new Label(" ");
TextField txtSiteinfo = new TextField(domxml.getSrcserverid(), 10);
TextField txtPath = new TextField(domxml.getDestserverid(), 10);
TextField txtFilename = new TextField(domxml.getSwitchserver(), 10);
TextField txtSession = new TextField(domxml.getMetric(), 10);
Panel p6 = new Panel();
Panel p1 = new Panel();
Panel p2 = new Panel();
Panel p3 = new Panel();
Panel p4 = new Panel();
Panel p5 = new Panel();
Panel p7 = new Panel();
Panel p8 = new Panel();
public void init() {
resize(400, 300);
p6.add(lblMain);
p1.add(lblSiteinfo);
p1.add(txtSiteinfo);
p2.add(lblPath);
p2.add(txtPath);
p3.add(lblSession);
p3.add(txtSession);
p4.add(btnRun);
p4.add(btnExit);
p5.add(lblFilename);
p5.add(txtFilename);
p8.add(lblSuccess);
setLayout(new GridLayout(4, 2, 1, 1));
add(p6);
add(p7);
add(p1);
add(p2);
add(p5);
add(p3);
add(p4);
add(p8);
DOM4j下载地址:http://sourceforge.net/projects/dom4j
1、Applet主程序mainFrame.java
package frame;
/**
* @author wls
*/
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class mainFrame
extends Applet {
DomXml domxml = new DomXml();
Button btnExit = new Button("Exit");
Button btnRun = new Button("Save");
Label lblMain = new Label("dynamicroute.xml配置文件");
Label lblSiteinfo = new Label("srcserverid:");
Label lblPath = new Label("destserverid:");
Label lblFilename = new Label("switchserver:");
Label lblSession = new Label("metric:");
Label lblSuccess = new Label(" ");
TextField txtSiteinfo = new TextField(domxml.getSrcserverid(), 10);
TextField txtPath = new TextField(domxml.getDestserverid(), 10);
TextField txtFilename = new TextField(domxml.getSwitchserver(), 10);
TextField txtSession = new TextField(domxml.getMetric(), 10);
Panel p6 = new Panel();
Panel p1 = new Panel();
Panel p2 = new Panel();
Panel p3 = new Panel();
Panel p4 = new Panel();
Panel p5 = new Panel();
Panel p7 = new Panel();
Panel p8 = new Panel();
public void init() {
resize(400, 300);
p6.add(lblMain);
p1.add(lblSiteinfo);
p1.add(txtSiteinfo);
p2.add(lblPath);
p2.add(txtPath);
p3.add(lblSession);
p3.add(txtSession);
p4.add(btnRun);
p4.add(btnExit);
p5.add(lblFilename);
p5.add(txtFilename);
p8.add(lblSuccess);
setLayout(new GridLayout(4, 2, 1, 1));
add(p6);
add(p7);
add(p1);
add(p2);
add(p5);
add(p3);
add(p4);
add(p8);
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22