import java.awt.Dimension;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Example {
public static void main(String args[]){
JFrame frame = new JFrame();
frame.setResizable(false);
frame.setMinimumSize(new Dimension(200,150));
frame.setLocationRelativeTo(null);
frame.setLayout(null);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton exampleBtn1 = new JButton("set");
exampleBtn1.setBounds(10, 10, 70, 10);
frame.add(exampleBtn1);
JButton exampleBtn2 = new JButton("set");
exampleBtn2.setBounds(10, 30, 50, 10);
frame.add(exampleBtn2);
}
}
this code display JFrame with 2 JButtons, each of then showing text "set" cutted a little bit vertically. but i cant get same result horizontally and JButton exampleBtn2 is an example of my problem.
how to make exampleBtn2 able to show all text in horizontal orientation? i want to get same result as vertical: even if JButton size is to small to show all text i want to see it cutted, not repleaced by dots.
You can try with:
exampleBtn2.setMargin(new Insets(0, 0, 0, 0));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With