Brand New to Java - GUI issue
Hello all I am brand new to Java and I am really trying to carry over what I have learned from .Net. I have done VB for two years now and now learning Java and I can't figure out why I can't get this GUI to pop up. Here is what I am working with thus far:
Code:
package langInterp;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JLabel;
//Start of the Class for the front end.
@SuppressWarnings("serial")
public class frontEnd extends JPanel{
frontEnd(){
BorderLayout border = new BorderLayout();
JFrame frame = new JFrame();
frame.setLayout(border);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setSize(500,250);
frame.setLocation(450,450);
JTextField textInput = new JTextField("", 25);
JButton btnGo = new JButton("Enter");
btnGo.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent e){
}
});
JLabel dispResult = new JLabel("");
frame.add(textInput, BorderLayout.NORTH);
frame.add(btnGo, BorderLayout.SOUTH);
frame.add(dispResult, BorderLayout.CENTER);
}
public static void main(String[] args){
javax.swing.SwingUtilities.invokeLater(new Runnable(){
public void run(){
new frontEnd();
}
});
}
}
The frame pops up and is completely black. Any ideas?
Re: Brand New to Java - GUI issue
setVisible should be the last method called