how to draw java chat Bubble speech? -
hello every 1 pls me , trying to
make java desktop app chatting
,i want add chat representation in chat application's make ui style messages bubble speech conversation want draw java code enter image description here pls me code or how draw java code , first post in https://stackoverflow.com/ thank
judging question , time here take not experienced java (i mean no offence).
instead can did, worked fine such situation:
i created jlabel, , assigned imageicon, in code example below see me creating 2 labels used buttons, 1 , 1 down arrow list:
private void buildpair() { //make imageicon array (optional) imageicon image[] = new imageicon[2]; //you create new imageicon picture recouses, the image , scale it, in case scaled 20 20 pixel image originaldown = new imageicon(extendedlist.class.getresource("/elements/down arrow button.png")).getimage().getscaledinstance(20, 20, image.scale_default); image originalup = new imageicon(extendedlist.class.getresource("/elements/up arrow button.png")).getimage().getscaledinstance(20, 20, image.scale_default); //then add scaled images new imageicon , add imageigon arrat image[0] = new imageicon(originaldown); image[1] = new imageicon(originalup); //using external jlabel array assing new jlabel imageicon buttonpair[0] = new jlabel(image[0]); //i add custom event class, can make own method or leave out if not needed buttonpair[0].addmouselistener(events); //and lastly add form this.add(buttonpair[0]); //and repeat many times need buttonpair[1] = new jlabel(image[1]); buttonpair[1].addmouselistener(events); this.add(buttonpair[1]); }
do not forget import:
import java.awt.image; import javax.swing.imageicon; import javax.swing.jlabel;
Comments
Post a Comment