Win a copy of Rust Web Development this week in the Other Languages forum!

Chris Nash

Greenhorn
+ Follow
since May 20, 2009
An incredibly old programmer (almost 45!) having fiddled with practically every decent programming language (C, C++, C#, Java) and even some indecent ones (Fortran)!  Just trying to muddle his way through technology without destroying modern civilization in the process.
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Nash

Book Review Team wrote:I recommend this book to developers working with Eclipse, be it using the RCP or writing plugins for the full IDE. This book fills in a lot of gaps that are not well covered elsewhere. After reading, I think you'll discover that the doggie food can taste pretty good.



This book may have been good when it came out, but now it is hopelessly outdated and the information doesn't map well to the latest version of the Eclipse IDE. The book begins well, but as soon as you attempt to do things in the IDE, the trouble begins. The book begins to fall apart in Chapter 3 during the Target Platform Setup. It's completely unworkable. Since that's optional at that point, it can be skipped. But another roadblock occurs in Chapter 5 in "Adding the Contacts View to a Perspective". It doesn't work and even the code that can be downloaded from the accompanying website doesn't work (it runs, but it doesn't do what the book shows it's supposed to).

To be fair, up until the roadblock in Chapter 5 (and the unworkable Target Platform Setup in Chapter 3), the book is fairly good. But given that there's 29 chapters, 83% of the book is useless. I can't recommend this book to anyone attempting to learn the Eclipse RCP. If a Version 3 comes out, it may be worth picking up, but that remains to be seen. Stay away from this book unless you have an ERCP expert on hand to get you past the unreliable sections of the book.
10 years ago
Games developed in C#, C++ or Java (assuming you have a JVM) will all run under Windows. What you study and use depends on what type of games you want to develop. If you want to create an FPS, you'll want to use C++ and an SDK like DirectX and/or XNA. If you want to create a puzzle-type game, pretty much any language will work. A 2D side-scroller can also be done in almost any language, but doing it in Java will make it cross-platform.

There is really no "best" tool or language. "Best" is very subjective and changes on what you want to create. Games is a very broad category of software applications and there are dozens of kinds of games that can be created. There is no "best" tool or language for ALL games. Please specify what TYPE of games you want to create, and maybe you'll get a better answer.

Also consider using a game engine. There are many free ones and some low-cost commercial ones (Torque, Torque 2D). Once you understand a language fairly well, using a game engine can alleviate some of the headaches associated with throwing up graphics on the screen and shooting sound out the speakers. But keep in mind that created a commercial-quality games these days normally takes a team of people, each expert in a specific discipline (2D art, 3D models, physics, AI, 3D graphics, design, etc.). Leaning game program is a fine endeavor, but don't get discouraged if your early efforts don't look professional.

In the meantime, please specify what types of games you want to create.
11 years ago
I suspected it was something simple like that. Thanks for the pointer! Regards.
Hello!

I'm trying to create a working set in Eclipse 3.4.2 and it says it created it but I don't see anything in Package Explorer. Does anyone know what's going on here? When I try to create it again, it says a working set with that name already exists but I don't see anything there in Package Explorer.

Thanks in advance!

Frecklefoot
Inherit from JLabel and override its paintComponent and do your custom drawing in there. Be sure to call the super.paintComponent() as your first statement in your custom method. However, from what you say it sounds like what you should do is to replace the JLabel with a JPanel instead, and just draw your graphics and text in it (using the same approach discussed above). HTH
11 years ago
I don't see where y is getting set to anything but 0, but I didn't do an exhaustive examination of the code. I think your problem is here:



Try this instead:


Calling the super method makes it behave like a regular JComponent, but still implements your painting. You may have to set the component to transparent (setOpaque(false)), but other than that, it should behave like you expect it to. HTH
11 years ago
Keep in mind that you can place JPanel within JPanel within JPanel. It's possible to create very complex GUIs using this method. And all can have their own layout managers. Don't attempt to do it with just one JPanel. If the JTable doesn't work for you, look at combining several JPanels where each hold a specific set of controls, all with their own layout managers. Just my $.02...
11 years ago
Chris, Pete and I were telling you to do two different things. His suggestion is to extend JButton and implement your own paint routine. He says there is an isRollover() method you can call to check for rollover. In his case, you won't need a mouse listener.

My suggestion was to ditch JButton altogether and instead extend JLabel and, in effect, make your own button with a mouse listener. My suggestion is more work, but it worked for me. His is probably simpler and leverages the existing JButton API. It's your choice. We're talking about two different approaches. Don't mix and match them. If you want to do what he suggested, ignore everything I suggested, and vice-versa if you want to take my route. My recommendation is to follow his advice since he provided code samples and probably has more experience with this type of stuff.
11 years ago
Not that I've ever done it, but from looking at the API, it looks like setCaretPosition() will do the trick. HTH
11 years ago
Make the listener an inner class of myButton. Use a MouseAdapter and extend it. Add the MouseListner in the myButton constructor. Then all you have to do is implement your logic in the mouseEntered() and mouseExited() events in the adapter. Ask if you need any more direction. HTH
11 years ago
I have a JPanel (A) that the user can grab and move around. I have other JPanels (Bs) that are peers to A (they are aggregated in the same parent JPanel as A). Bs are MouseListeners that want to know when the mouse enters or exits them. When A is dragged over a B, the B doesn't get mouse input. They only get mouse input if A is moved off of them. I still want the Bs to get mouse input, whether or not A is on top of them (Bs are about the same size as A, so A covers them). Is there a simple API call that I can get to "push" mouse input down to the JPanel below? I can think of several ugly work-arounds, but none are elegant. TIA!
11 years ago
Thank you for your help. Unfortunately, now I get a big white rectangle in the corner when I render, even when the panel is turned off. It's even in the wrong position, but is just the right size. The Image JButton still doesn't show up anywhere. Perhaps I'm doing something wrong elsewhere. I'll take a look.
11 years ago
Yes, I meant paintComponent() (my bad). I wasn't calling super.paint( g ), but now that I do, it crashes (actually, it goes into an endless loop of calling paintComponent() over and over again. If I didn't kill it, I assume it would eventually crash). Here is the code, as requested.



BTW, all the examples I've seen which override paintComponent() never call super.paint(g), which is why I never called it in the first place.
11 years ago