Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Java Docklings

Java Docklings
Thread Tools
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Apr 27, 2001, 09:16 PM
 
I know no one likes java, but that's all I know, so bare with me. I want to make a dockling using java, but the template provided at StepWise is all in Objective-C. That'd be fine and good if I knew how to read Obj-C, or atleast make a reasonable trnaslation of it. Unfortunately, that's not the case. I got part way through doing a pure Obj-C dockling, before realizing that All i could do was initialize the menuItems and give them names - I had no idea how to do all the brute force stuff I knew how to do in Java. So I was wondering, is there a kind sole out there who is willing to translate the Obj-C template to Java?

Thanks in advance,
F-bacher
     
Dedicated MacNNer
Join Date: Nov 2000
Location: Glasgow
Status: Offline
Reply With Quote
Apr 29, 2001, 03:37 AM
 
There's two ways you can go:

1. Use the Obj-C/Java bridge. Cocoa Dev Central has a good article on this but it seems like lots of hackery if you ask me.

2. Learn Objective C. I know, I know that's not what you wanted to hear, but I was in your position 3 weeks ago when I picked up Apple's 'Object Oriented Programming and The Objective C Language' and read it cover to cover once.

The trick when learning Objective C is to think to yourself 'what is the same as Java here? What is different?'. You'll find that there's lots of things that are very similar, just expressed with different words.

For example:

Method Call
It's called messaging in Obj-C:
Code:
[myObject showYourself];
is the equivalent of:
Code:
myObject.showYourself();
in Java.

Class Definition
In Java you write it all in one file, with JavaDoc effectively taking the role of external documentation. In Objective C you have a header file (myClass.h) that contains the name of your class, it's superclass, your instance variables and a list of the methods that your class provides.

You then develop an implementation file (myClass.m) that contains the code that implements those methods.

So there you go. The advice I would give to any java programmer is get into Objective C. It's very similar to java, hence the fact that the Java Bridge can exist, but I certainly feel better about writing Mac OS X apps in Objective C.

HTH,
Fraser
PowerBook G4 17"
Power Mac G4/800, 1Gb RAM, 80Gb HDD, Superdrive, GeForce 4MX, Gateway 21" CRT, Apple Pro Speakers, iSub - Running Mac OS X Server 10.2
iBook 500, 192MbRAM - Running Mac OS X 10.2
iPod 5Gb
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Apr 29, 2001, 02:27 PM
 
I have to agree with speirsfr.

Java's main pro is being cross-platform. Java's main con is being a slow loader. So, writing a Java dockling would make no sense. You'd be making it OSX-only and it would take forever to bring up the menu.

Grab up as much Obj-C sample code as you can and start foolin' with it. That's the easiest way to learn it coming from Java.
     
Mac Elite
Join Date: Oct 2000
Location: Edinburgh, Scotland
Status: Offline
Reply With Quote
Apr 30, 2001, 05:44 PM
 
Originally posted by IamBob:
I have to agree with speirsfr.

Java's main pro is being cross-platform. Java's main con is being a slow loader. So, writing a Java dockling would make no sense. You'd be making it OSX-only and it would take forever to bring up the menu.
Just being pedantic, but what other OS has a "dock" that would be compatible even if the dockling were written Obj-C?
ClamXav - the free virus scanner for Mac OS X | Geobunny learns to fly
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Apr 30, 2001, 07:03 PM
 
That wasn't the point!

I think I was trying to say that if you're gonna do a dockling you might as well do it in Obj-C. Using Java would be good if you wanted to re-use _some of_ the code for an app with equal functionality for other platforms but if that's not your goal then you're better off (and, I think stuck (for now?)) with Obj-C. Add to that Java's slow-loadingness and there's no point in trying to write a dockling unless you could keep the JVM running 'cause loading it each time would be painful.

I don't know..something like that. Just know that I went from Java to Obj-C and had my first app written in under 2 days. That's including the time it took to glean code, consult the docs, read a tutorial and throw it together.

[added "(for now?)"]

[This message has been edited by IamBob (edited 04-30-2001).]
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Apr 30, 2001, 07:10 PM
 
Originally posted by IamBob:
That wasn't the point!

I think I was trying to say that if you're gonna do a dockling you might as well do it in Obj-C. Using Java would be good if you wanted to re-use _some of_ the code for an app with equal functionality for other platforms but if that's not your goal then you're better off (and, I think stuck (for now?)) with Obj-C. Add to that Java's slow-loadingness and there's no point in trying to write a dockling unless you could keep the JVM running 'cause loading it each time would be painful.

I don't know..something like that. Just know that I went from Java to Obj-C and had my first app written in under 2 days. That's including the time it took to glean code, consult the docs, read a tutorial and throw it together.

[added "(for now?)"]

[This message has been edited by IamBob (edited 04-30-2001).]
Hey IamBob, are you ever going to release the source for Nicer (even though it doesn't work anymore)? It would be nice to see some Obj-C code in action for OSX.

Thanks,
F-bacher
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
May 1, 2001, 05:23 AM
 
Blast you! Blast you all! Instead of studying for finals, I've been learning C. This is all ur fault. Now I'm going to fail out of school. Atleast I'll have a nice dockling... is that a good saying for a beggar to get change?

F-bacher
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 1, 2001, 07:03 PM
 
Well, I lost the source. I sort of erased (woops) my backup HD when I installed OSX Final. So, I had started to rewrite it (again) but then the new Security Framework pissed me off.

Just the other day I sent Terry Glass what little code I had pounded out before giving up on it. I think he's going to finish it up. We'll see. I don't know if the 10.0.2 (Darwin 1.3.2) update added nice support or not so Nicer could still be useless...don't know.

On your cardboard sign:
Will write docklings for food!
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 7, 2001, 01:26 AM
 
I'll try and get that code finished ASAP. I thought I would be able to do it last weekend, but something came up. My last final is Monday @ 1 PM. As soon as I take that, and clean up some other code for release, I'll get to work on Nicer.

Terry
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:29 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2