Skip to content

Tag: swing

JFrame ending in some time

Whenever I run my code it ends in a few seconds. Why? This is the Main file: This is the GameWin file: When I try to run this code it shows running and then the code ends with exit code 1 which is good, but it just ends without showing the window. Is there something wrong with my JRE or

2D grid is not fitting in JFrame for pathing visualizer

I am trying to create a 2D grid with node sizes depending on the size of the height/width of the frame but whenever I run the program, the bottom row and right columns are somewhat cut off. Here is my execution code: Here is the Grid class: And here is the GridFrame class: I have also been messing around with

Buttons not visible until mouseover

I created a frame and panel (for Graphics) and add buttons to the panel. However, when I run my program buttons are not visible until I hover over them. Maybe it is something wrong with graphics methods. How the problem can be solved? Answer Your painting code is mostly wrong. For example: If you need to over…

JFrame.addMouseListener doesn’t register clicks

I am currently writing an application in java that needs to take in input from the user. I have tried many ways to implement the input but none of them work. I am rendering objects with the graphics interface if that helps. I have tried a couple of methods to implement mouse interaction: And However when I ru…