How To Make A login Forum in java ,  How To Make A login Forum in netbean


How To Make A login Forum in java ,
How To Make A login Forum in netbean    
















import java.awt.BorderLayout;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.ImageIcon;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import javax.swing.JTextField;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class MyFrame extends JFrame {

    private MyPannel contentPane;
    private JTextField tfname;
    private JTextField tfpassword;
   

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    MyFrame frame = new MyFrame();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the frame.
     */
    public MyFrame() {
        setResizable(false);
        setTitle("Login ");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 597, 535);
       
        JMenuBar menuBar = new JMenuBar();
        setJMenuBar(menuBar);
       
        JMenuItem mntmNewMenuItem = new JMenuItem("Exit");
        mntmNewMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });
        mntmNewMenuItem.setSelected(true);
        menuBar.add(mntmNewMenuItem);
        contentPane = new MyPannel();
        contentPane.setBackground(new Color(60, 179, 113));
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);
       
        JLabel lblUsername = new JLabel("Username");
        lblUsername.setBackground(new Color(100, 149, 237));
       
        lblUsername.setBounds(332, 239, 149, 33);
        contentPane.add(lblUsername);
       
        tfname = new JTextField();
        tfname.setBackground(new Color(135, 206, 250));
   
        tfname.setBounds(329, 282, 196, 33);
        contentPane.add(tfname);
        tfname.setColumns(10);
       
        JLabel lblPassword = new JLabel("Password");
        lblPassword.setBackground(new Color(100, 149, 237));
        lblPassword.setBounds(332, 339, 149, 33);
        contentPane.add(lblPassword);
       
        tfpassword = new JTextField();
        tfpassword.setBackground(new Color(135, 206, 250));
        tfpassword.setColumns(10);
        tfpassword.setBounds(329, 383, 196, 33);
        contentPane.add(tfpassword);
       
        JButton btnSignIn = new JButton("Sign In");
        btnSignIn.setBackground(new Color(169, 169, 169));
        btnSignIn.addActionListener(new ActionListener() {
               
                public void actionPerformed(ActionEvent arg0) {
                    String username ="admin"; String password =  "admin";
                if (tfname.getText().equals(username) && tfpassword.getText().equals(password))
                   
                   
                {    JOptionPane.showMessageDialog(null, "Welcome in Your Account");
                }
                else
                    JOptionPane.showMessageDialog(null, "You enter Incorrect name & Password . Please check Again");
           
            }
        });
        btnSignIn.setBounds(333, 447, 108, 33);
        contentPane.add(btnSignIn);
       
        JSeparator separator = new JSeparator();
        separator.setForeground(new Color(0, 100, 0));
        separator.setBounds(276, 516, 11, -528);
        contentPane.add(separator);
       
        JLabel label = new JLabel("");
        label.setIcon(new ImageIcon("C:\\Users\\HS_Developer\\Pictures\\images.jpg"));
        label.setBounds(10, 48, 214, 252);
        contentPane.add(label);
        }

}

Reviews:

Post a Comment

OwnMaterial © 2014 - Designed by Templateism.com, Plugins By MyBloggerLab.com Published By Kaizen Template - Support KaizenThemes

Contact us

Powered by Blogger.