Swing application

Swing application

Hello, I want to develop a Swing application similar to J2EE application.The only difference is that, the users will access the application not through web browsers, instead through a Swing desktop application GUIs. Please help me to develop such an application.

View Answers

May 28, 2011 at 10:20 AM

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

class LoginDemo extends JFrame{
 JButton SUBMIT;
 JLabel label1,label2;
 final JTextField  text1,text2;
  LoginDemo(){
    setTitle("Login Form");
    setLayout(null);
    label1 = new JLabel();
    label1.setText("Username:");
    text1 = new JTextField(15);

    label2 = new JLabel();
    label2.setText("Password:");
    text2 = new JPasswordField(15);

    SUBMIT=new JButton("SUBMIT");
    label1.setBounds(350,100,100,20);
    text1.setBounds(450,100,200,20);
    label2.setBounds(350,130,100,20);
    text2.setBounds(450,130,200,20);
    SUBMIT.setBounds(450,160,100,20);
    add(label1);
    add(text1);
    add(label2);
    add(text2);
    add(SUBMIT);

   setVisible(true);
   setSize(1024,768);

 SUBMIT.addActionListener(new ActionListener(){
   public void actionPerformed(ActionEvent ae){
    String value1=text1.getText();
    String value2=text2.getText();
    try{
    Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from login where username='"+value1+"' and password='"+value2+"'");
           int count=0;
           while(rs.next()){
               count++;
           }
 if(count>0){
       JOptionPane.showMessageDialog(null,"Welcome: "+value1);
       }
 else {

     JOptionPane.showMessageDialog(null,"Error!");
     text1.setText("");
     text2.setText("");
     }
    }
    catch(Exception e){}
}
 });
  }
  public static void main(String arg[]){
  new LoginDemo();
}
}









Related Tutorials/Questions & Answers:
Swing application
Swing application  Hello, I want to develop a Swing application... the application not through web browsers, instead through a Swing desktop application GUIs. Please help me to develop such an application
Swing Application
Swing Application  hello, i am making swing application in java i am unable to run prog......when my rite clikcing on my project name and clicking thn run it is not showing output .....and when i am cliking on individual java
Advertisements
Combobox application - Swing AWT
Combobox application  hi, i am facing a problem in updation of the comboboxes i m using in an application...for the first time the selectec item does... function...please suggest...  Is it Swing ? If not using
Swing Application help
Swing Application help  Hi am developing an application. I have set up an ADD button, which if clicked should open the add information form...;Here is a swing application that will insert the form data into database
catching tomcat object to swing application
catching tomcat object to swing application  Hi, I have 2 java projects, one is running on tomcat server and another is at client pc ie swing application. So I need to catch a server side object from swing application. How can I
swing application to import a object in a excel
swing application to import a object in a excel  Hi sir, I want to make a swing application where I can import a object in a cell of a excel... 'create from file' window>browse (this browse path I want to give inside the swing
Threads in Java Swing MVC Application
Threads in Java Swing MVC Application  Hello, I am currently making a Java Swing application, but I am having a lot of trouble with implementing threads into my program. I use the MVC paradigm and I just can't seem to implement
Changing Look and Feel of Swing Application
Changing Look and Feel of Swing Application  ... and feel for your Swing Application. The look and feel feature of Java Swing provides more interactivity of the frame for user application. Swing allows
Retrieve data from database in swing application
Retrieve data from database in swing application  I want to retrive data(doctor name,specilization,date) from my sql database. ............................................................................ doctors name(JLabel1
Linking excel file with a application tool using swing
Linking excel file with a application tool using swing  I have to link an excel file with my application software using java swing.As soon as i click on the link button a window should open for selecting the excel file(just like
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to run java swing application from jar files .
How to run java swing application from jar files .  Hello Sir, I developed a java swing application .Now i want to execute it as .exe setup file .As per my knowledge i have to run .jar file from dist folder
Opening IE from Java Swing Application in Kiosk mode
Opening IE from Java Swing Application in Kiosk mode  Hi All, I want to open a URL in IE from my Java Swing application running in Wiindows. I am... in swing application. class OpenBrowser { public static void main(String[] args
SWING
SWING  A JAVA CODE OF MOVING TRAIN IN SWING
steps to create desktop application in java swing using eclipse with drag and drop options
steps to create desktop application in java swing using eclipse with drag and drop options  please help to create desktop application in java swing using eclipse with drag and drop and what are the plugins required
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
How to link an excel file with the application software using java swing
How to link an excel file with the application software using java swing  I have to link an excel file with a application software which I am developing.The excel file will contain questionnaire for surveys.I have this code which
Chess Application In Java Swing
.style1 { margin-right: 0px; } Chess Application In Java Swing       In this section, you will learn how to create chess game in java swing
swing
swing  Write a java swing program to delete a selected record from a table
swing
swing  How to make swing component auto-resizable when JFrame resize
Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those students having same name as in given in searching criterion will be displayed
Swing
Swing  Write a java swing program to search the details of the students. Searching is performed on studentā??s first name. The details of all those students having same name as in given in searching criterion will be displayed
swing
swing  i wanted to create a gui desktop application .that can take the database name and mysql password from text box, and after the click of a button it should show connection status,and go for next from there on button click
How to send and view data in seperate tables of a swing application, to a japser reporting(two)
How to send and view data in seperate tables of a swing application, to a japser reporting(two)  I have 2 tables in one swing user interface. I want to view and get printed them in a jasper report. In the jasper report
How to send and view data in seperate tables of a swing application, to a japser reporting(two)
How to send and view data in seperate tables of a swing application, to a japser reporting(two)  I have 2 tables in one swing user interface. I want to view and get printed them in a jasper report. In the jasper report
What is Swing?
What is Swing?  What is Java Swing? Where to get the tutorials of Swing? I am beginner in Java Swing programming and trying to find the tutorials of Swing. Tell me the urls to learn swing. Thanks   Hi, Swing is Java
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all thanx and congratulations to u all guys for helping programmers like us who
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all thanx and congratulations to u all guys for helping programmers like us who
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all thanx and congratulations to u all guys for helping programmers like us who
swing - Java Beginners
Swing application testing  What are the conventions for testing a Java swing application
swing-awt - Swing AWT
swing-awt  Hi, Thanks for replying to my question...I'm getting some confusion to add action events in my application(Rich Text Editor).How to add action events? Thank U
Swing EJB
Swing EJB  Hi everyone !!! I tried to find wether EJB architecture can operate with swing, because I am trying to make application which would work... with webstart so a client with one click can download some swing application which
java swing - Swing AWT
java swing  how i can insert multiple cive me exampleolumn and row in one JList in swing?plz g  Hi Friend, Please clarify your question. Thanks
swing/awt - Swing AWT
swing/awt  How to create richtexteditor using swings...?I'm very much new to swings....It's urgent.....Thank u...   hello read this book you get idea; JFC Swing Tutorial, The: A Guide to Constructing GUIs, Second
Swing paint - Swing AWT
Swing paint  hi, i want to print something on window using swing applet.. m doing dis.. protected void paintComponent(Graphics g... the Swing Applet, use html file with the following code: Java Applet Demo
swing sms
swing sms  HOW TO SEND SMS MESSAGE FROM SWING USING SQL DATABASE
Swing Program
Swing Program  Write a java swing program to calculate the age from given date of birth
SWING FRMES
SWING FRMES  hai SIR? HOW TO DESIGN swing Frames send source code
SWING FRMES
SWING FRMES  hai SIR? HOW TO DESIGN swing Frames send source code
swing to applet
swing to applet  hi how i can isplay a java swing into applet java thanks
java swing and CSS
java swing and CSS  can css be used in java swing desktop application in different forms for better styles?plzz help
swing with jdbc - Swing AWT
swing with jdbc  Hi, i m developing the desktop application using swing.i want to use table structure for that.also its DB specific application. i have some problems with swing using jdbc. 1. the values entered in table
java swing - Swing AWT
java swing   how i can insert in JFrame in swing?  Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class FormDemo extends JFrame { JButton ADD; JPanel
java swing - Swing AWT
java swing  how to add image in JPanel in Swing?  Hi Friend, Try the following code: import java.awt.*; import java.awt.image....: http://www.roseindia.net/java/example/java/swing/ Thanks
Java swing
Java swing  what are the root classes of all classes in swing
Java swing
Java swing  Does Swing contains any heavy weight component
AWT & SWING
AWT & SWING  What is diffennce between AWT & SWING

Ads