![]() ![]() ![]() Main Problem 2): As far as I understand, i need layout manager. I found a topic, How to add multiple components to a JFrame?, and tried the tips the most voted post gave, by jjnguy Nov 15 '10 at 17:02.įor some odd reason, not the first, nor the second tip worked for me. Main Problem 1): The program runs, and shows the JFrame, but on the JFrame it shows only the last added object/component- Box. (in this case, just simple x++ or y++ depends on which box, box1 or box2). Next, starts a loop while(true), and updates the box's position every 200 milisec by making the thread sleep that amount. In the Screen class, after I created the two Boxes, i. I inherit from JPanel the method Paint() and override it, painting boxes. Check please this image/diagram of the classes(hope I wrote it the right way): ClassesDiagram I got class Screen, which has the screen stuff- Declaration of the JFrame, setting up its configuration(size, close operation, etc) and then creating the objects of class Box, to be showed on the frame. For this I need this (not)simple animation get working. ![]() Seems I miss/don't understand enough how Java's graphics works. Problem with displaying Animation on JFrame. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |