Skip to content
Advertisement

Tag: swing

How do I make it so that the table is displayed inside the JFrame in Main?

I am currently making a program for my school project, it is a fast food order calculator, my problem is that I have to be able to display the table inside the JFrame in Main, if I add “frame.add(table);” inside Main, nothing happens. Any help would be appreciated, thank you! } Answer Add frame.add(JScrollPane(table)); Change frame.add(label); to frame.add(label, BorderLayout.NORTH); Move

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 override paint() then the

How can I rotate multiple graphics shapes together in java without changing their position on the frame or their position relative to eachother?

I have used several java.awt.Rectangle, java.awt.Polygon, and java.awt.geom.Ellipse2D shapes together and I want to rotate them with eachother and I also want to have them keep their location on the JFrame. When I use g2D.rotate(Math.toRadians(rotation)), the shapes move on the JFrame and they are no longer close together. How can I make it so that all of the shapes keep

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 run the application

Advertisement