import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
{
Jtabbed1()
{
jtp.
setBackground(Color.
black);
jtp.
setForeground(Color.
red);
jtp.addTab("First",new Firstpane());
jtp.addTab("Second",new Secondpane());
jtp.addTab("calculator",new Calpane());
c.add(jtp);
}
public static void main
(String args
[])
{
Jtabbed1 jt = new Jtabbed1();
jt.setSize(500,400);
jt.setTitle("First");
jt.setVisible(true);
jt.
setDefaultCloseOperation(JFrame.
EXIT_ON_CLOSE);
}
}
class Firstpane
extends JPanel
{
Firstpane()
{
setBackground
(Color.
green);
b1.
setBackground(Color.
green);
b1.
setForeground(Color.
red);
b2.
setBackground(Color.
white);
b2.
setForeground(Color.
blue);
b3.
setBackground(Color.
yellow);
b3.
setForeground(Color.
red);
add(b1);
add(b2);
add(b3);
}
}
class Secondpane
extends JPanel
{
Secondpane()
{
setBackground
(Color.
black);
c1.
setBackground(Color.
green);
c1.
setForeground(Color.
red);
c2.
setBackground(Color.
white);
c2.
setForeground(Color.
blue);
c3.
setBackground(Color.
yellow);
c3.
setForeground(Color.
red);
add(c1);
add(c2);
add(c3);
}
}
{
JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,c1,c2,c3,c4,c5,c6,c7,c8
;
Calpane()
{
setLayout(null);
setBackground
(Color.
red);
no1.setBounds(150,70,180,20);
add(no1);
b1.
setBackground(Color.
green);
b1.
setForeground(Color.
red);
b1.setBounds(100,100,50,20);
b2.
setBackground(Color.
white);
b2.
setForeground(Color.
blue);
b2.setBounds(160,100,50,20);
b3.
setBackground(Color.
yellow);
b3.
setForeground(Color.
red);
b3.setBounds(220,100,50,20);
b4.
setBackground(Color.
black);
b4.
setForeground(Color.
red);
b4.setBounds(280,100,50,20);
b5.
setBackground(Color.
black);
b5.
setForeground(Color.
blue);
b5.setBounds(100,130,50,20);
b6.
setBackground(Color.
yellow);
b6.
setForeground(Color.
green);
b6.setBounds(160,130,50,20);
b7.
setBackground(Color.
blue);
b7.
setForeground(Color.
yellow);
b7.setBounds(220,130,50,20);
b8.
setBackground(Color.
white);
b8.
setForeground(Color.
green);
b8.setBounds(280,130,50,20);
b9.
setBackground(Color.
red);
b9.
setForeground(Color.
yellow);
b9.setBounds(100,160,50,20);
c1.
setBackground(Color.
white);
c1.
setForeground(Color.
red);
c1.setBounds(160,160,50,20);
c2.setBounds(220,160,50,20);
c3.setBounds(280,160,50,20);
c4.setBounds(100,190,50,20);
c5.setBounds(160,190,50,20);
c6.setBounds(220,190,50,20);
c7.setBounds(280,190,50,20);
c8.setBounds(170,220,50,20);
add(b1);
add(b2);
add(b3);
add(b4);
add(b5);
add(b6);
add(b7);
add(b8);
add(b9);
add(c1);
add(c2);
add(c3);
add(c4);
add(c5);
add(c6);
add(c7);
add(c8);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
c1.addActionListener(this);
c2.addActionListener(this);
c3.addActionListener(this);
c4.addActionListener(this);
c5.addActionListener(this);
c6.addActionListener(this);
c7.addActionListener(this);
c8.addActionListener(this);
no1.
setBackground(new Color(0,
45,
30));
no1.
setForeground(Color.
red);
}
{
if(ae.getActionCommand() == "CE")
no1.setText("");
else
str += ae.getActionCommand();
no1.setText(str);
repaint();
}
}