更新时间:2023-12-05 08:34:10
不需要将 JPanels
移动到容器中,否则你需要使用大量无用的代码来删除两个来自带有两个索引
的contianer的 JPanels
然后使用交换索引布局回容器
,
there wouldn't need to move with JPanels
into container, otherwise you woud need to use bunch of quite useless code to remove two JPanels
from from contianer with two indexes
then to layout back to container with swaping indexes
,
(仅限于 Color
)仅交换 setBackground(Color.Xxx)
两个之间 JPanels
(if is about Color
only) only to swap setBackground(Color.Xxx)
betweens two JPanels
类似益智游戏
约为图像
,拼图或minesweaper即将发布,(不清楚...)
puzzle-like game
is about Images
, puzzle or minesweaper is about, (not clear from your ...)
将图像
设为图标/ ImageIcons
到 JLabel
而不是 JPanel
和鼠标事件
切换( setIcon()
)与图标
之间 JLabels
,加载图标
到本地变量
put Images
as Icon/ImageIcons
to JLabel
instead of JPanel
and on Mouse Events
to switch (setIcon()
) with Icons
betweens JLabels
, load Icons
to local variables
(最简单的方法) JToggleButton和Icon ,有 JLabel
的逻辑类似物,但是关于在上显示
图标
setPressedIcon()
(easiest of ways) JToggleButton and Icon, there is logic similair as for JLabel
, but about showing Icon
on setPressedIcon()