Java Reference
In-Depth Information
L ISTING 10.5 The DrawEditor Class
package com.marinilli.b2.c10;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* Chapter 10 - Drawing extension
* @author Mauro Marinilli
* @version 1.0
*/
public class DrawEditor extends JDialog {
JPanel jPanel1 = new JPanel();
JButton closeButton = new JButton();
public DrawEditor(JFrame jf) {
super(jf);
setTitle(“Drawing Editor Plug-in”);
closeButton.setText(“close”);
closeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
this.getContentPane().setBackground(Color.white);
this.getContentPane().add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(closeButton, null);
setSize(200,220);
setVisible(true);
}
}
All the noteworthy work is done by the JNLP file (at line 13 of Listing 10.3), where the draw-
module JAR file is declared lazy . To try out the application, launch the JNLP file and then
open up the JNLP Client cache for inspecting where cached JAR files regarding the
LazyEditor application are created. Once you have found them, just push the “draw” button,
and magically the draw-module.jar file will appear in the cache. Be sure to clear up the cache
before you perform this experiment.
10
In Figures 10.1 and 10.2, you can see what appears before and after the activation of the
“draw” button.
Search WWH ::




Custom Search