Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

Paul Clapham

Marshal
+ Follow
since Oct 14, 2005
Paul likes ...
Eclipse IDE Firefox Browser MySQL Database
Vancouver, Canada
Cows and Likes
Cows
Total received
69
In last 30 days
2
Total given
134
Likes
Total received
2764
Received in last 30 days
26
Total given
702
Given in last 30 days
5
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paul Clapham

Yup. If you want to use a method of class X, and it's not a static method, you need an object of type X to call that method with.

Example: DateFormat and SimpleDateFormat Examples.
1 week ago
Would I be correct that "DateFormat" is the name of a class and not the name of a variable? Because you should have a variable of type DateFormat in that location.
1 week ago
Here's a link to a blog post I just tracked down which explains why generics and arrays don't work together in Java: Why is Generic Array Creation not Allowed in Java?. (In the example you posted, you have an array of List objects and not an array of List<anything> objects.
1 week ago

Tim Holloway wrote:If you're doing a shopping app in Swing, it had better be one for academic purposes only.



That's why I sort of tried to ask whether the application design included the super-user being in the same room as the customer. But I got brushed off, so for now it's just an academic exercise as far as I can tell.
I was expecting that this would be a practice exercise, and not the basis for any real-life system.
1 week ago
Sorry, I just have this bias against designs which conflict with reality. Anyway, it should be extremely easy to create the Java classes described by your original post. So why don't you give that a try and let us know what problems you run into?

As for generating RDF from a collection of those objects, that's a separate problem. In fact Apache has built a whole package to do that sort of thing -- you might want to start by looking that up to get some ideas.
1 week ago

Dave Tolls wrote:Make the list view editable depending on the user that is logged in.
One way is to add a part of the page that is an editable version for the super user, and a read only version for the customer.



Or just use the setEnabled method to make the component editable or not, depending on the logged-in user.
This isn't really suited to Java. For example a Son could also be a Man, and in Java an object can only be assigned to one type.
1 week ago
There's an "equalsIgnoreCase" method in String, but there's no "containsIgnoreCase" method. So if you could dispense with "contains" and replace it somehow by "equals", you could then use "equalsIgnoreCase" to get rid of the lower-casing.
1 week ago
Which one? There's several instances of converting to lower case in your code.
1 week ago
It looks like the answer might be Yes. You used the simplest form of Collectors.groupingBy, but there are others. One of them has a parameter which is suggestively named "mapFactory". The API documentation goes into more detail, including an example of how to specify the type of the Map.

The Collectors class is generics running amuck (five type parameters??!!) so it isn't obvious to me that using a LinkedHashMap is going to do what you want, but I encourage you to try it out.
1 week ago
Does that URI match the URI which you declared in the tag's TLD file? Or are you assuming that the taglib's URI is a location? It isn't. It's a name.
1 week ago
JSP
Aha. Now I understand why you were going to the Nokia forum site. Sorry, you might be out of luck.
1 week ago
Hi Mihai, welcome to the Ranch!

Could you post all of the code that you ran? Jeanne will have the book of course, but others don't.
Swing? If you're looking for a solution for your scenario where some user can modify component X and some other user can't, then threads are absolutely not part of that solution. All access to GUI components run on the same thread, that's a key part of Swing.

I assume your scenario looks something like this:

Customer is sitting (or standing) next to a screen choosing items to order. At some point customer likes the item but not the price, so he calls over Pat (the boss) who can change the price.

So what I would imagine after that is, Pat clicks on the "Super Signon" button and enters their password. Then changes the price, then clicks on the "Super Signoff" button, and the customer carries on from there.

Am I way off from what you were thinking? I don't see how you could possibly bring threads into that scenario even if you tried.