Discuss border layout with example.

 The BorderLayout is used to arrange the components in five regions: north, south, east, west and center. Each region (area) may contain one component only.

Components of the BorderLayout Manager

BorderLayout.NORTH

BorderLayout.SOUTH

BorderLayout..EAST

BorderLayout.WEST 

BorderLayout.CENTER


BorderLayout Constructors:

BorderLayout()=creates a border layout but with no gaps between the components.

BorderLayout(int hgap, int vgap)=creates a border layout with the given horizontal and vertical gaps between the components.

Example:

import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame;

public class BorderLayoutExample 

{ BorderLayoutExample()

{ JFrame f=new JFrame();

JButton b1=new JButton("NORTH");; 

JButton b2=new JButton("SOUTH");; 

JButton b3=new JButton("EAST");; 

JButton b4=new JButton("WEST");;

JButton b5=new JButton("CENTER");;


f.add(b1,Border Layout.NORTH);

f.add(b2,BorderLayout.SOUTH);

f.add(b3,BorderLayout.EAST); 

f.add(b4,BorderLayout. WEST);

f.add(b5,Border Layout.CENTER);

f.setSize(300,300); 

f.setVisible(true);

}

public static void main(String[] args)

 {

 new BorderLayoutExample();

}

}

Comments

Popular posts from this blog

Suppose that a data warehouse for Big-University consists of the following four dimensions: student, course, semester, and instructor, and two measures count and avg_grade. When at the lowest conceptual level (e.g., for a given student, course, semester, and instructor combination), the avg_grade measure stores the actual course grade of the student. At higher conceptual levels, avg_grade stores the average grade for the given combination. a) Draw a snowflake schema diagram for the data warehouse. b) Starting with the base cuboid [student, course, semester, instructor], what specific OLAP operations (e.g., roll-up from semester to year) should one perform in order to list the average grade of CS courses for each BigUniversity student. c) If each dimension has five levels (including all), such as “student < major < status < university < all”, how many cuboids will this cube contain (including the base and apex cuboids)?

Discuss classification or taxonomy of virtualization at different levels.

Pure Versus Partial EC