• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calling a JFrame from a nib file...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling a JFrame from a nib file...


  • Subject: Re: Calling a JFrame from a nib file...
  • From: Russ White <email@hidden>
  • Date: Wed, 28 Nov 2001 06:00:10 -0800

Unfortunately, you can't mix Swing & Cocoa (or even AWT & Cocoa).

"The Cocoa application environment includes Java packages corresponding to the Application Kit and Foundation frameworks. These packages allow you to develop a Cocoa application using Java as the development language. You can mix (within reason) the APIs from these packages and native Java APIs (excluding AWT or Swing APIs)."

See Link:

http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/SystemArchitecture/
Application_Environments.html

Yes, it's a bummer.

On Monday, November 26, 2001, at 09:53 AM, Frangois GOURAND wrote:

Hi everybody,

I'm quite stuck with this annoying problem for a while, I hope someone will
be able to give me some help ! :-)
Basically, what I'm going to do is :
- create a Cocoa/Java project type first (OK !!)
- add a button to the MainMenu.nib file whose label is "Connect", which
calls the clicked Java method (its action...)
- In this clicked method, I also call a display method from a Java Windowt
class which is just supposed to display a JFrame...

Here's the code :

Windowt.java
---------------------------------------
import java.util.*;
import javax.swing.*;

public class Windowt {
public void Windowt () {}

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 connecte;

public void clicked(NSButton sender) {
System.out.println("You clicked the button");
Windowt.display();
}
}

--------------------------------------------

So, as you can see, it's quite simple, but when I run it, when I click the
button, I get on the console log :
You clicked the button
Step 1





and then nothing happens... (no JFrame at all...)
Could you explain me why ?
Is it a simple question of compatibility between Swing and the Cocoa
Framework ?

My final goal is to make a Cocoa/java application, because I have some parts
of this application written in Cocoa, which I need to link with all the Java
stuff (and especially the home window of the application... which is a
JFrame...)
If you know another way to make this link, please let me know
That's why I need to link these 2 parts !

Thanks a lot for your help,
regards,

Frangois Gourand
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Calling a JFrame from a nib file... (From: "François GOURAND" <email@hidden>)

  • Prev by Date: Re: XML and NSCoder
  • Next by Date: Equivalent to gethrtime()
  • Previous by thread: Calling a JFrame from a nib file...
  • Next by thread: NSTextField cuts lines
  • Index(es):
    • Date
    • Thread