#JPanel Set Background color prints a copy of a seperate button.
1 messages · Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
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.
hm, could you show the code?
especially the part, where you insert this data into a function
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) {
}
}
});
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
do you use repaint(); / revalidate(); ?
im not really sure what that is , sorry
it basically refreshes your window
if you changed anything on it you should use one of these, depending on what you changed
no i just minimize and maximize it using the app and it goes away
yea, try repaint(); for the window after you changed the components
well if you are happy with that you can leave it i guess