#JPanel Set Background color prints a copy of a seperate button.

1 messages · Page 1 of 1 (latest)

versed haloBOT
#

<@&987246487241105418> please have a look, thanks.

versed haloBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

fluid geyser
#

hm, could you show the code?

#

especially the part, where you insert this data into a function

brisk stream
#

b1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
try {
int r, g, b, a;

           r=Integer.parseInt(tf1.getText());
           b=Integer.parseInt(tf2.getText());
           g=Integer.parseInt(tf3.getText());
           a=Integer.parseInt(tf4.getText());
           
            Color c = new Color(r, g, b, a);

           
          p6.setBackground(c);
        }
        catch (NumberFormatException ex) {
          
       }
      }
    });
fluid geyser
#

And what excactly happens?

#

exactly*

brisk stream
#

the bottom of the calculator should change color, which it does

#

im just confused as to why theres a button and a textfield when i add the alpha

#

could it just be a visual glitch? cause it goes away when i open and minimize the app

fluid geyser
#

do you use repaint(); / revalidate(); ?

brisk stream
#

im not really sure what that is , sorry

fluid geyser
#

it basically refreshes your window

#

if you changed anything on it you should use one of these, depending on what you changed

brisk stream
#

no i just minimize and maximize it using the app and it goes away

fluid geyser
#

yea, try repaint(); for the window after you changed the components

brisk stream
fluid geyser
#

well if you are happy with that you can leave it i guess

brisk stream
#

i don't get why it's doing it tbh, i think its a visual glitch on my computer

#

ill try running it on my mac to see if its any different