Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

BorderLayout Example In java

                         

Introduction

In this section, you will learn how to create BorderLayout in java awt package. The Border Layout is arranging and resizing components to set in five position which is used in this program. The java program uses and declares all positions as a  NORTH, SOUTH, WEST, EAST, and 
CENTER. Here, you will understand about this position how to use in this program.

Program Description:

Following program uses the BorderLayout class for creating Button and set on the frame. Here, define the class named BorderLayoutExample for using  this program. This Java Application uses BorderLayout for setting the position on the frame.

BorderLayout(): This is default constructors of the class Border layout class. This class constructs a new border layout without any gaps between components.  

Here is the code of this program:

import java.awt.*;
import java.awt.event.*;

public class BorderLayoutExample {

  public static void main(String[] args) {
  Frame frame= new Frame("BorderLayout Frame");
  Panel pa= new Panel();
  Button ba1= new Button();
  Button ba2=new Button();
  Button ba3=new Button();
  Button ba4=new Button();
  Button ba5=new Button();
  frame.add(pa);
  pa.setLayout(new BorderLayout());
  pa.add(new Button("Wel"), BorderLayout.NORTH);
  pa.add(new Button("Come"), BorderLayout.SOUTH);
  pa.add(new Button("Rose"), BorderLayout.EAST);
  pa.add(new Button("India"), BorderLayout.WEST);
  pa.add(new Button("RoseIndia"), BorderLayout.CENTER);
  frame.setSize(300,300);
  frame.setVisible(true);
  frame.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e){
        System.exit(0);
      }
    });
  }  
}

Output this program:

Download this program.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
Expression Language
ASP EXAMPLE and 1=2
string to binary
Java date format
dynamic array value
tree
application.xml
parseInt
Date comp[are in JSP
how to pass same varia
retrieve image url fro
log4j
calling one jsp p
jsp select
File Upload
GameStep
login session
download struts applic
jQuery To Hide the Div
definition of interfac
month format vb.net
Java Count words,reve
retrieve image from da
jboss connection pool
standered jstl jar to
object oriented progra
web
array element
Photoshop Text Effects
reload image
breadcrumbs in jsp
struts tld downloas
Threads
criteria restrictions
Java Mysql
global variable in j
Diff bet MVC Model1 an
code for inserting val
how to override a vari
count
java bean insert conne
how to read txt file f
Create table and inser
Javascript Date and Ti
retriving multiple ima
GWT Servlet
jsf tree node set hr
creat
Passing Parameters in
requestDispatcher
program for factorial
FCKediter
java program to check
oracle
string variable
create xml using java
display arraylist
string array add eleme
how to use maps in jav
save image to file
struts menu
Flash Tips and Techniq
HWPF
Servlet to update the
jsp export to pdf
how to use unique cons
JButton with image
jsp to microsoft sql
Hibernate API
Murachั??ะ??ั??à
find a replace bytes i
TCP buffer
date validation in jav
writing data to file
The JDBC(tm) Universal
ANTretrieve data from
JSP and Ajax for datab
string to integer
date validation in Jav
Creating a DSN for MyS
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.