You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by vh...@apache.org on 2001/12/13 18:56:02 UTC
cvs commit: xml-batik/sources/org/apache/batik/apps/svgbrowser JSVGViewerFrame.java
vhardy 01/12/13 09:56:02
Modified: sources/org/apache/batik/apps/svgbrowser
JSVGViewerFrame.java
Log:
Added hacky work around size problem on very, very large (in terms of width/height)
documents.
Revision Changes Path
1.67 +23 -2 xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java
Index: JSVGViewerFrame.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JSVGViewerFrame.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- JSVGViewerFrame.java 2001/11/29 09:17:41 1.66
+++ JSVGViewerFrame.java 2001/12/13 17:56:02 1.67
@@ -15,6 +15,7 @@
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ComponentAdapter;
@@ -154,7 +155,7 @@
* This class represents a SVG viewer swing frame.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: JSVGViewerFrame.java,v 1.66 2001/11/29 09:17:41 tkormann Exp $
+ * @version $Id: JSVGViewerFrame.java,v 1.67 2001/12/13 17:56:02 vhardy Exp $
*/
public class JSVGViewerFrame
extends JFrame
@@ -366,7 +367,27 @@
}
});
- svgCanvas = new JSVGCanvas(userAgent, true, true);
+ //
+ // Set the frame's maximum size so that content
+ // bigger than the screen does not cause the creation
+ // of unnecessary large images.
+ //
+ svgCanvas = new JSVGCanvas(userAgent, true, true){
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+
+ {
+ setMaximumSize(screenSize);
+ }
+
+ public Dimension getPreferredSize(){
+ Dimension s = super.getPreferredSize();
+ if (s.width > screenSize.width) s.width =screenSize.width;
+ if (s.height > screenSize.height) s.height = screenSize.height;
+ return s;
+ }
+
+ };
+
svgCanvas.setDoubleBufferedRendering(true);
listeners.put(ABOUT_ACTION, new AboutAction());
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org