jbutton
btn.setFocusable(false);
btn.setBorderPainted(false);
JButton
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; // Window Value Width
int height = 300; // Window Value Height
frame.setSize(width,height); // Window Dimension with Variables
frame.setLayout(null); //better Layout
JButton button = new JButton();
String bText = "My Button in a long version"; // String value for Button
button.setText(bText); // set String for Button Text
String tText = "Tool Tip text"; // String value for ToolTip on Button
button.setToolTipText(tText); // set String for Button ToolTipText
Font schriftart=new Font("Arial",Font.BOLD,18); // Define a Font, mayby Bold and size
button.setFont(schriftart); // Set Font on Botton
Dimension size = button.getPreferredSize(); // Get prefered Size for Button on Text Size
button.setBounds(width/5, height/5, size.width, size.height); // Set Button Start Point (Left upper Corner) and Size on text Size
frame.add(button);
frame.setVisible(true);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us