import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import org.jdom.*; import org.jdom.input.*; import org.jdom.output.*; class Card { public String name, title, email, phone, logo; public Card(String name, String title, String email, String phone, String logo) { this.name = name; this.title = title; this.email = email; this.phone = phone; this.logo = logo; } } public class BCedit extends Frame implements ActionListener { // declare the user interface Button ok = new Button("ok"); Button delete = new Button("delete"); Button clear = new Button("clear"); Button save = new Button("save"); Button quit = new Button("quit"); TextField name = new TextField(20); TextField title = new TextField(20); TextField email = new TextField(20); TextField phone = new TextField(20); TextField logo = new TextField(20); Panel cardpanel = new Panel(new GridLayout(0, 1)); String cardfile; Vector cardvector; int current = -1; Namespace b = Namespace.getNamespace("http://businesscard.org"); public static void main(String[] args) { new BCedit(args[0]); } Vector doc2vector(Document d) { Vector v = new Vector(); Iterator i = d.getRootElement().getChildren("card", b).iterator(); while (i.hasNext()) { Element e = (Element)i.next(); String phone = e.getChildText("phone", b); if (phone==null) phone=""; Element logo = e.getChild("logo", b); String uri; if (logo==null) uri = ""; else uri = logo.getAttributeValue("uri"); Card c = new Card(e.getChildText("name", b), e.getChildText("title", b), e.getChildText("email", b), phone, uri); v.add(c); } return v; } Document vector2doc() { Element cardlist = new Element("cardlist", b); for (int i=0; i