This is my first time posting so I apologize if the question is too vague or I do not describe my problem so well. I am working on a Java JFrame project and have run into a small issue. I need to instantiate arrays of various frame elements. What I have done as of now works, however, it is very
Tag: jframe
Recover data after closing a Jar file
I am working with a jar file that deals with a program where I open a window (using JFrame). In this window, I manipulate some data and store some of it in the private fields of a class. When I close my windows and reopen my jar file, all my data is lost. How can I save my data so
How do I change the background color of a JFrame dynamically?
I was wondering how would I change this block of code to be able to have a dynamically changing background colour that switches from (red -> black -> green -> black -> blue -> black ->red) and the loop starts again. The background colour should be continuously changing per tick. Right now I have a render method that will continuously
I have a problem whith adding a Container in a JFrame
I am a student in informatics and beginning in Java, I want to create a project which will allow me to make a calculator. I am encountering a problem which is the following: I want to add Container in my JFrame with add(contenu), but it gives me the following warning : I don’t understand why this problem appears. Here are
Highest performance for Keyboard Input
So I have a small java game engine using a single JFrame. I am currently using Key-Bindings as they were working neatly but I figured that a KeyListener might be architecturally more fitting. But since I honestly don’t really care which I’ll use I wanted to ask if there is a performance difference between these or even a better option
In Java how do you pass variables and lists between jframe components
I have created a simple program with a list object. I also have a simple UI and want to add the values from the different parts of the list to the text frames and labels but cannot find how to pass the values that are needed. The list object has been created in the main class of the UI (which
How to use a thread to run another JFrame while the main is still running
I have a jframe i want to display while my main frame is running. i want to pause my main code, until the user does the necessary actions on the other frame. I’ve read a lot of solutions but i need to see it done for my code to understand and grasp it fully. i do not want to use
How to add a JPanel graphic to a JFrame without covering the JFrame
I’m trying to add a small tornado graphic (upside down pyramid) to my Frame. I can get the tornado by adding it to the frame in the main method but when I do that all I see is the tornado graphic and not the GUI underneath it. So, I’m now trying to add the Tornado graphic to the frame when
How do I stop JFrame/JPanel from auto-formatting the distances between my components?
So I’m writing a program which utilizes a GUI. The GUI is built from a JFrame and a JPanel in Java. I have a JTextArea() and a JButton() that appears beside the JTextArea on the left. I also have an image which I imported locally using the method call below (“f” is the variable name of my JFrame): I don’t
Java – How do I get an image to display?
I have spent a really long time trying to find a way to display an image in a Java program (I’m trying to learn how to make a 2D Java game) an nothing that I’ve tried works. I’m using Eclipse Mars and the latest of everything else. Here is my code: Please, just tell me how to correct the code