This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Canvas object not appearing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Canvas object not appearing" Watch "Canvas object not appearing" New topic

Canvas object not appearing

Liz Costelloe

Joined: Nov 01, 2003
Posts: 17

I have an applet, inside which there is a tabbed pane. In the first pane there is a panel, the panel uses GridLayout (1 column, 2 rows). In the top half of this panel is some text areas and a button. In the bottom half I have added a canvas, however the canvas does not appear. Everything else in the applet does appear fine.

Code is listed here, I'd be grateful if anyone has any suggestions as to why the canvas might not be appearing.

Many thanks in advance.

[ April 10, 2006: Message edited by: Liz Costelloe ]

[ April 10, 2006: Message edited by: Liz Costelloe ]
[ April 10, 2006: Message edited by: Liz Costelloe ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632

could be the reason, but I cannot run your code to test.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
This runs okay now. You might change the class names to prevent name-clashing when you compile/run it.
Liz Costelloe

Joined: Nov 01, 2003
Posts: 17
Hi Craig,

Thanks for taking the time to implement that solution, I'm really grateful. It works perfectly, I can't thank you enough.

I tried using your solution without the JFrame so I could embed my applet in the JSP that I'm using, but the Canvas doesn't seem to appear if I do that. Using the JFrame the applet pops out of the page and the canvas appears. I'll figure out if I can embed the applet in the page at a later stage; it's only for asthetics that I want to do this really. The functionality is there now and that is without a doubt my primary concern.

Also I took out the 4th line of class LPTest because the applets security won't let me do this:

Anyway thank you again, I was beginning to get very frustrated, I really appreciate that you took time out to look through this for me.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Canvas object not appearing
It's not a secret anymore!