Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

HiRez

macrumors 603
Jan 6, 2004
6,265
2,629
Western US
Patmian212 said:
Also is creating a GUI hard?
Creating a basic one is pretty easy, creating a good one (a rich one that serves the user instead of the programmer) is somewhat more difficult. Start with something easy, like a button in a window that prints some text when you click it.
 

Zion Grail

macrumors regular
Dec 24, 2002
104
0
Chicagoland
Xcode actually has an interface builder. Apple's website has tutorials on how to use it with Objective-C, but it can be used with Java also.

Here is a fantastic book on how to code in Java. Link

I have more books on Java than on Assembler, C, C++, C#, Python, and everything else combined. Head First Java (the book at the end of the link) is, by far, the best. It doesn't matter what OS you're using for that book (as Java is platform-independent anyway).

Have fun!
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
Just for comparison, just to create a standard window in Windows C++ programming, it takes 72 lines of code. (I made my own functions that made it 38)

EDIT: And my emula-menu program, it has 1425 lines of code.
 

7254278

macrumors 68020
Original poster
Apr 11, 2004
2,365
0
NYC
slooksterPSV said:
Just for comparison, just to create a standard window in Windows C++ programming, it takes 72 lines of code. (I made my own functions that made it 38)

EDIT: And my emula-menu program, it has 13,772 lines of code.


Jesus u wrote that many lines of code????????? How man mb is the program?
 

mattraehl

macrumors 6502
Feb 26, 2005
384
1
Mac OS X for Java Geeks

A good book for you might be Mac OS X for Java Geeks published by O'Reilly. The title is a little bit misleading, it's more like "Learning Java on Mac OS X." The only drawback being its a little bit dated (Jaguar).

When you are ready for real manly programming and want to learn C, and make nice native Cocoa apps, a great place to start is

http://www.cocoadevcentral.com/
 

ChrisBrightwell

macrumors 68020
Apr 5, 2004
2,294
0
Huntsville, AL
Patmian212 said:
Jesus u wrote that many lines of code????????? How man mb is the program?
13,000 lines isn't that much code. The project at work has more than 290,000 lines of code. I've been on the project for 2.5 years, so it wouldn't be that far-fetched to think that I've written 20,000+ lines of code since I've been here.

Having said that, there's a LOT of functionality to still be implemented. :)
 

feakbeak

macrumors 6502a
Oct 16, 2003
925
1
Michigan
ChrisBrightwell said:
13,000 lines isn't that much code. The project at work has more than 290,000 lines of code. I've been on the project for 2.5 years, so it wouldn't be that far-fetched to think that I've written 20,000+ lines of code since I've been here.

Having said that, there's a LOT of functionality to still be implemented. :)
13000 lines of code is not earth-shattering but it's a sizable amount. The dev shop that I work at currently has several hundred thousand lines of code between four projects. I recently got done with a sample application that will be distributed to our customers to show how to use our main COM automation interface. It's 4000 lines of code for a sample! I don't understand why I am asked to do the things I do sometimes... pays the bills though. Plus it was my first chance to work with C# - nice language for the most part. I do not like the fact that C# does not have optional arguments for functions - you don't need them, but I think it makes the code more elegant.
 

mwpeters8182

macrumors 6502
Apr 16, 2003
411
0
Boston, MA
From personal experience, don't get ahead of yourself. Don't even THINK about doing any GUI progamming until you've got the basics down. Write some console programs that are actually useful, then move on to implementing those programs with a GUI.

MP
 

NtotheIzoo

macrumors regular
Jan 24, 2005
191
0
ChrisBrightwell said:
13,000 lines isn't that much code. The project at work has more than 290,000 lines of code. I've been on the project for 2.5 years, so it wouldn't be that far-fetched to think that I've written 20,000+ lines of code since I've been here.

Having said that, there's a LOT of functionality to still be implemented. :)

I agree..in my software engineering class, two of us wrote a monopoly program...the graphics were opengl and the backend was c++...i would say we hit @ least 10000 lines...i think we had around 8-12 classes and such...it turned out ok...could have done better, but the two of us were the only ones programming in a 4 person group...a few all-niters...
 

slooksterPSV

macrumors 68040
Apr 17, 2004
3,544
306
Nowheresville
mwpeters8182 said:
From personal experience, don't get ahead of yourself. Don't even THINK about doing any GUI progamming until you've got the basics down. Write some console programs that are actually useful, then move on to implementing those programs with a GUI.

MP
True, very true. Once you understand the basics, like converting int to char or int to float or vice versa etc. Then you can understand more complex things (for example in Windows case, what an HKEY type is - I think its just int though). Always, when you learn how to, initialize variables, allot memory for them, and clean out what memory is already stored in them. For an example. Write a program that prints out a variable - in C or C++ do this:

PHP:
//C++
#include <iostream.h>
using namespace std;
int main()
{
 int x;
 cout << x << endl << &x << endl;
 cin.get(); //the &x tells you the address of x
 return 0;
}

If anyone wants the source to my emula-menu program, just contact me. If you have a Windoze box and would like to try emula-menu, just download it from here: http://www.geocities.com/slookytek/utilities/emulamenu.zip

emulamenu.JPG


There is a screen shot of it, if that doesn't show up click this link: http://www.geocities.com/slookytek/emulamenu.JPG
 

xwk88

macrumors regular
May 3, 2005
100
1
ChrisBrightwell said:
The problem is that you're trying to instantiate a java.lang.String object (look at the parameters in main()) and you're not including the java.lang.String class.

Open your text editor of choice (I use TextWrangler) and try this:
Code:
import java.lang.String;

class HelloWorld
{
    public static void main(String args[])
    {
        System.out.println("Hello, world!");
    }
}
Save that as "HelloWorld.java" (no quotes) to your desktop. Notice that the "HelloWorld" class declaration matches the pre-extention "HelloWorld" in the filename. This is case sensitive and they MUST match.

Next, open Terminal.app (Applications / Utilities / Terminal.app) and type in these commands:
Code:
cd ~/Desktop
javac HelloWorld.java
java HelloWorld
The first command, cd ~/Desktop, should be self-explanatory. The second, javac HelloWorld.java, calls the java compiler to compile your .java file into a .class file.

The final command, java HelloWorld, tells the Java runtime executable (aka JVM) to load HelloWorld.class, find the main() method, and run it.

If this is over your head, I strongly suggest picking up one of the "... for Dummies" books and going from there. Learning a language and powerful and complex as C or Java w/out a book or something is really painful.

Good luck.

you don't have to import the String class in java that is already included in the java.lang which will never need to be imported. he's problem was that he typed string instead of String and system instead of System java is case sensitive and won't comile if you don't spell class names right.
;) :cool:
 

ChrisBrightwell

macrumors 68020
Apr 5, 2004
2,294
0
Huntsville, AL
xwk88 said:
you don't have to import the String class in java that is already included in the java.lang which will never need to be imported. [...]
No, but explicitly importing it is part of my organization's coding standards. Besides, he asked how to use an import statement. What better way than by example?

I didn't realize java.lang.* was imported by default, though. Is that part of the Java specification or is it a "feature" of Sun's JDKs?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.