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?
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
Post a Comment