With this example we are going to demonstrate how to draw an image in an Applet. A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must ...
Read More »Get an applet parameter
This is an example of how to get an Applet parameter. A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must be a subclass of the ...
Read More »Applet lifecycle methods
In this example we shall show you the Applet lifecycle methods. A Java applet is a special kind of Java program that a browser enabled with Java technology can download from the internet and run. An applet is typically embedded inside a web page and runs in the context of a browser. An applet must be a subclass of the ...
Read More »Bean XML deserialization
With this example we are going to demonstrate how to deserialize a java Bean using the XMLDecoder. The XMLDecoder class is used to read XML documents created using the XMLEncoder and is used just like the ObjectInputStream. In short, to deserialize a java Bean using the XMLDecoder you should: Create an xml representation of the java bean. Create a simple ...
Read More »Bean XML serialization
This is an example of how to serialize a java Bean using the XMLEncoder. The XMLEncoder class is a complementary alternative to the ObjectOutputStream and can used to generate a textual representation of a JavaBean in the same way that the ObjectOutputStream can be used to create binary representation of Serializable objects. Serializing a java Bean using the XMLEncoder implies ...
Read More »Bean property change event listener
In this example we shall show you how to change a Bean’s property using an event listener. We will use the PropertyChangeListener interface. This interface can be registered with a bean so as to be notified of any bound property updates. We are also using the PropertyChangeSupport class. This is a utility class that can be used by beans that ...
Read More »List bean property names
With this example we are going to demonstrate how to list the names of a bean’s properties. We are using the PropertyDescriptor, a class that describes one property that a Java Bean exports via a pair of accessor methods. We are also using the Introspector class, that provides a standard way for tools to learn about the properties, events, and ...
Read More »Get/Set a bean property
This is an example of how to get and set a bean property. We are using the Statement class. A Statement object represents a primitive statement in which a single method is applied to a target and a set of arguments. In order to get and set a bean property you should: Create a simple class, like Bean class in ...
Read More »Get bytes of generated symmetric key
In this example we shall show you how to get the bytes of a generated symmetric key. To get the bytes of a generated symmetric key one should perform the following steps: Create a new KeyGenerator for the DESede algorithm. Generate a SecretKey, using generateKey() API method of KeyGenerator. Use getEncoded() API method of SecretKey, to get a byte array ...
Read More »Generate Message Authentication Code (MAC)
With this example we are going to demonstrate how to generate a Message Authentication Code (MAC). We are using the Mac class that provides the functionality of a “Message Authentication Code” (MAC) algorithm. In short, to generate a Message Authentication Code you should: Create a new KeyGenerator for the HmacMD5 algorithm. Generate a SecretKey, using generateKey() API method of KeyGenerator. ...
Read More »