0
的亮點,我敢闖民宅刪除文本框亮點:如何在點擊按鈕(JAVA)
當我將JButton單擊使用下面的代碼:
public static JButton addButton(JPanel panel, String text, Point pos, int width, int height, ActionListener action)
{
JButton button = new JButton(text);
button.setBounds(pos.x, pos.y, width, height);
button.addActionListener(action);
button.setVisible(true);
button.setBackground(new Color(255, 137, 58));
button.setForeground(Color.white);
button.setBorder(new LineBorder(new Color(196, 96, 29), 2));
button.setRolloverEnabled(true);
panel.add(button, 3, 0);
return button;
}
該文本框之後突出顯示。有沒有簡單的方法來消除這種影響?
您可以加入一些解釋,它是如何去幫助 – Blip
文檔 https://docs.oracle.com/javase/7/docs/api/javax/swing/ AbstractButton.html#setFocusPainted(boolean) –
感謝您的幫助小夥子;) –