Integrating java swing with libgdx - java

Iam making a level editor for libgdx.but I want to use the java swing buttons. how can I put the libgdx display inside a JFrame

LibGDX really isn't meant to work with swing components, but LibGDX does provide its own button classes like ImageButton or TextButton that you can use for the same purpose. It does take a little bit more work to set them up because you need to provide the background image and font that the button uses.
See the accepted answer here for how to setup text buttons:
How to create a button in Libgdx?

Related

Java JButton mouse over color

I have a Java Swing application that's using "system" look and feel (as i'm using Windows, i'm getting "native Windows" controls in my app). Now, for "branding" reasons i'm trying to enforce particular color on my buttons but i have a problem. I prefer using UIManager but i can't find any property that would let me choose "button mouse over" color.
Take a look at the picture attached please:
Seems like i'm stuck with default Windows "light-blue" color for button mouse over (pointer is not visible in this screenshot).
How can i change that color?
For me only option is some sort of UIManager global variable, i simply can't afford to go through all buttons in my app and override some custom button or add listeners for "mouse enter" and "mouse exit".
The best way to do it is to customize the LAF of your application, using this library TinyLAF.
Very easy to use, with nice control panel to help do some theming and using the created theme file on your project.
Here is a small tutorial on how to use it in case the doc is not too clear
http://yourjavacode.blogspot.com.ng/2013/05/tinylaf-change-your-java-look-and-feel.html
I hope this helped out.

Change background color Java Me

I am developing a j2me midlet application with netbeans how ever I am new to java but I have developed all things i need. But I cannot change background color or image when I run the jar file on mobile it show a transparent or white color background is there any possible way to change background color or image any answered will be appreciated.
You cannot do anything about the background when working with High Level GUI (meaning Form stuff).
If you want to control the background, you'll need to use Canvas - but Form elements can't be used on a Canvas.
Best option then is to use LWUIT. It gives you a set of elements like you have with Form, but because it uses Canvas you have much more options and such.

How to create the windows 8 FLAT native look in Java Swing programming?

I am creating a java swing application and I am badly need to get the flat GUI look like in windows 8 to my swing application. But I couldn't find it yet. Can you help me?
You can PROBABLY use the default look and feel of swing apps, undecorate everything, and for those icons; I would use buttons with internal panels, images, labels, etc. To get the scroll functionality you should use mouse listeners to detect scrolling and slide the ui accordingly.

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

List of buttons in swing

I would like to implement a list of interactive buttons using Swing. It is something similar as on the picture (from NetBeans UI designer):
You can drag and drop the items to a canvas, or single click on the item and then single click on the canvas. However, I don't know which swing components I should use. Are that JList or JButtons or something different?
There is a tutorial avalaible on how to achieve such functionality. It is utilizing the NetBeans Palette API, which makes you dependent on NetBeans as Framework, not IDE.
Depending on the goal, you might want to look into developing for the NetBeans Platform.

Categories

Resources