简体   繁体   中英

How to change color of GridLayout spacing?

the GridLayout new GridLayout(5, 8, 4, 4) is shown as a card in a CardLayout. I color the squares bluish by setting the background color of all JPanels I insert into the gridlayout. Where should I look to change the color of the white outlines(the 4 pixel horizontal and vertical spacing I've specified)?

在此处输入图片说明

The layout itself has no color, it's merely in charge of calculating and setting the positions and sizes of the components inside the container it is assigned to.

What you need to do it to set the background of that container, ie the container to which you set the layout

someContainer.setLayout(new GridLayout(...));
someContainer.setBackground(new Color(...));

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