please me on how to insert a picture am new to netbeans

package LibraryDatabase;

import static javax.swing.JOptionPane.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class PostLibraryDatabase extends JFrame implements ActionListener {
    JTextField firstName, surName, id, serialNumber, category, dateToday, coverTitle, isbnNumber,
		       authoursName, coAuthoursName, pubDate, loanDate, returnedDate, email, details;
    JButton writeBtn, displayBtn, exitBtn ;
    DBHandler db = new DBHandler();

    public static void main(String[] args) {
        new PostLibraryDatabase();
    }

    public PostLibraryDatabase() {
        setLayout(new BorderLayout());
// text Field


                firstName = new JTextField(16);
                surName = new JTextField(17);
                id = new JTextField(10);
		serialNumber = new JTextField(18);
		category = new JTextField(21);
		dateToday = new JTextField(8);
		coverTitle = new JTextField(25);
		isbnNumber = new JTextField(30);
		authoursName = new JTextField(16);
		coAuthoursName = new JTextField(17);
		pubDate = new JTextField(8);
		loanDate = new JTextField(8);
		returnedDate = new JTextField(8);
	    email = new JTextField(27);
	    details = new JTextField(48);


        writeBtn = new JButton("Write to database");
        displayBtn = new JButton("Display database");
        exitBtn = new JButton("Exit database");


// position top XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        JPanel top = new JPanel();

        top.add(new JLabel("First name:"));
        top.add(firstName);
        top.add(new JLabel("Surname:"));
        top.add(surName);
        top.add(new JLabel("Library ID:"));
        top.add(id);

        add("North", top);
// position center
        JPanel middle = new JPanel();
        middle.add(new JLabel("Category name:"));
        middle.add(category);
        middle.add(new JLabel("Cover Title:"));
        middle.add(coverTitle);
        middle.add(new JLabel("Today's Date:"));
        middle.add(dateToday);
        middle.add(new JLabel("                            ISBN Number:"));
        middle.add(isbnNumber);
        middle.add(new JLabel("Authours Name(s):"));
        middle.add(authoursName);
        middle.add(new JLabel("                  Co - Authours Name(s):"));
        middle.add(coAuthoursName);
		middle.add(new JLabel("Serial Number:"));
        middle.add(serialNumber);
		middle.add(new JLabel("   Dated Published :"));
        middle.add(pubDate);
		middle.add(new JLabel("      Loan Date:"));
        middle.add(loanDate);
		middle.add(new JLabel("Returned Date:"));
        middle.add(returnedDate);
		middle.add(new JLabel("             Borrowers E-mail Address:"));
        middle.add(email);
		middle.add(new JLabel("Book / Magazine Details:"));
        middle.add(details);

        add("Center", middle);

// position center
        JPanel bottom = new JPanel();

        bottom.add(writeBtn);
        bottom.add(displayBtn);
	bottom.add(exitBtn);
        add("South", bottom);
        add("West", new JPanel());
        add("East", new JPanel());


        writeBtn.addActionListener(this);
        displayBtn.addActionListener(this);
        exitBtn.addActionListener(this);

        setSize(730, 450);
        setTitle("Post Library Database");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
        setResizable(false);
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == writeBtn) {
            String f = firstName.getText();
            String s = surName.getText();
            String z = id.getText();
            String a = serialNumber.getText();
            String b = category.getText();
            String c = dateToday.getText();
            String d = coverTitle.getText();
            String g = isbnNumber.getText();
            String h = authoursName.getText();   
            String i = coAuthoursName.getText();
            String k = pubDate.getText();
            String l = loanDate.getText();
            String m = returnedDate.getText();
            String n = email.getText();
            String o = details.getText();


// XXXXXX if any field is blank, signal an error XXXXXXXXXXXXXXX
            if (f.equals("") || s.equals("") || i.equals("")) {
                showMessageDialog(this, "One or more fields blank");
                return;
            }
            boolean ok = db.write(z, s, f, a, b, c, d, g, h, i, k, l, m, n, o);
            id.setText("");
            if (!ok) showMessageDialog(this, "Duplicate key " + id);
            else {
                firstName.setText("");
                surName.setText("");
                serialNumber.setText("");
                category.setText("");
                dateToday.setText("");
                coverTitle.setText("");
                authoursName.setText("");
                coAuthoursName.setText("");
                loanDate.setText("");
                returnedDate.setText("");
                email.setText("");
                details.setText("");
            }
        }
        if (e.getSource() == displayBtn) db.displayUsers(System.out);
    }
}

If you want to add a picture at the GUI, you need to look at the API of the JLabel class.
It has a constructor that takes as argument an Icon. Or you can the method: setIcon. From the API the argument (Icon) is an interface, so you need to look at the class ImageIcon that implements the Icon interface.

So create an ImageIcon instance with your image and put it to a JLabel. Then display that JLabel.

thanx alot. Gud day

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.