I've got a jPanel with a jButton, and the user can define the size of the jPanel when launching the application using parameters, the jButton sizes according to the jPanel.
The problem is when I use a fixed font and the Panel is large, then the font looks very small, and vica versa.
So the font size should always be the maximum font size who fits in the button. This seems like the basic problem when you let users specify the size of a JPanel or other container. That is what Layouts are for. If it is too big for the current view, throw it in a JScrollPane.
以上就是How do I set the font size of the text on a swing jButton to the maximum size who fits the jButton的详细内容，更多请关注web前端其它相关文章！