java - When updating JLabel, previous text stays, and old text is placed on top of it -
so, i'm making program, , on program, displays health in format:
health : 82/82 when take damage, ask program update jlabel, , display took damage this
health: 60/82 the jlabel public variable, , being created once,
public jlabel uihealth = new jlabel(); and on updated below code. here code use update uihealth jlabel updating text after action occures:
uihealth.settext("health: "+health+"/"+playerhealthbar.getmaximum()+""); is there simpler way display text updated? matter frame , panels set transparent see image behind acts hud? here code applied transparent, still interactive.
public color clear = new color(0,0,0,0); and of course call clear when using .setbackground component.
here image of after taking bit of damage (4-5 hits) looks on ui. (take note of how text stacks on top of itself)

thanks in advance time. please let me know , ask me if seems unclear, or need other snippets of program.
you have jpanel adding label to. need call mypanel.setopaque(false); after creating it.
Comments
Post a Comment