Membuat form di java itu gampang-gampang susah, soalnya gak bisa drag n drop seperti pada VB, jadi harus ngoding secara manual.
pertama-tama tambahkan librarynya bisa pake java.awt atau javax.swing, nah permasalahnya adalah harus mulai dari mana?? membuatnya??
gambar disamping contoh penggunaan java.awt dengan ditambah gambar.
package form;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.*;
public class Form extends Frame implements WindowListener{
String nm = "pic/bis.jpg";
Image gbr =
Toolkit.getDefaultToolkit().getImage(nm);
@Override
public void paint(Graphics g){
setTitle("Form Gambar");
addWindowListener(this);
g.drawImage(gbr, 1, 50, 400, 240, this);
g.drawString("Gambar 1. 400 x 240 px", 130,251);
g.drawImage(gbr, 500, 60, 200, 120, this);
g.drawString("Gambar 2. 200 x 120 px", 530,190);
g.drawImage(gbr, 300, 300, 300, 140, this);
g.drawString("Gambar 3. 300 x 140 px", 380,440);
}
public static void main (String [] args){
Frame f = new Form();
f.setSize(800, 500);
f.setVisible(true);
}
@Override
public void windowOpened(WindowEvent e){}
@Override
public void windowClosing(WindowEvent e){System.exit(0);}
@Override
public void windowClosed(WindowEvent e){}
@Override
public void windowIconified(WindowEvent e){}
@Override
public void windowDeiconified(WindowEvent e){}
@Override
public void windowActivated(WindowEvent e){}
@Override
public void windowDeactivated(WindowEvent e) {}
}
Project Netbeans
Download Example