Source Code : The MyBean JavaBean Component
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
The MyBean JavaBean Component
import java.awt.Point;
import java.beans.XMLEncoder;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class MyBean {
private String names[];
private Point p;
private int length;
public String[] getNames() {
return names;
}
public Point getPoint() {
return p;
}
public int getLength() {
return length;
}
public void setNames(String newValue[]) {
names = newValue;
}
public void setPoint(Point newValue) {
p = newValue;
}
public void setLength(int newValue) {
length = newValue;
}
public static void main(String args[]) throws IOException {
// Create
MyBean saveme = new MyBean();
saveme.setNames(new String[] { "one", "two", "three" });
saveme.setPoint(new Point(15, 27));
saveme.setLength(6);
// Save
XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
new FileOutputStream("saveme.xml")));
encoder.writeObject(saveme);
encoder.close();
}
}
Thank with us