Tải bản đầy đủ (.pdf) (73 trang)

365 câu đố lý thú phát triển IQ

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (26.13 MB, 73 trang )

package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {


new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);

be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);

add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {

setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton

bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;

import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {

new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);

be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);

add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {

setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton

bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;

import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {

new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);

be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);

add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {

setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton

bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;

import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {

new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);

be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);

add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {

setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton

bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;

import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {

new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);

be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);

add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton
bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {

setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}


package buoi3;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Color;
public class DemoBoderLayout extends JFrame{
private JButton

bn = new JButton("north"),
bs = new JButton("south"),
be = new JButton("east"),
bw = new JButton("west"),
bc = new JButton("center");
public DemoBoderLayout() {
setTitle("DemoBoderLayout");
setSize(300,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
add(BorderLayout.NORTH, bn);
add(BorderLayout.SOUTH, bs);
add(BorderLayout.EAST, be);
add(BorderLayout.WEST, bw);
add(BorderLayout.CENTER, bc);
bn.setBackground(Color.blue);
bs.setBackground(Color.cyan);
be.setForeground(Color.red);
bw.setBackground(Color.pink);
bc.setBackground(Color.magenta);

}
public static void main(String[] args) {
new DemoBoderLayout().setVisible(true);
}
}



×