Use Applet to read and write XML configuration files

Source: Internet
Author: User

This applet uses DOM to read XML files and DOM4j to write XML files.
DOM4j: http://sourceforge.net/projects/dom4j
1. Applet main program 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 configuration file ");
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 );

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.