简体   繁体   English

如何更改GridLayout间距的颜色?

[英]How to change color of GridLayout spacing?

the GridLayout new GridLayout(5, 8, 4, 4) is shown as a card in a CardLayout. GridLayout new GridLayout(5, 8, 4, 4)在CardLayout中显示为卡。 I color the squares bluish by setting the background color of all JPanels I insert into the gridlayout. 我通过设置所有插入到gridlayout中的JPanel的背景色来为正方形的蓝色上色。 Where should I look to change the color of the white outlines(the 4 pixel horizontal and vertical spacing I've specified)? 我应该在哪里查看更改白色轮廓的颜色(我指定的4像素水平和垂直间距)?

在此处输入图片说明

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(...));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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