Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Transparent background in javafx StackPane

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody, I am trying to make my StackPane completely transparent with non transparent content. I have already tried to set a background color with rgb(255,255,255,0) to that pane, but it still having a white background and I can not find out why? I am using embed javafx to swing so I am setting a transparent scene to a JFXPanel like that:

the result:
img
If enybody knows how to solve this issue, can give me a hand with it? Thanks in advance)))
 
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you really need to use embedded Swing?
If you can write a pure JavaFX application then you can achieve the desired effect, transparent panes with non-transparent children with no issue.
See:
http://stackoverflow.com/questions/12717487/how-to-implement-a-transparent-pane-with-non-transparent-children

You may wish to supply a complete example (sscce), that replicates the issue.
See:
http://sscce.org

You don't need to set the background or opaque properties of the JFXPanel, because, regardless JFXPanel isOpaque will always return false, so these two settings will be ignored.
See:
https://docs.oracle.com/javase/8/javafx/api/javafx/embed/swing/JFXPanel.html#isOpaque--

I did some quick testing and drawing a JFXPanel over a Swing panel which has an opaque background works fine. Drawing it over a Swing panel which has a translucent background seems to double the underlying background color in the JFXPanel background (as you have in your image). I don't really have a solution to this. It may be a bug in the JFXPanel implementation, which you could log at http://bugreport.java.com.

Here is the test program I used:

 
Water proof donuts! Eat them while reading this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic