i am totally confused i am made my own class for button which
extends the jbutton class ; but probe is that button is added to the
pane but other attributes doesnt apply to the button dont know why
...pleae see the code and advise me what went wrong and what is the
correct methods
*********************************************************************
import javax.swing.*;
import java.awt.*;
class mybutton extends JButton
{
mybutton(String name)
{
JButton jb=new JButton(name);
jb.setBackground(Color.red);
jb.setForeground(Color.white);
jb.setBorder(new javax.swing.border.CompoundBorder(new
javax.swing.border.SoftBevelBorder
(javax.swing.border.BevelBorder.RAISED), new
javax.swing.border.BevelBorder
(javax.swing.border.BevelBorder.RAISED)));
jb.setBackground(Color.blue);
jb.setForeground(Color.white);
}
}
public class calcc
{
public static void main(String[] args)
{
JFrame jf=new JFrame("asd");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setBounds(300/2 ,200/2,300,250);
jf.setResizable(false);
Container c=jf.getContentPane();
JPanel jp=new JPanel();
jp.setLayout(new GridLayout(5,3,5,5));
c.add(jp,BorderLayout.CENTER);
mybutton my=new mybutton("check");
jp.add(my);
jf.setVisible(true);
}}