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 > newbie question

newbie question
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2000
Status: Offline
Reply With Quote
Dec 17, 2000, 12:30 PM
 
Hi, I'm new to programming for the mac in general and in cocoa in particular. I have experience on other platforms.

I'm trying to write a cocoa application in Java. I'm stuck with three problems:
1) I wish to initialize some of the fields ( a text field and a pop-up menu) when the program starts. I can't do it in my class initiator because I get a nullPointerException. I managed some weird scheme with a custom view whose "drawRect" method calls back some initialization method, but there should be a better way. Isn't there?
2) When the program starts the window is dimmed and I need to click on it to make it active. How do I get it to automatically pop up?
3) I've created an .icns file. How do I tell Project Builder that this is where my icon is?

TIA

Yoav
     
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Dec 29, 2000, 01:41 PM
 
3) click on the targets panel and select your target. A thing will appear with tabs like Files and Build Phases and Build Settings. Under the application settings tab you'll see an area named Icon file. Put the path there.

2 & 1) I don't know much about java, so I can't help you with initializing stuff when you declare it or make an instance of a class, but if you want to initialize it before the user gets to do anything one way to do it in Objective C is to throw in a method called awakeFromNib into one of your classes. That way when it is first set up it'll execute the stuff that's in there. I'd assume that it's about the same for Java. You'll probably find how in one of the tutorials that Apple has. Also, if you want your window to come to the front when the program is open, as is mentioned in a tutorial, in Objective C you can use
[windowPointer makeKeyAndOrderFront:self]
You don't have to make a pointer to the window. If you have an outlet to something in the window you can just go like [outlet window] in order to make it return a pointer to the window that it's in. I'd assume that there would be equivalent methods to use with Java. They are probably named the same thing too.
     
   
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 11:21 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