ID:277650
 
I want to learn Java.
I looked at a few simple tutorials that focused on command line. I made a few simple applications with input.

I wish to move onto GUI designing.
I've looked and looked, googled and googled.
I can't find any sort or tutorial.

Can Java GUIs be made with a application (like VB?)
Do they look and feel native?

How do I make a simple Hello World gui?

Any help would be greatly appreciated.
Flame Sage wrote:
I want to learn Java.
I looked at a few simple tutorials that focused on command line. I made a few simple applications with input.

I wish to move onto GUI designing.
I've looked and looked, googled and googled.
I can't find any sort or tutorial.

Not sure about online stuff, but if you're serious about it I'd recommend the O'Reilly book Learning Java (Niemeyer & Knudsen). Try the 2nd edition, which doesn't cover the latest versions of the language, but it's enough for what you want, and you should be able to find it cheap (~$10).

Can Java GUIs be made with a application (like VB?)
They can be. Try the NetBeans or Eclipse IDEs.

Do they look and feel native?
Under windows, you can switch to the Windows Look&Feel (away from the default "Metal" L&F).
I'm not sure how well it emulates stuff in Vista, though.

How do I make a simple Hello World gui?
import javax.swing.*;

public class HelloWorld
{
  public static void main(String []args)
  {
     JFrame frame = new JFrame("Hello, World!");
     JLabel label = new JLabel("Hello, World!", JLabel.CENTER);
     frame.getContentPane().add(label);
     frame.setSize(640, 400);
     frame.setVisible(true);
  }
}


That's the basic idea.


In response to Hobnob
Allright...
I made a few windows with NetBeans.
How do I link them together?

Example; I made a button, and upon clicking that button, I want it to close the current window, and open up the new window.

Also; how do I open up a window upon running the project?
In response to Flame Sage
To be honest, I have almost zero experience of using the GUI editor in Netbeans (I prefer hand-coding the GUI when I need it). You'd be better off following a tutorial like this one:
http://java.sun.com/developer/onlineTraining/tools/ netbeans_part1/
In response to Flame Sage
MyApplication.java
import java.awt.*;

public class MyApplication extends Frame {
public static void main(String []args) {
MyApplication ma = new MyApplication();
ma.setVisible(true);
}

MyApplication() {
reshape(100,100,400,400);
final MyApplication ma = this;
Button mybutton = new Button("Click here.");
mybutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SomeFrame sf = new SomeFrame(ma);
}
});
add(mybutton);
}

public void paint(Graphics gr) {
gr.drawString("Hello!",100,100);
}
}

SomeFrame.java
import java.awt.*;

public class SomeFrame extends Frame {
SomeFrame(Frame owner) {
setVisible(true);
owner.setVisible(false);
reshape(50,50,100,100);
}
}


Is this what you mean?