View: 2146|Reply: 9
|
kod java utk masukkan gmbr
[Copy link]
|
|
cane ehh nak masukkan image gune kod java??sapa tau?plss..
|
|
|
|
|
|
|
|
JLabel l1;
Icon img=new ImageIcon("your_image.gif" );
l1=new JLabel(img);
ko nak yg mcm ni ke |
|
|
|
|
|
|
|
huhu..
xdpt laa plak..
your_image.gif tu nama file ke? |
|
|
|
|
|
|
|
Reply #4 kupu2siang's post
pastikan letak dalam satu folder yg sama.
baru ko run program... |
|
|
|
|
|
|
|
dah dpt dah..
tenkiu..
er...kalao nak tukar size button cane lak ehh.. |
|
|
|
|
|
|
|
Reply #6 kupu2siang's post
JButton demo;
demo=new JButton(" orang_letrik" );
demo.setBounds(x1,y1,x2,y2);
kalo ko guna applet...guna macam biasa je
kalo ko guna frame...initialize JButton kat luar frame. tp ikut ko la.
mana yg ko suka...hehe |
|
|
|
|
|
|
|
leh terangkan x x1, y1 tu? |
|
|
|
|
|
|
|
Reply #8 kupu2siang's post
x1--------------------------x2
| |
| |
| |
y1--------------------------y2
contoh kat atas yang aku buat secara manual ni ko akan paham.
ala... x1,y1... semua tu melambangkan koordinat.
makin besar ko bagi nilai...semakin besar jugak la button yg akan ko dapat.
[ Last edited by orang_letrik at 15-8-2007 02:22 AM ] |
|
|
|
|
|
|
|
ow..ok..tenkiu org letrik.. |
|
|
|
|
|
|
| |
|