import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Jbutton {
public static void main(String[] args) {
JFrame frame = new JFrame("GRProgram");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
int width = 400;
int height = 300;
frame.setSize(width,height);
frame.setLayout(null);
JButton button = new JButton();
String bText = "My Button in a long version";
button.setText(bText);
String tText = "Tool Tip text";
button.setToolTipText(tText);
Font schriftart=new Font("Arial",Font.BOLD,18);
button.setFont(schriftart);
Dimension size = button.getPreferredSize();
button.setBounds(width/5, height/5, size.width, size.height);
frame.add(button);
frame.setVisible(true);
}
}