Hello I'm tring to creat a specific Look in my Java JUI but my code is giving me errors when I try and launch it.
Here is my code please take a look and tell me where i'm going wrong. Its a simple login interface for my program:

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

public class LoginPane {
    private static void createAndShowGUI() {
        JLabel NLabel;
        JLabel PWLabel;
        JTextField NField;
        JTextField PWField;
        JLabel DBLabel;
        JTextField DBField;
        JButton SButton;

        //--Create my content frame
        JFrame pwFrame = new JFrame ("Username and Password");
        pwFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //--My Content Frame
        pwFrame.setPreferredSize(new Dimension(300, 200));
        pwFrame.getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
        pwFrame.getContentPane().setLayout(null);


        //--Creating all my Labels
        NLabel = new JLabel("Name: ");
        PWLabel = new JLabel("Password: ");
        DBLabel = new JLabel("Data Base URL");

        //--Creating all my Fields
        NField = new JTextField("Enter Name");
        PWField = new JTextField("Password");
        DBField = new JTextField("Place your url here");


        //--Creating Buttons
        SButton = new JButton("Submit");

        //--Adding Components
        pwFrame.getContentPane().add(NLabel);
        pwFrame.getContentPane().add(PWLabel);
        pwFrame.getContentPane().add(NField);
        pwFrame.getContentPane().add(PWField);
        pwFrame.getContentPane().add(DBLabel);
        pwFrame.getContentPane().add(DBField);

        SButton = new JButton("Submit");
        pwFrame.getContentPane().add(SButton);

        // setSize(getPreferredSize());

        pwFrame.addWindowListener(new WindowAdapter() {
            //public void windowClosing(WindowEvent e) {
            //System.exit(0);



        });
    }

    public static void main(String[] args[]) {
        /**Schedule a job for the event-dispatching thread:
        *creating and showing this application's GUI.*/
        javax.swing.SwingUtilities.invokeLater(new Runnable(){
            public void run() {
                createAndShowGUI();
            }
        });

    }
}

class LoginpaneLayout implements LayoutManager {

    public LoginpaneLayout() {
    }

    public void addLayoutComponent(String name, Component comp) {
    }

    public void removeLayoutComponent(Component comp) {
    }

    public Dimension preferredLayoutSize(Container parent) {
        Dimension dim = new Dimension(0, 0);

        Insets insets = parent.getInsets();
        dim.width = 355 + insets.left + insets.right;
        dim.height = 283 + insets.top + insets.bottom;

        return dim;
    }

    public Dimension minimumLayoutSize(Container parent) {
        Dimension dim = new Dimension(0, 0);
        return dim;
    }

    public void layoutContainer(Container parent) {
        Insets insets = parent.getInsets();

        Component c;
        c = parent.getComponent(0);
        if (c.isVisible()) {c.setBounds(insets.left+16,insets.top+32,120,32);}
        c = parent.getComponent(1);
        if (c.isVisible()) {c.setBounds(insets.left+16,insets.top+80,120,32);}
        c = parent.getComponent(2);
        if (c.isVisible()) {c.setBounds(insets.left+152,insets.top+32,184,32);}
        c = parent.getComponent(3);
        if (c.isVisible()) {c.setBounds(insets.left+152,insets.top+80,184,32);}
        c = parent.getComponent(4);
        if (c.isVisible()) {c.setBounds(insets.left+80,insets.top+136,192,32);}
        c = parent.getComponent(5);
        if (c.isVisible()) {c.setBounds(insets.left+16,insets.top+184,312,40);}
        c = parent.getComponent(6);
        if (c.isVisible()) {c.setBounds(insets.left+112,insets.top+232,120,32);}
    }
}//end code

your code is giving errors ... and what errors might that be?

Also you are using the standard laout manager with Swing. How do you want to see the app layout, can you draw or show us a pic or something how you want to see your layout so that we can assist you?

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.