Anthony Yip

Ranch Hand
+ Follow
since Aug 24, 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 Anthony Yip

Hi all

I have a program running fine on Windows 98 but not with WinXP. It encountes a NoSuchMethodError: java.lang.String.replace() ....

Then, I tried a very simple example as follow:



Similar error found.

Could anyone know the reason?

Actually, I am trying to trim all the space from a string. If I don't use replace(), what is the best alternative?

Regards
Anthony Yip
17 years ago
You need to add ItemListener to ComboBoxA to update the ComboBoxModel of ComboBox B according to ComboBoxA's selection. Then do the same to ComboBoxB to update the textfield.

Regards
Anthony Yip
17 years ago
Dear all,

Is it possible to update the title of TitledBorder at runtime?

I have tried to update it with setTitle(), but it didn't take effect.

Please inform.

Regards
Anthony Yip
17 years ago
I have a Swing application that needs to display a few 3D diagrams. As Java3D is AWT, will it cause problems in a Swing application?
Furthermore, could anyone please tell me what the differences between DirectX and OpenGL versions of Java3D?
Thanks in advance
Regards
Anthony
17 years ago
When objA was created with new A(), since no argument provided, default constructor called and objA's variable a is assigned a value of 0, then nothing printed.
When objB was created with argument objA, the super(2) in class B's constructor called. As class B is subclass of Class A, super(2) call class A's constructor with an argument 2. And the variable a of objB is assigned a value of 2. Then, print the message " a in class A: 2 ".
After that, variable b is assigned a value equals to objA's variable a, that is 0. So, print "a,b (1)in class A: 2, 0".
Lastly, variable b is re-assigned a value equals to objB's variable a, that is 2. So, print "a,b (2) in class A: 2, 2".
The difference between the 2 statement is because b's value changed from value equals to objA's a to objB's a.
Is it clear?
Regards
Anthony Yip
17 years ago
It seems that you have see your JDialog as non-modal. With a non-modal dialog, user can still input on the background GUI. You can solve it by creating a modal dialog.
However, if you just want to show a warning message, why not use the static method provided by JOptionPane, like showWarningMessage()?
Regards
Anthony Yip
[ March 10, 2004: Message edited by: Anthony Yip ]
17 years ago
I am still working on it, therefore, no code is available now.
Be detailed:
I have a list of objects. User can pick any number of them, maybe 1 or maybe all, to form a combination of them. After picking them, they will set some attributes on each of them.
Since I don't know how many objects user will pick each time. The most convenient way I can think of is using a table. When user need to pick up an additional object, I just add a new row for them.
The first column of the table will be a ComboBox to list those objects for user to choose from. Since user is not supposed to pick the same object twice for each combination, I have to update the ComboBox's model in order to avoid user to pick those objects already selected in other columns. That's why I want to know what listener and handler I should use so that I could update the ComboBox.
Hope you will understand my problem a bit more. Thanks alots.
Regards
Anthony
17 years ago
Greetings all
My application has a table with one of the columns use ComboBox as renderer, I hope that the data list of the ComboBox with dynamically updated based on the selections on the other rows. Which event handler should I add?
Regards
Anthony
17 years ago
Thanks for advice. It works perfectly.
Regards
Anthony
17 years ago
Greetings all,
I would like to update a flag when a one of the cell in a JTable has been updated. I have no idea how to do that. Could anyone give me some ideas?
Thanks for help in advance.
Regards
Anthony
17 years ago
Yup I would like to popup a dialog by pressing a button for user to choosing a column to be deleted.
My TableModel is simple:
I have a TreeSet that storing data. Then,

Then, with some codes convert the data from the set to the above array. Then, instaniate a DefaultTableModel with the above array as arguments:

I have already used a showInputDialog to get a String that representing the column header from user. And then, locate the relevant TableColumn. But I don't know how to remove the column from the TableModel.
Could you give me some hints?
Tell me if you need more details.
Thanks
Regards
Anthony Yip
17 years ago
How I can delete a column from JTable's TableModel?
Please give me some idea. Thanks.
Regards
Anthony Yip
17 years ago
My application has to read data from a file while init. The file will store data from serilization.
My problem is that when the application been run its very first time, the file will include no data of course. When I use ObjectInputStream.readObject() to read it, NullPointerException occurred. Although I tried to catch NullPointerException to create a blank data object for this special case, the above exception caught by IOException instead of NullPointerException. Of course, I can create the blank data object in the catch clause for IOException. However, there will be time a real IOException occurred. Therefore, I should find other ways to deal with this speical case.
I have no idea how to do so. Could someone suggest any solution?
Regards
Anthony Yip
17 years ago
Dear All,
I need a urgent help from you.
I have a class as follow:


My problem is that I need to modify cardFront by click a button that will change the cardNo.
I have tried to remove the cardFront and redraw it, then add it to the layout again. But it does not work.
Please advise me how to do it.
Thanks in advance
Regards
Anthony Yip
18 years ago