Win a copy of Spring Boot in Practice this week in the Spring forum!

Matt Wilcko

Ranch Hand
+ Follow
since Sep 23, 2003
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 Matt Wilcko

Anyone know how to set the thickness of lines that connect nodes in a JTree? By default, it is only one pixel. I need something a little thicker.
17 years ago
Hi,
I am trying to override a method that belong to an inner class of the BasicTreeUI class. How do I do that?
Thanks
17 years ago
What controls the where a jTree node is drawn on screen? I want to have some of the nodes indented an additional 20 pixels and am not sure what to override to accomplish that?
17 years ago
Hi,
I remove node's chidren by calling removeAllChidren(). This seems to work fine. However, if I try to add a child after doing thing, all of the previously removed children come back? My code snippet is below:

//remove node's children
node.removeAllChildren();
//add a Child
DefaultMutableTreeNode junk = new DefaultMutableTreeNode("junk");
node.add(junk);

How do I add a new child to a node but not have the removed children come back at the same time? Are these values stored in an array that i have to edit?

Thanks!
17 years ago
After experimenting with this, it appears that HashMap's do not like ArrayLists as a key. In small examples, it seems to work. But on larger ones, I eventually got a ClassCastException. Simply switching to a String key solves the problem. Just combined the two array elements with a seperator into a String.
17 years ago
"I think he means that two arrays with the same content will return false when compared with == (because they are different references)."

Yes.. accidentally typed = instead of == in my post. What I am asking about is since when the HashMap compares keys, it effectively uses the == instead of Arrays.equals(a,b), so the arrays will never be equal even if they have identical content.

For example:

import java.util.HashMap;

public class DoIt2 {
public static void main(String [] args) {
HashMap hm = new HashMap();

String[] a = {"bob", "mary"};
String[] b = {"bob", "mary"};
hm.put(a, "MyString");

System.out.println(hm.get(b));
}

}

This will return null.

Is there any way work around this?
[ April 24, 2005: Message edited by: Matt Wilcko ]
17 years ago
When you iterate through your array, extract each element to a string. Then create a patern Matcher and supply the regular expression '[0-9]?'. This should look for occurences of any digit and return a true or false. Just search for tutorials on regular expressions and pattern matchers.
17 years ago
Can an array be used as a HashMap Key? My concern is how HashMap compares if two keys are indentical.. since using '=' will always return false, is there something I can override or is there an easier way to do this?

Also, when I call .get() on the HashMap supplying an array as the argument, I get a ClassCastException?
17 years ago
Can anyone suggest a good free java FTP class? If it is easy to use, that is always a bonus. Looking to create a program that will allow a user to edit a text file and upload it to their website easily.
17 years ago
Hi,
Trying to put an anonymous HashMap into an existing HashMap.. don't get any error but when i try to retrieve this inner HashMap I just get null.

myHashMap.put(keyName, new HashMap().put(name, Integer.valueOf("1")));

Can you not do an 'anonymous' hashmap? If it create a hashmap (name it) and insert it, it seems to work okay. But then I run into problems when retrieving this inner HashMap. It works okay for about 20 results then I get a null pointer exception.

Is there a better solution then putting HashMaps inside of HashMaps? I can't use a database.

Thanks
17 years ago
I would get XP and then if you want to experiment with web servers, install apache, tomcat, etc... If you plan to run a web server down the road, IIS is easy to use but the version that comes with XP is limited to 10 connections.
18 years ago
Hi,
I develop and sell java applications that are distributed on CD. I am wondering what kind of insurance I need? Any programmers on in forum famaliar with this? What does it cost per year? What insurance companies offer it? Ive called around but most insurance agents are not famaliar with software liability. I've read where people say all you need to do is form an LLC.. a laywer has told me that an LLC will only protect you if someone else in your company errors, if you cause a problem, you case still be personally sued.
I have also heard that if you are married, you can not be sued for any assets which have both you and your wife own jointly(house and saving account). Anyone heard this?
Thanks!
Matt
18 years ago
I've read a few books and I think Murach's Beginning Java 2 is probably the easiest to follow. The book doesnt get into deep detail, so having another book like WROX Beginning Java 2 as a reference book is nice.
18 years ago
Has anyone had trouble with their swing application running on certain video cards? I am currently testing an application, seems to run fine on a few systems except for a system with a VIA TECH 8361/8601 video card(onboard video). Reducing the the systems resolution to 640x480 and 256 colors causes the program to run fine. Anything above that and parts of the application get stuck on the screen(move the window, and parts of the window appear at the old location). Is this common or possibly just a video driver problem?
18 years ago
Hi,
Just finished a commercial application to distribute. Any program I have ever installed always has a disclaimer stating that it is "as-is, without warranty", etc.. Is there a standard disclaimer out there I can use? I don't even know where to look for something like this.
Thanks!
18 years ago