开发者

Can I embed an AWT Frame in a JFrame?

I need the functionality of AWT Frames for one component, but my main application window is a JFrame. Ideally this would be incorporated into my gridbaglayout.

Is there a way to do this short of tracking mouseclicks and "setLocationRealativeTo" with a window priority setting?

Update: I have added my media player into a "Canvas" to forgo the JInternalFrame or anything else, this component will be added to my main frame.

I am using a GridBagLayout, and Add all my开发者_StackOverflow buttons in the constructor of my main window, but I need to add this canvas afterward. Does anyone know how to add to a gridbaglayout post-constructor? I have tried "mainGUIclass.add(canvas,gridbagconstraints);" to no avail (since I just use "add(randomcomponent, gridbagconstraints);" in the constructor.

UPDATE: I think the root question here has changed for me, I will post a new one more to the point, thank you for all your help.


Why not just use a JInternalFrame? For more information, see How to Use Internal Frames.


If you are adding a "media player" then you add the media player component, not the frame to a Swing panel.

See: Mixing Heavyweight and Lightweight Components


You can do it, but widgets layout will be a pain in the a**.

More about it http://java.sun.com/products/jfc/tsc/articles/mixing/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜