Re: MathCanvas JInternalFrame
- To: mathgroup at smc.vnet.net
- Subject: [mg36260] Re: [mg36249] MathCanvas JInternalFrame
- From: Werner Schuster <werner at sbox.tugraz.at>
- Date: Thu, 29 Aug 2002 01:37:42 -0400 (EDT)
- References: <200208280816.EAA18605@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Gary Stump wrote: > I am writing a Java application that displays Mathematica output using > MathCanvas. I am having difficulty in that the internal frames > (JInternalFrame)in my application are covered by the MathCanvas when > the internal frames are moved into the MathCanvas area. I tried > setting the frame's layer to 0, but that didn't work. Can anyone help > me out? I suppose the problem is, that MathCanvas is an AWT Component, which causes problem with the other Swing JComponents; 2 possible solutions: - get J/Link 2.0, which comes with a Swing version of MathCanvas (MathGraphicsJPanel if memory serves); - if you can't do that, write a Swing replacement for MathCanvas using Swing; this is pretty simple: you can use the evaluateToImage methods, which return a byte array containg a GIF Image; if you want to make it very simple, you just make your control a JPanel that contains a JLabel, and when you want to set a M_-GraphicsExpression (from a Plot,...) you just set the GIF Image as the JLabels Icon; something like this (jlPlot being the JLabel): KernelLink kl = StdLink.getLink(); StdLink.requestTransaction();^M byte [] bGifData = kl.evaluateToImage(sExpression, width,height); if (bGifData == null || bGifData.length <= 1){ System.out.println("bGifData empty"); } Image iPlot = Toolkit.getDefaultToolkit().createImage(bGifData); iiPlot.setImage(iPlot); jlPlot.setIcon(iiPlot); jlPlot.repaint(); murphee
- References:
- MathCanvas JInternalFrame
- From: gms158@psu.edu (Gary Stump)
- MathCanvas JInternalFrame