Skip to content

Tag: swing

JFrame Image Update on click of image

tldr; How do you use a MouseEvent on a JFrame object(specifically JLabel) to update the displayed image in the JFrame I am trying to create a program where an image is broken into tiles and on click of one of those tiles, the program moves the tile to the open space in the image. (See Sliding Puzzle for more …

Display all the items I have ordered

How to display all the items I have ordered in “Sales Report File”? Like whenever I ordered 2 cookies, It will display on the Sale Report file. I have this code currently.. Answer If you want like a text list of what you have ordered, you can simply create an ArrayList<String> and every time…

how to make more buttons in java GUI swing

I would like to use the java swing to make two buttons, one that add +25 to 100, the initial value, and one other that adds +10 to 100, always the initial value: as you can see it should create two buttons, this is what I receive as output at first: and after I click it, it just adds 25

Java move GUI panel While loop

I have a panel. I want to move the panel, inside a while loop, to the left and then to the right, after pressing a button and until a certain condition is met. But for this question let’s say continuously. After it finishes an iteration, it doesn’t move left or right. I used repaint() and Thread.s…