Jump to content

Image as JButton background

- - - - -

  • Please log in to reply
No replies to this topic

#1
mith

mith

    Newbie

  • Members
  • PipPip
  • 18 posts
Hello,
I made transparent image and i set it as button. I removed boarder and set Color(0,0,0,0) to make my button transparent. Everything is ok, but after i click on this button, background behind my image is again set to metal theme, how i can have transparent background after click on button?
JButton BestScore = new JButton(new ImageIcon("img\\NajlepszeWyniki.png")); 

       BestScore.setBorder(BorderFactory.createEmptyBorder());

       BestScore.setBackground(new Color(0,0,0,0)); 

       BestScore.setOpaque(false);

       panelContent.add(BestScore, gc);
Best regards, mith.

ps. sorry for my English.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users