Mixing Cocoa/Java problem
Mixing Cocoa/Java problem
- Subject: Mixing Cocoa/Java problem
- From: "François GOURAND" <email@hidden>
- Date: Tue, 20 Nov 2001 00:22:10 +0100
Hi guys,
I had a quite simple question for you, and I'd be pleased if somebody could
answer to me !
I created a small Cocoa/Java project type with Project Builder whose name is
Test2.
And the problem is I can't understand why it doesn't work !
Here's the code, it's very short and easy :
I didn't change the Main.m file, as usual !
I have two Java classes
WINDOW.JAVA
---------------------------------------
import java.util.*;
import javax.swing.*;
public class window {
public void Window () {}
public static void display() {
System.out.println("Step 1");
JFrame myFrame = new JFrame("It's my frame !");
System.out.println("Step 2");
myFrame.show();
}
}
----------------------------------------
CLICKIT.JAVA
---------------------------------------
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;
public class ClickIt extends NSObject {
NSButton connect;
public void clicked(NSButton sender) {
System.out.println("You clicked the button");
Window window2 = new Window();
window2.display();
}
}
--------------------------------------------
Well, the ClickIt Java class exists only because I want to control the
moment my JFrame is displayed, it's an action specified with
InterfaceBuilder.
When I build this small and simple application, there is no problem... But
when I run it, I can see on the console :
You clicked the button
Step 1
And after that nothing happens, the little multicolored wheel spins round
indefinitely !
Please tell me what I should do to make this work... And if you also know
where I can found good documentation on that particular subject, please let
me know !
Thanks in advance,
Frangois