Hello,
I'm a little bit new to Java and I use NetBeans 6.5.1. I just try to make a window 'by code, manual' (not drag and drop, not visually).
This is my code (first I only want and empty window):
package javaapplication5;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
public class app extends
JFrame
implements ActionListener, WindowListener{
// class members
JFrame appFrame;
// class methods
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Application started");
app app = new app();
}
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void windowOpened(WindowEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void windowClosing(WindowEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void windowClosed(WindowEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void windowIconified(WindowEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void windowDeiconified(WindowEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void windowActivated(WindowEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void windowDeactivated(WindowEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void initialize() {
appFrame = new JFrame("My apps title");
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
appFrame.setSize(400, 600);
appFrame.setResizable(false);
appFrame.pack();
appFrame.setVisible(true);
appFrame.addWindowListener(this);
}
public void app() {
initialize();
}
}
It prints the start mesage but I just don't know why it does not display the JFrame.
Help appreciated!