for (final StringValuePair<InputStream> pair : pairs) {
final String name = pair.getKey();
InputStream svgStream = pair.getValue();
Dimension svgDim = new Dimension(currDimension,
currDimension);
final SvgBatikResizableIcon svgIcon = name.endsWith(".svg") ? SvgBatikResizableIcon
.getSvgIcon(svgStream, svgDim)
: SvgBatikResizableIcon.getSvgzIcon(svgStream,
svgDim);
JCommandButton svgButton = newButtons.get(name);
svgButton.setIcon(svgIcon);
RichTooltip richTooltip = new RichTooltip("Transcode",
"Click to generate Java2D class");
svgButton.setActionRichTooltip(richTooltip);
svgButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
System.out.println(name);
String svgClassName = name.substring(0, name
.lastIndexOf('.'));
svgClassName = svgClassName.replace('-', '_');
svgClassName = svgClassName.replace(' ', '_');
String javaClassFilename = System
.getProperty("java.io.tmpdir")
+ File.separator
+ svgClassName
+ ".java";
PrintWriter pw = new PrintWriter(
javaClassFilename);
SvgStreamTranscoder transcoder = new SvgStreamTranscoder(
new ByteArrayInputStream(svgIcon
.getSvgBytes()), svgClassName);
transcoder.setPrintWriter(pw);
transcoder.transcode();
JOptionPane