Libgdx with Java Swing issue - java

I have a problem with libgdx. I want to use Screen from libgdx to draw game inside JPanel (from Swing, because my all app is written in Swing). I've tried, but I cannot do that.
Is it possible? Have you got any code examples?
Please for help and sorry for my english (just in case).

Here is a good solution:
https://stackoverflow.com/a/21258666
It uses LWJGLCanvas to embed libGDx inside a JPanel

Related

How to create java window without a GUI

I have been given an assignment for uni to make a chess game without using a GUI(swing or Java FX)
I have made the game using the AWT Canvas Class. However, I cannot figure out how to actually make a java window or frame for the game to run in without using a GUI?
Thank you. Any help would be appreciated.

How to take a screenshot in Java without AWT / Robot (entire screen)

I've seen the usual way of taking a screenshot in Java where you use a Robot and a BufferedImage to take a screenshot. But is there a way of doing this without using Robot and BufferedImage?
Why?
I am working with JavaFX and I don't like mixing up AWT (Swing) and JavaFX.
Not a big problem, I know, but I would love to keep everything within one library.
I've also heard that Robot is a bit slow, but that's not the main reason.
EDIT: I would like to capture the whole screen and not just an area like a scene.
Thanks in advance :D

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.

Change Look and Feel of JFrame?

How would I go about changing the Look and Feel of a JFrame and Swing components to custom pictures and what not? Is there a set of methods and API's or do I need to just make a custom JFrame that allows me to customize my JFrame further?
I'm trying to get something that looks like the World of Warcraft launcher or League of Legends launcher( best examples i've seen with custom everything xD). I'm pretty new to GUIs.
Not exactly an answer to the question, but since you're just staring with Java GUI, I'd recommend diving right into JavaFX -- a modern Java UI toolkit.
Please be sure to start with JavaFX 2.x -- not JavaFX 1.x, which is basically deprecated.

understanding how to create shapes

Hi I am trying to create simple shapes such as a rectangle and view it in the android emulator , I do not want to use android xml but java code as I will need to apply an accelerometer to it. I am using eclipse but I do not understand how I can use JPanel as eclipse doesn't recognise it, do I have to install a plugin to be able to import JPanel and is that the correct way to go about creating shapes for android?
Any help would be helpful thank you.
Using java and android in eclipse.
JPanel is a swing component and not part of the Android SDK. You need to extend a view and draw using a canvas by overriding onDraw() or look into OpenGL if you want go into 3D drawing

Categories

Resources