java - How i can create button as shown in picture? -


enter image description here

how can create dynamic component shown in picture? component image change @ run time. component border , backgrond color should changable @ run time.

you can create button below,

jbutton button = new jbutton();  try {     image img = imageio.read(getclass().getresource("resources/water.bmp"));     button.seticon(new imageicon(img)); } catch (ioexception ex) {     //catch exceptions } 

you can call

button.seticon(new imageicon(img)); 

to change button image @ run time.

you can call

button.setbackground() 

to change background @ runtime.

have @ jbutton documentation more information.


Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

javascript - How to change image src on success AJAX -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -