Log in

View Full Version : The following is my code. I am trying to utilise the borderlayout but its not working


JavaWannabee
May 7, 2015, 06:37 AM
package force;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Appd extends App {

private JPanel panel;

protected void createGUI(){
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container window=getContentPane();
window.setLayout(new BorderLayout());
window.add(panel=new JPanel(),BorderLayout.CENTER);
panel.setPreferredSize(new Dimension(300,400));
panel.add(new Button("Okay"));
}
}

CravenMorhead
May 7, 2015, 07:01 AM
Hi,

I am a talented programmer but my languages are limited to c/c++/perl/SQL. What I did learn in university wasn't specific programming languages but how to learn different languages. I learned how to learn. One of the key skills is figuring out how to find out information on different classes and tenchniques. Google is your friend. [THIS] (https://docs.oracle.com/javase/tutorial/uiswing/layout/border.html) page should be helpful.

Good luck!