I am trying to create a undecorated JFrame, but I am having some issues with my Closing button, It has this ugly "selected" border around it, is there any way of removing it? (Top right corner of image)
This is what I did to remove all borders and backgrounds:
JButton btnX = new JButton("");
btnX.setIcon(new ImageIcon(GameHubMain.class.getResource("/Resources/Close-icon.png")));
btnX.setForeground(Color.WHITE);
btnX.setOpaque(false);
btnX.setContentAreaFilled(false);
btnX.setBorderPainted(false);
btnX.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frame.dispose();
}
});