For instance this code produces a runtime error. Do i have to
add the components to a panel then add the panel to a Content Pane then add the content pane to a JFrame? Writing GUI's in Java can be a real pain in the ass.
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test{
public static void main(String[] args){
JFrame jf = new JFrame("A Frame");
JPanel jp = new JPanel();
JButton jb = new JButton("A Button");
JTextArea jta1 = new JTextArea();
JTextArea jta2 = new JTextArea();
jp.setLayout(new GridLayout(1,2));
jp.add(jb);
jp.add(jta1);
jp.add(jta2);
jf.add(jp);
jf.setSize(600,300);
jf.setVisible(true);
jf.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}