Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Canvas inside JSplitPane

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 04-11-2009
Member
 
Join Date: Nov 2009
Posts: 47
Canvas inside JSplitPane
  

I have a problem of interoperability between JAVA components of AWT and Swing: I included an JSplitPane (which splits vertically) in a JFrame and I put inside a AWT Canvas and a JTextArea, the first above and below the second. The problem is that the Canvas is refusing to shrink: the user is unable to raise the splitter but only to lower it. I can zoom around the JFrame as this would cause a shrinkage of the Canvas. Of course if I post a JPanel instead of Canvas everything worked properly. Does anyone know another way to correct this?

One more thing: under construction of GUI Canvas.setPreferredSize, I have called for making one's calling pack () performed on the final JFrame bring me to the Canvas to a minimum. In other words I wish that when the application is the Canvas had a certain size, but also that the user is able to raise the splitter and to shrink the JFrame.

Reply With Quote
  #2  
Old 04-11-2009
Member
 
Join Date: Nov 2008
Posts: 996
Re: Canvas inside JSplitPane

Look, if I remember correctly was discouraged by the sun itself using AWT and Swing components together. And among other things by now you should only use swing. Why did you need this?
Reply With Quote
  #3  
Old 04-11-2009
Member
 
Join Date: Nov 2009
Posts: 47
Re: Canvas inside JSplitPane

Because in reality it is not exactly a canvas but a GLCanvas of JOGL (which inherits Canvas). I know that there is also GLJPanel JOGL, but instead is discouraged by the team of JOGL because it is less helpful

So if I can make my GUI with GLCanvas. This should be the last problem left: in addition to this I had only problem with the fact that the Canvas is heavyweight and hide the menu.
Reply With Quote
  #4  
Old 04-11-2009
Member
 
Join Date: Nov 2008
Posts: 1,022
Re: Canvas inside JSplitPane

Quote:
but instead is discouraged by the team of JOGL because it is less helpful
Are you sure it is still not recommended?

I ask because years ago to build a viewer for 3D models for CAM software we had the same necessity for performance reasons.

Then later, when the JOGL have become "more mature" in parallel to improvements on Swing side, we could upgrade to JPanel with no loss of performance (of course then it depends on what you have to render).

So if I were you then I would have first tried with GLJPanel, and then only after having seen the actual loss of performance (and has verified with a profile which is the actual bottleneck, another lesson learned on my skin) as surely attributable to the GLJPanel replacing it with GLCanvas.

In the latter case, you must devise some strategy to integrate it into IU minimizing interoperability problems that occur when you mix AWT components with Swing components.
Reply With Quote
  #5  
Old 04-11-2009
Member
 
Join Date: Nov 2009
Posts: 47
Re: Canvas inside JSplitPane

After reading the various guides, I see that now the situation has improved, but the performances are still comparable. The reason is that JPanel (which inherits GLJPanel) is a lightweight component and as such has a native window (typically in the native environment to do rendering with OpenGL is a window dedicated to native on which we can do just that and we can not render nothing else), and if we add a JPanel that should also optionally be made partially transparent, the most reasonable solution for the JOGL team was that when drawing on a GLJPanel no designs on screen but will grab the contents of frame buffer with glReadPixels or similar and that content is then rendered on GLJPanel with any semi-transparent. This solution perfectly reasonable, is inherently less performing the operation of a Canvas, as it can optimize.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Canvas inside JSplitPane"
Thread Thread Starter Forum Replies Last Post
Canvas HD A116 vs Canvas 2 A110 vs Infinity A80 Rajminder Polls & Voting 4 29-03-2013 02:05 PM
How to maximize button in Canvas? Yogisa Windows Software 6 27-07-2011 12:52 PM
How to add image inside the canvas using SilverLight Hunter-Man Windows Software 3 17-04-2011 07:51 PM
How to use <canvas> tag in HTML5 Aia Zav Software Development 7 26-02-2011 01:52 PM
JSplitPane class of java Owen Fernandes Software Development 5 15-02-2010 08:44 AM


All times are GMT +5.5. The time now is 03:31 PM.