Re: Mixing Cocoa/Java problem
Re: Mixing Cocoa/Java problem
- Subject: Re: Mixing Cocoa/Java problem
- From: email@hidden
- Date: Wed, 21 Nov 2001 00:57:14 +0100
Hi,
If you use cocoa and Interface Builder, there is nothing to do with
swing : use cocoa framework (NSWindow, etc)
If you use the Java Tool in Project Builder you can use swing but forget
cocoa java framework
Regards,
olivier
Le mardi 20 novembre 2001, ` 08:36 , email@hidden a
icrit :
Message: 7
Date: Tue, 20 Nov 2001 00:22:10 +0100
Subject: Mixing Cocoa/Java problem
From: "Fran=?ISO-8859-1?B?5w==?=ois GOURAND"
<email@hidden>
To: email@hidden
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