Re: [sdljava-users] Can AWT/Swing widgets be used inside or alongside sdlsurface?
Status: Beta
Brought to you by:
ivan_ganza
From: Chris D. <Des...@nt...> - 2005-02-23 21:40:51
|
Chris Dennett wrote: > Sannie Kwakman wrote: > >> Hi everyone! >> >> I'm checking out various high-speed graphics and game libraries for >> use in a java based multiplayer game I'm developing. Sdljava seems to >> do the trick on most requirements, but there is something that I >> haven't figured out yet. At certain points in the game, there will be >> several animations and sprite-movements displayed at once, with some >> basic chat functionality right next to it. My knowledge of sdljava >> (or SDL for that matter) is still pretty limited, but my >> understanding is that I have to create a SDLSurface for the >> animations and sprite movements (using openGL or sdl_gfx). I wanted >> to use the standard AWT (or, if possible, Swing) widgets for the >> chatinterface, which is nothing more than a TextField and scrollable >> TextArea. In my tests I haven't been able to combine a SDL_surface >> and AWT/Swing widgets in one window. My approaches so far have been >> pretty awt-centric (trying to add a SDLSurface to a >> Container/Frame/JFrame and trying to get a AWT/Swing widget to draw >> on a SDLSurface) none of which were succesfull. And because a >> SDLSurface creates its own window, drawing/adding AWT widgets next to >> the SDLSurface don't seem to be possible either. >> >> Is combining AWT/Swing with SDL graphics actually possible (and if >> so, how) or are there other methods for creating a chat interface >> within a surface? >> >> Thanks in advance! >> >> -- Sannie Kwakman > > > This seems to be quite a good idea, but you can't do it using the > approach you are taking. > > Have a look at this: http://java.sun.com/j2se/1.3/docs/api/java/awt/Graphics.html. If you want AWT stuff in an SDLJava SDL window, you will need to extend this class and implement all the abstract methods. You then have to shove this into somewhere to register it as the default graphics thingy, but it dosen't tell you how to do this anywhere. -- |>>> Dessimat0r /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ____--`~--- '--~~__ __ ----~ - ~`---, -~--~ ~---__ ,--~' ~~----___ |