I have a blackjack game, and the GUI is created using swing. One of my buttons looks completely normal, and the other one has a weird border around the text. Both buttons were made using Intellij IDEA's built-in GUI form, and I copied the normal looking one to make the weird looking one.
Here's what the button looks like (compared to the normal one).
Can't embed images lol
Related
I am working on ribbons using Java Swing technology. I am not using the already made framework called Flamingo (it's not giving the style I want), rather I am implementing it via the netbeans swing drag and drop. I want to make the panels collapse into drop down when the window is resized.
Like if we resized the window to be very small, we will have 3 dropdowns: File, Preferences and Help. Each drop down gives the elements in each section.
Any ideas how to achieve this?
A while ago I wrote an application in Java using Swing for the GUI development. As I want to learn more about JavaFX I'm trying to convert it but I get stuck on one piece of my application I can't seem to find the right equivalent for in JavaFX. In Swing I was able to make a JPanel, create an image, and then rescale the image based on the size of the JPanel using the component events on the panel. Then I'd draw stuff on the image and draw that on the graphics of the JPanel. Also I'd use mouse events on the JPanel to implement zooming and panning on the underlying image.
I'm not sure whether this was good practise in the first place, but it enabled me to draw anything, from pixels to lines to circles to images, on the JPanel, essentially creating sort of a rendered viewport for my application.
What would be the best way to go about this in JavaFX? I've looked at tons of tutorials and youtube videos, but they all seem to focus just on normal GUI controls like buttons, and when I look at game dev for example they make a lot of use of standard JavaFX Nodes to quickly generate moving entities in their scene. I just need sort of a canvas to render stuff on as I please, but if I add something like a default Canvas or Region in the Scene Builder for my FXML file I don't know how to start drawing on that. I'm completely lost in the jungle of tutorials and documentation on the internet.
Does anyone know of any good resource for this kind of application cause I just don't know where to start.
I'm writing a program that currently switches back and forth between different JPanels placed on a JFrame that also has a JMenuBar. (We're required to use Swing.)
I need to write a tutorial and right now I have it giving step-by-step instructions from a popup window. However, it doesn't seem to resonate well with test users and quite frankly it's annoying to switch back and forth between screens.
After checking out JDesktopPane and JInternalFrame it seems to make sense to place my entire program in a desktop pane and then create the tutorial using an internal frame. I'm worried that this will force me to place my different screens each in an internal frame which is NOT what I want to do. I just want the tutorial to be an internal popup(?) that can be minimized and moved around if necessary.
Am I going about this the correct way or is there a more efficient/practical way to implement the same tutorial popup feature?
I'm not 100% clear on your problem -- is it that your tutorial keeps popping up new windows for each step? I would assume that you wish both the main program and the tutorial to both be in view while the tutorial is running, and if this is so, perhaps the tutorial should reside in a non-modal JDialog, and then you swap tutorial screens via a CardLayout. ... unless I'm mis-reading your requirements and problem.
What I have is an Application that uses swing components (jpanel, jbutton, jlabel, etc), however I have to use an old PDF viewer (upgrade is not an option) that is based on java.awt.Applet (com.adobe.acrobat.Viewer). The problem comes when I am trying to display it, it draws properly however since this PDF viewer is inside a JScrollPane, it draws over all of the swing components (over the scroll bars and the menu).
Does anyone know how to make the PDF viewer act nicely and not to draw over other components.
Any suggestions are appriciated
You might look at Mixing heavy and light components, which describes some new support for this. I understand "upgrade is not an option", but the discussion may yield some insight.
I have designed this gui in netBeans which has a canvas , a couple of JtextAreas and a Jbutton. It looks great in preview, the problem is when I run the actual program the text areas are shurnk until the program prints something in them, then they expand to their full size, the Jbutton is invisible until I mouse over it then it stays visible, there is also a Jlabel which just doesnt show up in the program at all only in preview. I have designed one more program in netbeans before but did not have these problems. Any idea what I could be doing wrong?
No idea whats wrong, but you should NOT be using a Canvas. That is an AWT component and you should not be using AWT components in a Swing application.
Actually the Canvas could be the problem. AWT components are painted on top of Swing components which could be causing the problem. That might be why the mouse over forces the button to show through the Canvas. I've never mixed AWT/SWING components so I don't know what wierd painting artifacts you will encounter.