package text12;
import java.awt.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class text1 extends JFrame {
// private JButton jbt1,jbt2,jbt3,jbt4,jbt5,jbt6;
public text1(){
JPanel p1=new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JButton("Button 1"));
p1.add(new JButton("Button 2"));
p1.add(new JButton("Button 3"));
JPanel p2=new JPanel();
p2.setLayout(new FlowLayout());
p2.add(new JButton("Button 4"));
p2.add(new JButton("Button 5"));
p2.add(new JButton("Button 6"));
setLayout(new FlowLayout());
add(p1);
add(p2);
}
public static void main(String[] args){
JFrame frame=new text1();
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Exercise 12_1");
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
package text12;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class text2 extends JPanel {
public text2(){
add(new JButton("Button 1"));
add(new JButton("Button 2"));
add(new JButton("Button 3"));
setLayout(new FlowLayout());
}
public static void main(String[] args){
JFrame frame=new JFrame();
JPanel p=new JPanel(new GridLayout(2, 1,5,5));
text2 p1=new text2();
text2 p2=new text2();
p.add(p1);
p.add(p2);
frame.add(p);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
``package text12;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
public class text3 extends JPanel{
public text3(){
setLayout(new GridLayout(4,1));
JLabel l1=new JLabel("Department of Computer Science");
l1.setBorder(new LineBorder(Color.blue,1));
JLabel l2=new JLabel("School of Computing");
l2.setBorder(new LineBorder(Color.GRAY,1));
JLabel l3=new JLabel("Armstong Atlanfic");
l3.setBorder(new LineBorder(Color.RED,1));
JLabel l4=new JLabel("Tel(912)921-6440");
l4.setBorder(new LineBorder(Color.black,1));
add(l1);
add(l2);
add(l3);
add(l4);
}
public static void main(String[] args){
JFrame frame=new JFrame();
text3 p=new text3();
frame.add(p);
frame.setTitle("Exercise12_5");
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
package text12;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
public class text4 extends JPanel{
private ImageIcon usIcon=new ImageIcon(“D:\tu\b.jpg”);
private ImageIcon myIcon=new ImageIcon(“D:\tu\c.jpg”);
private ImageIcon frIcon=new ImageIcon(“D:\tu\d.jpg”);
private ImageIcon ukIcon=new ImageIcon(“D:\tu\e.jpg”);
public text4(){
setLayout(new GridLayout(2,2,1,1));
JLabel l1=new JLabel(usIcon);
JLabel l2=new JLabel(myIcon);
JLabel l3=new JLabel(frIcon);
JLabel l4=new JLabel(ukIcon);
l1.setBorder(new LineBorder(Color.BLUE,1));
l2.setBorder(new LineBorder(Color.BLUE,1));
l3.setBorder(new LineBorder(Color.BLUE,1));
l4.setBorder(new LineBorder(Color.BLUE,1));
add(l1);
add(l2);
add(l3);
add(l4);
}
public static void main(String[] args){
JFrame frame=new JFrame();
text4 p=new text4();
frame.add(p);
frame.pack();
frame.setSize(200,200);
frame.setTitle(“Exercise12_6”);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
package text12;
import java.awt.*;
import javax.swing.*;
public class text5 extends JFrame{
public text5(){
//ImageIcon icon = new ImageIcon("d:\\tu\\c.jpg");
JButton button = new JButton("beauty");
button.setIcon(new ImageIcon("d:\\tu\\c.jpg"));
add(button);
setLayout(new FlowLayout());
}
public static void main(String[] args){
text5 frame= new text5();
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}