How coud I create these kind of Button using Java Swing? -


i want create button without borders or shadow, icon instead using java swing component. how can accomplish this?

image

real button

jbutton btnnewbutton = new jbutton(""); btnnewbutton.setcontentareafilled(false); btnnewbutton.setborderpainted(false); btnnewbutton.setborder(null); btnnewbutton.seticon(new imageicon(path)); 

this give real button without borders around given image work with. note in state button doesn't have "click animation" anymore. such animation use .setselectedicon(selectedicon);

clickable image

imageicon img = new imageicon(path); jlabel button = new jlabel(img); button.addmouselistener(new mouseadapter() {     public void mouseclicked(mouseevent e) {         //set pressed or else     } }); 

but 1 provide clickable image , should used when clickable image without other intentions needed. note way workaround.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -