|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (8 bit)
|
Java programming
Disclaimer: Im in a java programming class in college and the professor doesnt do very good at explaining things, so dont be suprised if you see me posting quite a few questions on the boards.
OK, my first question. I am making a multiplication table using nested for statements and MVC architecture, not really because it is the only way to do it, but because it is required for the class that we do it this way. Anyways, I made my multiplication table, but when I am displaying it the spaces get all messed up. Is there a tab command for java, and will it line up the numbers in vertical rows. To see what I am talking about I have attached my jar file. Thank you very much. |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
Hi,
I did some modifications to your files: 1)When you override JComponent.paintConponent(Graphics), make sure that you call the super function in the first line of the new function's body. Code:
super.paintComponent(g); 3)To make sure that the program exits after closing the frame, use: Code:
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 5)You missed String[] parameter of function main in class StartUp. Now, your program works, but it only displays headers, I didn't touch the model class, try to do it yourself, and if you have problems, just post! |
|
|
|
|
|
#3 |
|
Member (8 bit)
|
I have it all figured out now, thank you very much, I made some stupid mistakes, and finally figured out the spacing. I also figured out why you probly couldnt see anything but the header. If another window gets infront of the display frame, and your things you painted on there wern't in the paintcomponent method then it doesnt repaint them. hmmm....java....fun language.....
Thanks a lot. |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
This happens because the window needs to repaint itself after reactivating, this isn't only in Java, it happens in MFC too.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|