www.williamgibsonboard.com
www.williamgibsonboard.com
Random Thoughts
Basic computer assistance required, please.|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Member |
|
|||
|
Member![]() ![]() |
So, I'm finding myself doing a lot of Java coding. Now, I took classes for Java about a year ago, when Java 5 (1.5) was out. Now they have Java 6 (1.6). I'm having a lot of trouble getting code from the books I have to build properly. These books naturally center around using the 1.5 code tricks.
I guess I'm asking if anyone can help figure out why the old code doesn't work. Shouldn't it be backwards compatible? *************************************************** * MEB_Registered: 20122002 |
|||
|
Member![]() |
It should be compatible.
Post some bits of code here, and I'll tell you more. _____________________________ Albert's path is a strange and difficult one. |
|||
|
|
Member |
Ack, it's Java! Run to the hills!
|
|||
|
Member![]() |
Java is goodly.
Java is at the heart of anything that's pure and beautiful. Java brings food to the starving, and coffee to the sleepy. _____________________________ Albert's path is a strange and difficult one. |
|||
|
Member![]() |
It should all be backwards compatible. Are you importing not standard packages that aren't in your classpath or something?
|
|||
|
|
Member |
What exactly do you mean by that? Does it compile OK? Examples, please. |
|||
|
Member![]() ![]() |
for example, here is one of the books. You can click on Downloads and get the zip file with all the code for the book. The first chapter is building a window Aquarium with little fish image files that bounce around. When I create a project with the files (one source and 3 .gifs) straight from the site, which are just about exactly what you'd end up typing while following along with the book, my window shows up and the thing runs but all you see is the title bar, no frame or fish or anything. It compiles just fine IIRC.
*************************************************** * MEB_Registered: 20122002 |
|||
|
Member![]() ![]() |
Doubtful, I am usually using awt and swing and they seem to function correctly. Most of these things are simple code examples and 90% of them behave fine. It's a few like the Aquarium example above that do weird things. One thing I noticed is trouble usually lies with using the GUI stuff. I was helping a student build a program for class and we had a simple task of adding a button to an already existing program. Everything was working fine until that point. After adding in the new button, it would never show up. Basically we were following the form of an example in his book which built a small JFrame with two buttons inside and there seemed to be no reason it wouldn't do the same thing on our computers. I would post that code up but after I had him email it to me it seemed he changed the code because none of the buttons show up! Very strange. *************************************************** * MEB_Registered: 20122002 |
|||
|
|
Member |
It was ever thus, but usually it's just screen real estate problems, not a lack of existence. Could some of the stuff be stuck behind a layer which is the layer you're seeing? |
|||
|
|
Member |
Have no proper swing dev environment right now. Problem could be a missing redraw, repaint ... what ever it is called. And a delay of a few milliseconds (like 5) afterwards might be able to fix it. ___________________________________________________________ "The best way to predict the future is to invent it." Alan Kay, 1971. |
|||
|
Member![]() ![]() |
I'm just using the latest NetBeans package for my IDE, sometimes testing in Eclipse as well. Both are free downloads.
I think the example I linked to, from the first chapter, uses AWT only, no Swing. What happens is the menu/title bar gets created, but nothing else. Just that bar. I wonder if anyone is dling it and getting it to work? *************************************************** * MEB_Registered: 20122002 |
|||
|
|
Member |
What platform are you running on too? I happen to know that at least one Java developer is hugely pissed at Apple right now, claiming that their Java implementation is so broken he can't get work done (well, work in Leopard at least).
|
|||
|
Member![]() ![]() |
I'm usually running in Windows XP Tablet Edition. I also have OSX 10.4.9 on this machine (with pen input functional!) but don't use it for anything but bragging rights. I also have OSX 10.4.9 running on my old Powerbook; I don't think I have Netbeans updated on it yet so I may try the program on that machine just to see that it works but I can't fathom how doing so would explain what was wrong with this machine's ability to implement the code....
*************************************************** * MEB_Registered: 20122002 |
|||
|
|
Member |
I must confess that I haven't given this much time, but using JBuilder9 and jdk1.4 on XP, it chokes on line 15 of aquarium.java:
Vector <Fish> fishes = new Vector<Fish>(); "Aquarium.java": <identifier> expected at line 15, column 11 This message has been edited. Last edited by: gil, |
|||
|
Member![]() |
I believe typed containers (like Vector
Gil, that's probably the cause of your error, and not EDs. _____________________________ Albert's path is a strange and difficult one. |
|||
|
|
Member |
Oh, dear, I am behind the times. I was quite happy with Java without typed containers.
|
|||
|
Member![]() |
Typed containers are quite cool, though :
No need for casting anything anymore. No way to get confused with the type of object an array or a vector will return. Well... except when explicitly manipulating generic types. Then, typing becomes a chore and an incomprehensible plain in the anus. _____________________________ Albert's path is a strange and difficult one. |
|||
|
Member![]() ![]() |
yeah, sorry Gil, didn't think abnyone would still be using 1.4, there is actually a caveat in the book for the vector stuff:
Vector fishes = new Vector(); should be used instead. *************************************************** * MEB_Registered: 20122002 |
|||
|
|
Member |
Huh, 1.4 feels really up to date where I sit. I did most of my Java development years ago on 1.1, and I daily use a Whitesmith's C compiler (vintage nineteen eighty mumble) on a VAX. |
|||
|
| Previous Topic | Next Topic | powered by eve community | Page 1 ... 65 66 67 68 69 70 71 ... 102 |
| Please Wait. Your request is being processed... |
|
www.williamgibsonboard.com
www.williamgibsonboard.com
Random Thoughts
Basic computer assistance required, please.