Swing in JmonkeyEngine (JME) - java

Is it possible to add Swing components in JME3 canvas? If it is possible please share the logic.
I was able to achieve the other way round where I was able to integrate JME3 canvas in Swing.

No, you can't add Swing components to the JME3 canvas.

Related

Canvas on JFrame in java

I've seen in many threads it's not recommended to mix awt and swing components. However I've seen examples in which they add the Canvas to a JFrame (No other swing components are involved). Canvas is an awt component and JFrame is a swing component, so is it ok to do so? and if not, how exactly to use the Canvas?
You could get some unusual display problems with older JDKs, but mixing swing and AWT is fine nowadays. See this article: http://www.oracle.com/technetwork/articles/java/mixing-components-433992.html
I've written a game which used swing components for most of the UI/controls but a canvas for drawing the main game area (see https://github.com/qwerky/Towers/blob/master/src/main/java/lineup/ui/UI.java). It worked fine with no problems.

What problems might arise when adding JComponents to a component

I am making some changes to an existing application whoose screens have been implemented by using awt components. Using swing in the new elements will make life easier but i know that there are some problems of mixing swing and awt components.
What i would like to know is:
Prior to java 6 what problems might arise when someone adds swing components to an awt container?
(My appliation has custom mdi which every window is an awt panel. What I would realy like to do is use the same awt panel as my window and implement everything inside of it with swing using java 1.5)
In some forums people says that after java6u? some of the problems of mixing awt and swing components how been fixed. is there any problem still exists that you know of ?
See Mixing Heavyweight and Lightweight Components for answers to both your questions.
Here is an example of the problem.

Regarding swing containers

I was doing a research, I have the below application in that we have the following swing layout..
Now the thing is that this same ting I want to develop I was using swing designer of google framework ..
Please advise me what container layout and extras other things do I need t build this same forat through swing designer and I aslo later want to customize it.
As I understand, your problem is resizing two buttons equally? Well, I'd use Mig Layout, create two columns, that will scale 50% each.

Java swing gui and lwjgl

A simple question: Is it possible to view gui of java Swing library and lwjgl 3D scene in the same window without using any additional gui libraries? How?
You can use the method Display.setParent(java.awt.Canvas) to put the LWJGL display on a canvas. You can then incorporate this canvas into your Swing GUI. Please note that there may be slight performance issues with said approach.

Implementing drag and drop into a image viewer

Im an intermediate programmer making my own little image viewer. Currently I'm looking into implementing a Drag-and-Drop feature. Ive done some research and have seen that you need to use image icon b/c it is serializable, the code seems pretty complicated. The DnD would be on images dragged to the panel. I have a few questions.
what swing component would work best to hold the image?
what would be the easiest way to implement this feature?
what swing component would work best to hold the image?
Why not a JLabel?
Implementing drag-and-drop functionality is not that hard
Start by reading the Swing tutorial
Create your own TransferHandler as explained here
Set your TransferHandler on your Swing component
Check out which DataFlavor is used when dragging your image data (see also the tutorial) and make sure your handler accepts it
Test it

Categories

Resources