Re: UI update, prep for round 2: In-game UI feature requests
1.0f doesn't work. It looks just the same as without an AlphaComposite.Doublestrike wrote:Oooh that's a good clue. Alpha composite is the transparency of the button. It's dropped down to 25% for disabled buttons. Maybe the buttons aren't showing because a composite isn't defined for them...so your code would work, but should use 100% opacity (1.0f).slapshot5 wrote:If I create a AlphaComposite and specifically assign it to enabled, the buttons become somewhat readable:
- Code: Select all
private AlphaComposite enabledComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.75f);
From that clue, could you try this - in the inits section:In the paintComponent override:
- Code: Select all
private AlphaComposite disabledComposite =
AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.25f);
private AlphaComposite defaultComposite =
AlphaComposite.getInstance(AlphaComposite.SRC_OVER,1.0f);
- Code: Select all
if(!isEnabled()) {
g2d.setComposite(disabledComposite);
}
else {
g2d.setComposite(defaultComposite);
}
-slapshot5