Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

border layout

 
harsimran kochar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.awt.*;
import javax.swing.*;
import java.awt.BorderLayout;


class Welcum extends JFrame {
Container c;
JButton bFd,bAcct;
JLabel lWelcome;

public Welcum() {
c=getContentPane();
setTitle("welcome");
setBounds(0,0,800,500);
//setLayout(BorderLayout);
bFd=new JButton("fdDetails");
c.add(BorderLayout.NORTH,bFd);

lWelcome=new JLabel("welcome");
lWelcome.setFont(new Font(Font.DIALOG,Font.BOLD,68));
c.add(BorderLayout.CENTER,lWelcome);

bAcct=new JButton("AccountDetails");
c.add(BorderLayout.SOUTH,bAcct);

setVisible(true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);

}
public class welcome{

public static void main(String[] args){
//new FrmAdd();
new Welcum();
}
}

}
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your question?
HowToAskQuestionsOnJavaRanch
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The public class welcome is coded as a inner class of Welcum. Might be mistakenly the closing "}" of the Welcum class is placed at the last. Remove the last "}" and add it just before the welcome class...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic