Tweet
|
myButton.setPreferredSize(Dimension(40, 25));In this case, adjust its width to the message length by setting Dimension class 0 in X and variable in Y for the font, and apply layout classes such as GridBagConstraints.
myButton.setPreferredSize(Dimension(0, MyHeight)); ... GridBagLayout myLayout = new GridBagLayout(); GridBagConstraints myCons = new GridBagConstraints(); ... myCons.fill = GridBagConstraints.HORIZONTAL; myLayout.addLayoutComponent(myButton, myCons);
Go to Internationalization Programming Top