Hi Sudhakar,
This is really a Swing problem and doesn't appear to have anything
in particular to do with squiggle. I've messed around with fullscreen
things in the past and had similar issues. Mostly I just futzed until
it worked right.
Sudhakar S <[EMAIL PROTECTED]> wrote on 09/11/2006 11:37:19 AM:
> While full screen window is opened in Solaris operating system, It shows
> full screen window along with its parent window. Parent window (new
> JWindow(ExFrame.this)) that used to create JWindow is always focused. So
it
> always shows 2 windows.
>
> This is not happening in windows. So can anyone please tell how to
resolve
> the problem or please provide the work around to resolve the problem.
>
> Herewith I have attached my sample program. This would be helpful to
> reproduce the problem.
>
> import javax.swing.JFrame;
> import java.awt.BorderLayout;
> import javax.swing.JPanel;
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.JButton;
> import javax.swing.JWindow;
> import org.apache.batik.swing.JSVGCanvas;
> import org.w3c.dom.svg.SVGDocument;
> import org.w3c.dom.DOMImplementation;
> import org.apache.batik.dom.svg.SVGDOMImplementation;
> import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
> import org.w3c.dom.events.EventTarget;
> import org.w3c.dom.svg.SVGSVGElement;
> import org.w3c.dom.events.EventListener;
> import org.w3c.dom.events.Event;
> import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
> import org.w3c.dom.DOMException;
> import org.w3c.dom.Element;
> import javax.swing.JComponent;
> import javax.swing.KeyStroke;
> import javax.swing.AbstractAction;
>
> class ExFrame extends JFrame{
>
> static String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
>
> JPanel jPanel1 = new JPanel();
> JButton jButton1 = new JButton();
> JSVGCanvas svgCanvas = new JSVGCanvas();
> protected JWindow window;
> public final static String FULL_SCREEN_ACTION = "FullScreenAction";
>
> public ExFrame() {
> try {
> jbInit();
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
> public static void main(String args[]) {
> ExFrame frame = new ExFrame();
> frame.pack();
> frame.setVisible(true);
> }
> private void jbInit() throws Exception {
> this.getContentPane().setLayout(new BorderLayout());
> jPanel1.add(jButton1);
> svgCanvas.setPreferredSize(new Dimension(600, 600));
> svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
> DOMImplementation impl =
> SVGDOMImplementation.getDOMImplementation();
> SVGDocument doc = (SVGDocument)impl.createDocument(svgNS, "svg",
> null);
> svgCanvas.setDocument(doc);
> javax.swing.ActionMap map = svgCanvas.getActionMap();
> map.put(FULL_SCREEN_ACTION, new FullScreenAction());
> javax.swing.InputMap imap =
> svgCanvas.getInputMap(JComponent.WHEN_FOCUSED);
> KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0);
> imap.put(key, FULL_SCREEN_ACTION);
>
> registerListeners();
>
> this.getContentPane().add(svgCanvas,
java.awt.BorderLayout.CENTER);
> this.getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
> jButton1.setText("Button");
> }
>
>
> public void registerListeners() {
> svgCanvas.addGVTTreeRendererListener(new
GVTTreeRendererAdapter() {
> public void gvtRenderingPrepare(GVTTreeRendererEvent e) {
> }
> public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
> resizeCircle();
> }
> });
> SVGDocument doc = svgCanvas.getSVGDocument();
> SVGSVGElement svgRoot = doc.getRootElement();
> EventTarget t = (EventTarget)svgRoot;
> t.addEventListener("SVGLoad", new OnLoadAction(), false);
> }
>
> public class OnLoadAction implements EventListener {
> public void handleEvent(Event evt) {
> }
> }
>
> private void resizeCircle() throws DOMException {
> try {
> SVGDocument doc = svgCanvas.getSVGDocument();
> Element rect =
> doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "rect");
> rect.setAttributeNS(null, "id", "rec");
> rect.setAttributeNS(null, "x", "250");
> rect.setAttributeNS(null, "y", "250");
> rect.setAttributeNS(null, "width", "75");
> rect.setAttributeNS(null, "height", "75");
> rect.setAttributeNS(null, "style", "fill:red;
stroke:green");
> doc.getRootElement().appendChild(rect);
> } catch (Exception e) {}
> }
>
> public class FullScreenAction extends AbstractAction {
> public FullScreenAction() {}
> public void actionPerformed(ActionEvent e) {
> if (window == null || !window.isVisible()) {
> if (window == null) {
> window = new JWindow(ExFrame.this);
> Dimension size =
> Toolkit.getDefaultToolkit().getScreenSize();
> window.setSize(size);
> }
> // Go to full screen in JWindow)
> ExFrame.this.remove(svgCanvas);
> window.getContentPane().add(svgCanvas);
> window.setVisible(true);
> window.toFront();
> svgCanvas.requestFocus();
> } else {
> // Go back to JSVGViewerFrame display
> ExFrame.this.remove(svgCanvas);
> ExFrame.this.add(svgCanvas, BorderLayout.CENTER);
> window.setVisible(false);
> }
> }
> }
> }
>
> Thanks,
> Sudhakar
>
> --
> View this message in context:
http://www.nabble.com/Problem-with-SVG-Browser-
> full-screen-window-in-solaris-tf2253140.html#a6249200
> Sent from the Batik - Users forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]