> Hello ,
> I am atying to create a button and presented on a
> screen by extending the JFrame and by creating a
> JButton object.The problem is that i can't see the
> button while i am running it. why?
Because you have done something wrong?
Did you expect a better answer? You aren't giving any specific details in your question.
Kaj
try to be more precise:
import javax.swing.*;
public class FormA extends JFrame{
/**
* @param args
*/
public static void main(String[] args) {
JPanel jp = new JPanel();
JButton jb = new JButton("Open");
jp.add(jb);
// TODO Auto-generated method stub
}
}
your code is good, but you do not decide what you will do with your panel.
add this statement to your code:
getContentPane().add(jp, BorderLayout.CENTER);
ofcourse after:
JPanel jp = new JPanel();
do not forget to add:
import java.awt.BorderLayout;
I hope this will be helpfull.
Ahmad Elsafty