| Author |
TabbedPanes
|
Delmar Howard
Greenhorn
Joined: Apr 23, 2002
Posts: 4
|
|
Im trying to create a tabbed pane with images, like the one seen here http://www.enode.com/xalt/markup/tutorial/tabbedPane.html I can do several tabbed panes but only with text, when i try to do graphics it goes nuts. The closest Ive came was all of the graphics being the same on every tab. Any ideas?
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
Delmar, Welcome to JavaRanch! Are you doing everything more or less the same as recommended in Sun's Tutorial on How To Use Tabbed Panes?
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Delmar Howard
Greenhorn
Joined: Apr 23, 2002
Posts: 4
|
|
Yes, thats the problem though. I used it and it works fine with text. It does not address inserting graphics in the place of the text. When it creats the panel, it's called Componant Text or something similar, I haven't seen any other Componant graphic or icon type of entry. However, I am finished the program now, BUT I need a little help in converting it to an applet. More help on this would be appreciated! Heres the program on my website that I wanna turn to an applet. www.kalami.com/Flag.java Im still reading on how to do it at various places, but it's not working too well for my particular program, could be the Jpanel or something. kalami
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
Regarding the applet conversion, this seems to work: and the code for the html file could be: Good Luck. [ April 24, 2002: Message edited by: Dirk Schreckmann ]
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
|
Regarding the use of graphics, your code seems to work perfectly fine for me with graphics - it doesn't "go nuts". What exactly does "go nuts" mean?
|
 |
Delmar Howard
Greenhorn
Joined: Apr 23, 2002
Posts: 4
|
|
Wow, thanks for the help! I have everything setup and everything compiled, but when I try to run the actual applet in a browser window I get an error. Heres the link www.kalami.com/flag.html I get trauncated class file error. This is moving into the unknown for me, ive never done an applet b4. kalami [ April 24, 2002: Message edited by: Dirk Schreckmann ]
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
|
I'm getting java.security.AccessControlException and it looks like it's trying to access an image file on my hard drive - not allowed.
|
 |
Delmar Howard
Greenhorn
Joined: Apr 23, 2002
Posts: 4
|
|
|
So looks like I need a way to tell the applet to load the images from the web server right? Does that mean ill have to redo my program to implement that stuff?
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
The solution is probably to use either JApplet::getDocumentBase() or JApplet::getCodeBase() as the first argument when constructing your ImageIcon objects and the second argument would be the String file description (name). So, use: Icon image = new ImageIcon(getCodeBase(), "image.gif"); Good Luck.
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
|
Regarding learning about Applets, you might want to peruse Sun's Tutorial on Writing Applets.
|
 |
 |
|
|
subject: TabbedPanes
|
|
|