Alex Ku

Ranch Hand
+ Follow
since Jan 15, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Alex Ku

I had the same problem. I just deleted every in the configuration folder except config.ini
I think by doing so, it just re-create all the setting.
The problem I am having is about JTree.
I have a MouseListener on the tree.
When user single-clicks on a node, the program will perform some tasks.
When user double-clicks, the program will just expand/collapse the node, but not perform the tasks.
The problem is when double-click, the MouseClicked will be called twice.
Like this:
MouseClicked(...) //with e.getClickCount = 1
MouseClicked(...) //with e.getClickCount = 2
The task will be performed twice and the node will be expanded if it is double-click. Is there a way to find out if it is a double-click with e.getClickCount() is still 1?
I know the peekEvent only return the first event.
Is there a way to get all the event pending in the event queue? So, if there is a MouseClick event with clickcount > 1, then the program will just skip the task?
Like this:

I hope you know what I want.
Thank you
21 years ago
Hi,
I am writing a simple ftp client program to download a file from a ftp site. The site requires login and the ftp client is behind a proxy.
I did find some sample show you how to do FTP. Also, some show you how to work with proxy. But not both.
the following is the codes I use. I got IOException "HTTP response code: 401" if the urlString contains userinfo (ftp://user [email protected]/file)
But "ftp://ftp.site/file" works fine.
I think the problem is the communication between the java program and the proxy server. Could anyone help me?

Hi,


The logos are, well, "ScJP2" logos that you can put on your CV or business card valid for 3 years.


what happens after 3 years? need to retake the exam again???
thanks,
kawaii
Hi,
I believe it is due to checked/unchecked exception.
And IOException is a checked exception.
If you try ArrayIndexOutOfBoundsException, this compiles fine cuz it is an unchecked exception.
correct me if i am wrong,
kawaii
Hi,
In the StringTokenizer class, one of the constructor
StringTokenizer(String str, String delim, boolean returnDelims)
When you call countTokens(), this one will return
total tokens including the delim.
So I wrote up a small test program to test my
assumption.
StringTokenizer st1 = new StringTokenizer(a, "a", true);
StringTokenizer st2 = new StringTokenizer(a, "a");
int total = st1.countTokens() - st2.countTokens()
total is the number of "a" in the string.

I tried quite a few cases. and it seems to be the case.
But I am not sure. You could try it.
If anyone know if this is wrong, feel free to point it out.

kawaii
23 years ago
Hi,
JFrame f = new JFrame();
f.setIconImage(new ImageIcon("imageFile").getImage());
kawaii
23 years ago
hi,

The code above has following output:
0:0
1:0
2:0
3:0
4:0
5:0
6:0
7:0
8:0
9:0
However, if the code is changed to this:
(print out the result in another for-loop

The output is:
0:1
1:2
2:3
3:4
4:5
5:6
6:7
7:8
8:9
9:10
Why???
Thanks
kawaii
23 years ago
hi,
call jComponent.requestFocus() will set the focus to this component.
kawaii
23 years ago
Just a thought on your problem, don't know if it could solve your problem or not.
Correct me if I am wrong, anyone.
Let say:

When you remove C, does the path to E change?
You said some paths are not expanded. Is any node along that path removed or added? If those non-expanded paths always have a removed/added node, then the problem, I guess, will be the previous expanded path no longer valid.
Same applies to the selection.
Anyone, please correct me if I am wrong.
Thanks,
kawaii
[ March 07, 2002: Message edited by: kawaii desu ]
23 years ago
Hi,
I just finished one mock exam.
There is one question similar to this but...
Here is the code:

kawaii
[ March 05, 2002: Message edited by: kawaii desu ]
I dont know if I fully understand the question.
I just combined Rob's code and yours.
correct me if I am wrong.

Dictionary Class...

Code to stop dictionary thread in TextEditor

kawaii
23 years ago
Hi,
1. you can make LogonDialog ld as a global varible,
static LogonDialog ld = new LogonDialog();
then you can access it by MAINCLASS.ld.METHODNAME (if ld is a static varible in MAINCLASS class)
2. Or you can pass ld to OrdEntMenu, either to its construct or using a setter,
LogonDialog ld = new LogonDialog();
OrdEntMenu tr = new OrdEntMenu(ld);
or
tr.setLogonDialog(ld);
kawaii
23 years ago
check out this link from sun's website,
Font Overview
If you are using logical name for the Font, like Dialog, MonoSpaced, etc, they are not the physical fonts installed in the system. The Java runtime will map this name to to some physical fonts in the current system. So it will vary from machine to machine, if they have different fonts.

So, to be safe, using your own font.
kawaii
23 years ago
Here is the link from Java Tutorial on sun's website, Expressions, Statements, and Blocks


Operators with higher precedence are evaluated before operators with a relatively lower precedence. Operators on the same line have equal precedence.
postfix operators: [] . (params) expr++ expr--
unary operators : ++expr --expr +expr -expr ~ !
...
When operators of equal precedence appear in the same expression, a rule must govern which is evaluated first. All binary operators except for the assignment operators are evaluated in left-to-right order. Assignment operators are evaluated right to left.


However, when you evaluate the expression (--i + i++), the result does not agree with the above statements. --i is evaluated first, then i++.
Do I miss something or the tutorial is wrong?
postfix and unary have the same precedence?
thanks,
kawaii
[ March 01, 2002: Message edited by: kawaii desu ]