Michelle Wang

Ranch Hand
+ Follow
since Apr 17, 2007
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 Michelle Wang

Yes, I think my one is more generic than that one. He is really super star
10 years ago
i think it is different issues by different persons.
10 years ago
Hello Sir:

I google a good example that meets my project requirements as code below,
I need to save it in XML format in disk with what I change/draw on the GUI, ie, I draw 10 lines(5 vertical and 5 horizontal) on it, then save it to MySaveLine.xml
then quit, later, I open project, it read this MySaveLine.xml from disk, and it automatically display all what I saved before ie:10 lines(5 vertical and 5 horizontal), it should be exactly same as what I did before.

But I have no idea how to do it,
Can Guru help here??

Thanks



10 years ago
Hi, Friends,
I google and find a code very similiar to my requirements as follows:

I have following problem in Eclipse 3.3.1

When i run in Command console, It success all,
But when I put into Eclipse, It fails, I got follwoing error:
ERROR>java version "1.6.0"
ERROR>Java(TM) SE Runtime Environment (build 1.6.0-b105)
ERROR>Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)
<GoodWinRedirect>ExitValue: 0
ERROR>java.lang.NoClassDefFoundError: abc/LabelForComboBox
ERROR>Exception in thread "main"

What is wrong in my Eclipse Setting??
How to fix it??

Really Thanks

see code below:


[1]. Main Program


[2]. Sub 1 Program:



[3]. sub 2:



Can guru here help find what is wrong with my setting??
Thanks
Hello Sir:

I found a program very close to my project, see below:

I met a problem when I want to use a Java program to run other java processes by Runtime.exec command,
How can I run Runtime.exec command in Java To invoke several other java processes??

see code below,
I want to use HelloHappyCall to call both HappyHoliday.java and HellowWorld.java,

[1]. main program,


package abc;

import java.util.*;
import java.io.*;

class HelloHappyCall
{
public static void main(String[] args){
try
{
Runtime.getRuntime().exec("java -version");
Runtime.getRuntime().exec("cmd /c java HelloWorld "); // here start will create a new process..

System.out.println("Never mind abt the bach file execution...");
}
catch(Exception ex)
{
System.out.println("Exception occured: " + ex);
}
}
}



[2]. sub 1 program



package abc;

import java.util.*;
import java.io.*;

class HelloWorld
{
public static void main(String[] args){

System.out.println("Hellow World");
}
}



[3]. Sub 2 program:


package abc;

import java.util.*;
import java.io.*;

class HappyHoliday
{
public static void main(String[] args){

System.out.println("Happy Holiday!!");
}
}



When I run, I got following:

Never mind abt the bach file execution...


I cannot see both Java version and Hellow World print, what is wrong??

I use eclipse3.2



Can any guru help how to solve it??

Regards
11 years ago
Hello Sir:
I have following code that can draw lines at my will, but I hope to
[1]. Keep all lines I draw here;
[2]. make them draggable and moveable and deletable,
How can I do that??
see code below

[1]. main code



[ October 30, 2007: Message edited by: Michelle Wang ]
11 years ago
Hello:
I have a GUI application, see code below, after I run it, I re-organize the positions for all labels, eg. I put them into different poistions, or put then into center of JPanel. then I quit my application,
nect time, when I re-run this program, I hope to see this last layout that I quit before: all labels are in center of JPanel,
I google a while, no good results.
Please advice how to do it and where to get goo example??
thanks


11 years ago
One more question, How to change the thickness of line I draw here??
Thanks again
11 years ago
Thanks so much, it works
11 years ago
Dear friends:
How to draw a line with text on it??
Can anybody give an example??
Thanks
11 years ago

Originally posted by pete stein:
why do you need the source? And again, why are you trying to subclass it? As mentioned, composition may be better than inheritance.

just search the java site for the source. it shouldn't be hard to find.

[ September 01, 2007: Message edited by: pete stein ]



Good question,
I declare
NewEmployee selectedLabel;
here, NewEmployee.java class extends JLabel{}
As we know, in the method,
public void mousePressed(MouseEvent e) {
.......
Component[] c = ((JComponent)e.getSource()).getComponents();
}

Because I add several JLabels in JPanel, then Array c now gets all JLabels in it,
and NewEmployee.java has some custom methods I need but JLabel.java class does not have them such as getEmployeeName(), setEmployeeName() etc, here NewEmployee.java subclass JLabel class, so when I cast :
selectedLabel = (NewEmployee)c[i];
It throws errors as follows:
javax.swing.JLabel cannot be cast to atest.NewEmployee...

So how to solve this problem??
Thanks
[ September 01, 2007: Message edited by: Michelle Wang ]
11 years ago

Originally posted by Freddy Wong:
JLabel is not declared as final, so you can always extend it. It doesn't mean that you need to override all the methods that you extend from. You can always add and override the methods that you want.

Hope this helps.




Great, Thanks a lot,
But where is JLabel original class JLabel.java located in JDK 6??
is it in C:\jdk1.6.0\jre\lib or C:\jdk1.6.0\lib or somewhere else??
I cannot find the original JLabel Class.
Can you tell me??
Or I can download all source file from java.sun.com??
Any link available for JDK6 source code??
Thanks
[ September 01, 2007: Message edited by: Michelle Wang ]
11 years ago
Dear friends:
I need to add some methods and variables into JLabel, it means I hope to extend JLabel class, can any guru tell How to extend JLabel class??
For example, I need to add:
[1]. methods getUserName(); and setUserName();
[2]. variable, such as Last Name, etc
into JLabel Class or any other similiar class,
how to do it??
Do I need to rewrite JDK6 API?
Thanks
[ August 31, 2007: Message edited by: Michelle Wang ]
11 years ago