0
JPanel panel = new JPanel();
panel.setLayout(null);
JButton button = new JButton();
button.setSize(30, 30);
button.setLocation(30, 30);
panel.add(button);
我不知道,但是有时候按钮appeares本身(据我了解有),有时按钮没有出现,直到鼠标悬停它。你能解释一下,请问是错误还是我做错了什么。有时Jcomponents是不可见的,直到鼠标悬停
我注意到,如果我添加线 – user5675069
我注意到,如果我添加线button.setBorderPainted(假);我的按钮始终显示。 – user5675069
JFYI,您可以在发布后5分钟内编辑您的评论;如果您发现它们不必要,您也可以随时删除您的评论。要将代码内联为'button.setBorderPainted(false);'用反引号'符号来包装它。 –