Skip to content

Instantly share code, notes, and snippets.

@shamun
Created July 16, 2011 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamun/1086884 to your computer and use it in GitHub Desktop.
Save shamun/1086884 to your computer and use it in GitHub Desktop.
public class ButtonTest extends JWindow {
public static P p = null;
private static JFrame frame;
private SoftJButton softButton1;
private SoftJButton softButton2;
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
ButtonTest j = new ButtonTest();
j.createAndShowGUI();
t.init();
p = P.l("webcame here");
X.setWindowID(j);
p.play();
}
});
}
public void createAndShowGUI() {
this.setLayout (new BorderLayout ());
this.setBounds(100,30,600, 600);
softButton1 = new SoftJButton("Transparent Button");
softButton2 = new SoftJButton("Transparent Button");
softButton1.setBackground(Color.GREEN);
this.setBackground( new Color(0, 0, 0, 255) );
add(softButton1);
add(softButton2);
this.setVisible(true);
softButton1.setAlpha(.05f); // on press flicking
softButton2.setAlpha(.05f); // on press flicking
}
}
1) The JWindow() or Window() is having a attachment with webCam (progressive scan)
2) When Swing button JButton() is used it start flicking and does not work, but Awt Button() works, in that case only is the issue to put image
3) Transparent can be done with JPanel() but not Panel()
Mixing Awt and Swing solves it, but would be nice to do it in Swing only. Already you can see its not working. Where 20 frames per second crash the JButton visibility and creates flicking problem
Hope its very clear? Please let me know if you can find solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment