Author: laylaoesper
Date: 2010-09-21 18:34:01 -0700 (Tue, 21 Sep 2010)
New Revision: 21971
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
Log:
Playing with getting the png file to be the correct size.
Modified:
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
===================================================================
---
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
2010-09-22 00:36:08 UTC (rev 21970)
+++
csplugins/trunk/soc/layla/WordCloudPlugin/trunk/WordCloud/src/cytoscape/csplugins/wordcloud/SaveCloudAction.java
2010-09-22 01:34:01 UTC (rev 21971)
@@ -47,7 +47,7 @@
//VARIABLES
// Extensions for the new file
- public static String SESSION_EXT = ".jpg";
+ public static String SESSION_EXT = ".png";
//CONSTRUCTORS
@@ -77,7 +77,7 @@
// Open Dialog to ask user the file name.
try {
- name = FileUtil.getFile("Save Current Cloud as JPEG
File", FileUtil.SAVE,
+ name = FileUtil.getFile("Save Current Cloud as PNG
File", FileUtil.SAVE,
new CyFileFilter[] {
}).toString();
} catch (Exception exp) {
// this is because the selection was canceled
@@ -101,22 +101,23 @@
String cloudName =
SemanticSummaryManager.getInstance().getCurCloud().getCloudName();
//Testing
+ Dimension size = panel.getPreferredSize();
+ Dimension newSize = new Dimension(size.width + 40, size.height
+ 15);
+ panel.setPreferredSize(newSize);
- Dimension size = panel.getPreferredSize();
JFrame frame = new JFrame(cloudName);
- //frame.setSize(size);
+ frame.setSize(newSize);
frame.getContentPane().add(panel);
frame.pack();
frame.setLocation(-100, -100);
frame.setVisible(true);
- Dimension newSize = frame.getPreferredSize();
-
+ Dimension imageSize = frame.getPreferredSize();
- BufferedImage b = new
BufferedImage(newSize.width,newSize.height,BufferedImage.TYPE_INT_RGB); /*
change sizes of course */
+ BufferedImage b = new BufferedImage(imageSize.width,
imageSize.height ,BufferedImage.TYPE_INT_RGB); /* change sizes of course */
Graphics2D g = b.createGraphics();
frame.printAll(g);
- try{ImageIO.write(b,"jpg",new File(name));}catch (Exception e)
{}
+ try{ImageIO.write(b,"png",new File(name));}catch (Exception e)
{}
frame.dispose();
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.