|
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Clipboard;
import javax.swing.*;
import java.util.List;
import areas.*;
public HTMLdialog (Frame owner, List <Area > areas ){
super(owner, "HTML code for image map", true);
setSize(640, 480);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
textArea.setEditable(false);
String s = "<img src='path/to/image.ext' usemap='#imgmap'>\n<map name='imgmap'>\n";
s += " " + a.getHTML() + "\n";
}
s += "</map>";
textArea.setText(s);
p.add(copy);
p.add(close);
copy.addActionListener(this);
close.addActionListener(this);
}
if(e.getSource() == copy){
c.setContents(s, s);
JOptionPane. showMessageDialog(this, "Code copied to clipboard.");
}else if(e.getSource() == close){
}
}
}
|
|