简体   繁体   中英

automatic resizing of jbutton icon in gridlayout

I'm making a chess game. I'm using a gridLayout(8,8) and filled it with a JButton[8][8]. Each JButton has an icon of the piece on that square or an icon of a blank square if no piece is on it. Right now the pieces get cut off. How do I make it so that the icons automatically resize themselves to fit whatever size the grid makes the JButton?

您也许可以使用Darryl的Stretch Icon

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM