I am trying to make transparent JButtons (with visible text) but when the button has clicked the background becomes light blue. (Don't mind the indentation in the code. It's all properly indented)
I've made the button successfully transparent but I fear that the problem might be because I add all the JButtons to a JLabel(A background image).
JButton play = new JButton("Play");
JButton quit = new JButton("Quit");
JButton instructions = new JButton("Instructions");
Color invs = new Color(0,0,0,0);
play.setBackground(invs);
quit.setBackground(invs);
instructions.setBackground(invs);
play.setBorderPainted(false);
//play.setMargin(new Insets(0,0,0,0));
play.setRolloverEnabled(false);
play.setFocusable(false);
play.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
instructions.setBorderPainted(false);
//instructions.setMargin(new Insets(0,0,0,0));
instructions.setRolloverEnabled(false);
instructions.setFocusable(false);
instructions.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
quit.setBorderPainted(false);
//quit.setMargin(new Insets(0,0,0,0));
quit.setRolloverEnabled(false);
quit.setFocusable(false);
quit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
instructions.setForeground(Color.WHITE);
play.setForeground(Color.WHITE);
quit.setForeground(Color.WHITE);