Académique Documents
Professionnel Documents
Culture Documents
TEAM MEMBERS
1.
ARSH VARDHAN ATREYA =>Analysis, Coding & Documentation ABHISHEK =>Information Gathering & Feasibility Study HIMANSHU NATH =>Synopsis Preparation & Documentation ABDUL SUBHAN KHAN =>Coding & Analysis SANJEEV KUMAR SINGH =>Design &Testing ASHUTOSH KUMAR MAURYA =>Analysis & Coding UMESH CHANDRA KATIYAR =>Information Gathering ANKUR TYAGI =>Information Gathering ANOOP KUMAR MAURYA =>Feasibility Study SINGH
2.
3.
4.
5.
6.
7.
8.
9.
10. UPENDRA
=>Information Gathering
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 1
1. Introduction 2. Problem Description 2.1 Objective in brief 3. Statement of scope 3.1 Scope of system 3.2 Information objective For Students 3.3 Function and Performance 4. Project Plan 4.1 Overall Description of Project 4.2 Project Characteristics 4.3 Project Constraints 4.4 Assumptions 4.5 Methodology 4.5.1 Software Process Model 4.6 Risk Identification 3.6.1 Taxonomy of Risks 4.7 Time Estimates 5. System Requirement Specification 5.1 Behavioral Description 5.2 Function Description 5.3 Data Description 5.4 Test Description 6. Analysis and Modeling 6.1 Representation of System Analysis 6.1.1 Structured Analysis 6.1.2 Data Analysis 6.2 Software Requirement Specification 6.2.1 Environmental Description 6.2.2 Architectural Description 6.2.3 User Interface Description 6.2.4 Security 6.3 Testing
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 2
7. Design 7.1 Data Design 7.2 Test Case Design 8. Coding 9. Screen Shots 9.1. To run the software
9.2. Login form 9.3. Login Failed Message 9.4. Add Record Tab 9.5. Adding Record of Student 9.6. Modify/Delete Record Tab 9.7. Deletion of Record 9.8. Updation of Records 9.9. Retrieving Sudents Detail from Database 9.10 Fees Submission 9.10.1 Submitting Fees Tab 9.10.2 Submitting Fees 9.11. Three types of view styles 10. Bibliographic References
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 3
1. INTRODUCTION
The requirement of the institute is to automate the Registration of students and maintains the details about personal, fees and academic records of students.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 4
2. PROBLEM DESCRIPTION
There are a lot of Institutes and the Branches of the courses. Hundreds of students are with in an institute; therefore it is too difficult to maintain all information about all students in papers or registers. In papers we cant maintain updating and deletion properly. Because there should be a primary key to maintain records and if updating takes place then some information changes which should be updated on same registration number, which is held well by automated systems rather than on papers. Another problem is that it is too difficult to search details of students on papers and also waste too much paper to maintain details. So, in order to save the valuable time of the office employee as well as of the student to know about their status it is decided to automate the whole process of student records. In view of the above mentioned facts the department is an ideal model for computerization.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 5
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 6
3. STATEMENT OF SCOPE
3.1 SCOPE OF SYSTEM
The scope of the work is to carry out the System Requirement Study (SRS) for the Entrance Department of the university. The study will provide as part of the System Requirement Study (SRS). 1) Total solution packages that will be necessary to setup and implement Database. 2) Requirement of Hardware, Software and communication infrastructure with their specifications/ technologies required for setting up the network and the associated database so as to retrofit the existing IT infrastructure. 3) Software requirement for creation and maintenance of the Database. 4) Detail the program modules, which will be required to be developed for the clients. 5) Time frame required for designing, coding, implementation and testing of the software/system that will be required to develop the database application. 6) Data Flow Diagram.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 7
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 8
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M ANAGEMENT,GZB 9
4. PROJECT PLAN
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 10
3. The project has many procurements and stake holders; this requires adequate interfacing and interoperability techniques. This system and hence the software needs to be secure and safe.
4.4 ASSUMPTIONS
To achieve all requirements and to solve the problems, major or specific, find at earlier stage, some critical assumptions for the system are made. These assumptions are mandatory and will help in the system running and cannot be avoided. Following are the assumptions: 1. Once a case is acknowledged, all reports and remarks must be entered in the system to provide accurate information to be concerned branch.
2. Only authorized person should be able to manipulate the master database .
4.5 METHODOLOGY
The software Process is the set of activities and associated results that produce a Software Product. The Software Engineers today are faced with a challenge of producing high quality software with a finite amount of resources and to a predicted schedule. This makes the choice of a software process very important. There are four fundamental process activities which are common to all software processes. The activities are:
1. Software
specification: - The functionality of the software and constraints on its operation must be defined. 2. Software development: - The software to meet the specification must be produced. 3. Software validation: - The software must be validation ensure that it does what the customer wants. 4. Software evolution: - The software must evolve to meet changing customer needs.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 11
There is no such thing as a right or wrong software process. Different software processes decompose these activities in different ways. However, some processes are more suitable then others for some types of applications. There are a number of different general models or paradigms of software development: The Waterfall Approach Evolutionary Development Boehms Spiral Model Formal Transformation System Assembly from Reusable Components
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 12
The Waterfall Model is the earliest method of structured system development. Although it has come under attack in recent years for being too rigid and unrealistic when it comes to quickly meeting customer's needs, the Waterfall Model is still widely used. 1) Software Requirement Analysis- Software Requirement Analysis phase, the development team visits the customer and studies their system requirement. After feasibility study, the development team provides a document that holds the different specific recommendations for the candidate system. It also I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 13
consists of personnel assignments, costs of the system, project schedule and target dates. 2) System Analysis and Design -In System Analysis and Design phase, the whole software development process, the overall software structure and its outlay are defined. In case of the client/server processing technology, the number of tiers required for the package architecture, the database design, the data structure design etc are all defined in this phase. Analysis and Design are very important in the whole development cycle process. In this phase, the logical system of the product is developed. 3) Code Generation - In Code Generation phase, the design must be decoded into a machine-readable form. If the design of software product is done in a detailed manner, code generation can be achieved without much complication. The right programming language is chosen according to the type of application. 4) Integration and Testing - After code generation phase the software program testing begins. A number of testing tools and methods are already available for testing purpose. 5) Operation and Maintenance - Software will definitely go through change once when it is delivered to the customer. There are large numbers of reasons for the change. Change could happen due to some unpredicted input values into the system. The software should be implemented to accommodate changes that could be happen during the post development period.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 14
The linear sequential model, also known as classic life cycle or waterfall model, suggest a systematic, sequential approach to software development that designs at the system level and progresses through analysis, design, coding, testing and support.
Analysis
Design
Code
Test
System/Information engineering and modeling: Because software is always part of a larger system, work begins by establishing requirements for all system elements and then allocating some subset of these requirements to software. This system view is essential when software must interact with other elements such as hardware, people, and databases. System engineering and analysis encompass requirements gathering at the system level with a small amount of top level design and analysis. Information engineering encompasses requirements gathering at the strategic business level and at the business area level. Software Requirement Analysis: The requirements gathering process is intensified and focused specifically on software.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 15
Requirements for both the system and the software are documented and reviewed with the customer. Design: Software design is actually a multi step process that focuses on four district attributes of a program: data structure, software architecture, interface representations, and procedural (algorithmic) detail. The design process translates requirements into a representation of the software that can be assessed for quality before coding begins. Like requirements, the design is documented and becomes part of the software configuration. Code Generation: The design must be translated into machinereadable form. The code generation step performs this task. If design is performed in a detailed manner, code generation can be accomplished mechanistically. Testing: Once code has been generated, program testing begins. The testing process focuses on the logical internals of the software, ensuring that all statements have been tested, and on the functional externals, that is conducting tests to uncover errors and ensure that defined input will produce actual results that agree with required results. Support: Software will undoubtedly undergo change after it is delivered to the customer. Change will occur because errors have been encountered, because the software must be adapted to accommodate changes in its external environment, because the customer requires functional or performance enhancements. Software support/maintenance reapplies each of the preceding phases to an existing program rather than a new one.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 16
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 17
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 18
plans into smaller, more meaningful parts. This is very helpful if the chart has to be redrawn for any reason, such as skipped or incorrectly estimated tasks. Many PERT charts terminate at the major review points, such as at the end of the analysis. Many organizations include funding reviews in the projects life cycle. Where this is the case, each chart terminates in the funding review node. Funding reviews can affect a project in that they may either increase funding, in which case more people have to make available, or they may decrease funding, in which case fewer people may be available. Obviously more or less people will affect the length of time it takes to complete the project.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 19
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 20
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 21
Swing wouldn't be a component toolkit without the basic user interface primitives such as drag and drop, event handling, customizable painting, and window management. Swing is part of the Java Foundation Classes (JFC). The JFC also include other features important to a GUI program, such as the ability to add rich graphics functionality and the ability to create a program that can work in different languages and by users with different input devices. The following list shows some of the features that Swing and the Java Foundation Classes provide. Swing GUI Components The Swing toolkit includes a rich array of components: from basic components, such as buttons and check boxes, to rich and complex components, such as tables and text. Even deceptively simple components, such as text fields, offer sophisticated functionality, such as formatted text input or password field behavior. There are file browsers and dialogs to suit most needs, and if not, customization is possible. If none of Swing's provided components are exactly what you need, you can leverage the basic Swing component functionality to create your own. Java 2D API To make your application stand out; convey information visually; or add figures, images, or animation to your GUI, you'll want to use the Java 2D T M API. Because Swing is built on the 2D package, it's trivial to make use of 2D within Swing components. Adding images, drop shadows, compositing it's easy with Java 2D. Pluggable Look-and-Feel Support Any program that uses Swing components has a choice of look and feel. The JFC classes shipped by Sun and Apple provide a look and feel that matches that of the platform. The Synth package allows you to create your own look and feel. The GTK+ look and feel makes hundreds of existing look and feels available to Swing programs. A program can specify the look and feel of the platform it is running on, or it can specify to always use the Java look and I NSTITUTE P ROFESSIONAL E XCELLENCE M A N A G E M E N T , G Z B 22
OF
&
feel, and without recompiling, it will just work. Or, you can ignore the issue and let the UI manager sort it out. Data Transfer Data transfer, via cut, copy, paste, and drag and drop, is essential to almost any application. Support for data transfer is built into Swing and works between Swing components within an application, between Java applications, and between Java and native applications. Internationalization This feature allows developers to build applications that can interact with users worldwide in their own languages and cultural conventions. Applications can be created that accept input in languages that use thousands of different characters, such as Japanese, Chinese, or Korean. Swing's layout managers make it easy to honor a particular orientation required by the UI. For example, the UI will appear right to left in a locale where the text flows right to left. This support is automatic: You need only code the UI once and then it will work for left to right and right to left, as well as honor the appropriate size of components that change as you localize the text . Accessibility API People with disabilities use special software assistive technologies that mediates the user experience for them. Such software needs to obtain a wealth of information about the running application in order to represent it in alternate media: for a screen reader to read the screen with synthetic speech or render it via a Braille display, for a screen magnifier to track the caret and keyboard focus, for on-screen keyboards to present dynamic keyboards of the menu choices and toolbar items and dialog controls, and for voice control systems to know what the user can control with his or her voice. The accessibility API enables these assistive technologies to get the information they nee, and to programmatically manipulate the elements that make up the graphical user interface. Undo Framework API Swing's undo framework allows developers to provide support for undo and redo. Undo support is built in to Swing's text component. For other components, Swing supports an unlimited number of actions to undo and redo, and is easily I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 23
adapted to an application. For example, you could easily enable undo to add and remove elements from a table. Flexible Deployment Support If you want your program to run within a browser window, you can create it as an applet and run it using Java Plug-in, which supports a variety of browsers, such as Internet Explorer, Firefox, and Safari. If you want to create a program that can be launched from a browser, you can do this with Java Web Start. Of course, your application can also run outside of browser as a standard desktop application.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 24
OF
&
address, and phone number) is called a record. In tables, tables fields are displayed as columns and displayed as rows. Tables are the fundamental objects in Access, but there are other objects that allow data to be retrieved, viewed, manipulated, and reported. The following table describes these other Access objects. Object Object type This object type defines the structure of an access Table data base. Tables display multiple records in rows and columns. Information in these records can be entered, edited, stored And retrieved A way of requesting selected information from a Query table. When you run a query, a selected set of records, called the record Set, appears. You can then edit or print the record set. A screen display you can create to show selected Form fields from records. Forms allow you to enter, view, and edit data. You can use a form as an alternative to displaying data in rows and columns. A design for printed data. Reports can include list Report and mailing labels as well as database reports. Reports can also perform math and calculate summaries. This object type stores Visual Basic for Module application Edition programming code that can further customize and enhance Database functions. CREATING A QUERY A query permits you to select records from your database tables that meet certain conditions or criteria. For example, you may want to produce a report that contains only those records that have a zip code greater than 90000, or you may want to select those records where the state is California and the age of the individual is more than 50. These tests or I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 26
criteria are specified and applied to the table by creating a query. In effect the query creates the subset of the table containing only those records and fields specified in the query.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 27
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 28
STUDENT
FEES
CONT ACTS
SUBMIT FEES TO
COLLEC TED BY
Admission cell
Cashier
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 29
Personal Computer Pentium III or More 25Mega Byte Color Monitor 10MB loading this software A mouse and keyboard
Software Requirements : Following Software should have been installed on the system before this software must be used. Microsoft Windows 9X Microsoft Access 2000 Java runtime environment (jdk1.3 or higher) This package is quite similar to other GUI packages. Any one who has worked in those environments will find working with this package relatively simple. Even for those who are not familiar with the said environment. It will take a little to get used to it.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 30
6.2.2 Architectural Description Architectural design represents the structure of data and program components that are required to build the computer system. It considers the architectural style that system will take, the structure and properties of the components that constitute the system, and the inter-relationship that occur among all the architectural components of the system. The software that is built for computer based systems exhibits one of many architectural styles. A brief taxonomy of these styles is given below:1. Data Centered Architectures: - A data store resides at the center of this architecture and is accessed frequently by other that updates, add, delete, or otherwise modify data within the store. 2. Data Flow architectures: - This architecture is applied when input data are to be transformed through a series of computational or manipulative components into output data. A pipe and filter pattern has a set of component to the next. Each filter works independently of those components upstream and downstream, is designed to expect data input of a certain form, and produces data output of a specified form. 3. Call and Return architectures: - This architectural style enables a software engineer to achieve a program structure that is relatively easy to modify and scale. A number of sub styles exist within the category like main program/subprogram architectures, b remote procedure call architectures. 4. Object Oriented architectures: - the components of a system data and the operations that must be applied to manipulate the data. Communication and coordination between components is accomplished via message passing. 5. Layered architecture: - A number of different layers are defined, each accomplishing operations that progressively become closer to the machine instruction set. At the outer layer, components service user interface operations. At the inner layer, components perform operating system interfacing. Intermediate layers provide utility services and application software functions.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 31
6.2.3 USER INTERFACE DESCRIPTION User interface design creates an effective communication medium between a human and a computer. Following a set of interface design principles, design identifies interface objects and actions and then creates a screen layout that forms the basis for a user interface prototype. User interface design begins with the identification of user, task, and environmental requirements. Once user tasks have been identified, user scenarios are created and analyzed to define a set of interface objects and actions. These form the basis for the creation of screen layout that depicts graphical design and placement of icons, definitions of descriptive screen text, specification and titling for window, and specification of major and minor menu items. Tools are used to prototype and ultimately implement the design model, and the result is evaluated for quality.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 32
6.2.4 SECURITY In order to avoid any unauthorized access to the registration procedure we have taken a few measures. First being providing Institute office a unique user id and password so that only he who knows the password can register the student .We have also taken care of the case that if a user is logged in with a particular used id and password, he will not get the access to the application. We have also taken care of keeping a track of the number of login by a cashier which may also help us in figuring out whether there was an illegal entry or not because if the fees are high then he is answerable to the Institute.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 33
6.3 TESTING
Testing is the most important part of any software development process. More time should be devoted to this activity. We divided the testing process into four types of tests, which follows the principles of software engineering: 1. Field level tests: These tests are done by the developer, while he takes the screens of the software. These are minor validation checks. For example he has to see that a text box meant to accept dates should not accept dates should not accept numbers. Similarly a text box meant to enter the age of the person should not allow alphabets. These may be trivial tests but they are very important as the software may behave normally for correct data, but we also have to test it for wrong data. We implemented these checks at various levels common date and number validation functions were written which all the modules shared among themselves. So that these were checked at all points and there was less code duplicity. 2. Screen level testing done by the developer: The developer himself / herself does the test when a full screen is ready. He / she puts in test data in the screens and runs the screen to see if the database is responding correctively. This is where we also see if the correct data tables are being accessed by the application. This is also the time when the developer tests that the data that is being put in the screen is passing to the correct tables in the database. 3. Module integration testing: We know from the nature of the software that this is a business application. Modules in such applications tend to be very cohesive. That is there is a lot of interaction between the two modules of such applications. Lot of data and messages are passed amongst them. So whenever two modules are integrated they must be checked if there is no change in behavior. I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 34
4. Complete application testing:After the integration of modules when the application would be built the developers will be formed into teams, due to lack of trained testing professionals. This may also be called Alpha testing. Test data sheets will be prepared for each of the defined processes and complete data will be fed in and outputs would be checked against the ones documented.
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 35
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 36
STRUCTURE OF SCHEMA
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 37
STUDENT_DET RegistrationNo StudentID Name Address F Name Sex Yearsel Sectionsel Intermediate PHOTO CHARCERT TransferCERT imagename LOGIN FEES_DET StudentID Name Fees
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 38
8. CODING :
import import import import import import import import import import java.awt.*; java.awt.event.*; javax.swing.*; javax.swing.JPasswordField.*; java.sql.*; javax.swing.table.*; javax.swing.plaf.*; javax.swing.plaf.metal.*; com.sun.java.swing.plaf.motif.*; com.sun.java.swing.plaf.windows.*;
SOURCE CODE
public class StuInfo extends JFrame { //============= Start Variables ========== boolean inAnApplet = true; final boolean shouldFill = true; final boolean shouldweightX = true; //Login panel TAB final static String MYPANEL1 = " LOGIN "; //Student Detail panel TAB final static String MYPANEL2 = " ADD RECORD "; //Modify or Delete Student Details panel TAB final static String MYPANEL3 = " MODIFY / DELETE RECORD "; //Student Reports panel TAB final static String MYPANEL4 = " STUDENT REPORTS "; //Search student details panel TAB final static String MYPANEL5 = " SEARCH STUDENT DETAILS "; //View Student Details panel TAB final static String MYPANEL6 = " SUBMITION OF FEES"; //General Reports panel TAB final static String MYPANEL7 = " FEES STATUS "; //First Image to Load is declared as steam.gif to welcome user String imagename = "steam.gif"; ImageIcon ii = new ImageIcon(imagename); //I Prefer courier new fonts whereever possible Font dataFont = new Font("courier new",Font.PLAIN,12); Font titleFont = new Font("courier new",Font.BOLD,14); //Required to handle Radio buttons Event ActionListener rlistener = new RadioListener(); //Required to handle Check Box Event CheckBoxListener myListener = new CheckBoxListener(); //Required to handle Combo Box Events ComboBoxListener cbListener = new ComboBoxListener(); //I prefer gridbag layout (more flexible to place Elements inside a Tab) GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); GridBagConstraints c2 = new GridBagConstraints();
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 39
GridBagConstraints c5 = new GridBagConstraints();//I need a Dialog Box to ask delete confirmation messages etc.. Container contentPane = getContentPane(); JDialog dialog = new JDialog((Frame) null, "! DELETE CONFIRMATION !", true); Container dialogContentPane = dialog.getContentPane(); //Radio Buttons need to be grouped so that u check on one other gets unchecked ButtonGroup bg = new ButtonGroup(); ButtonGroup bg2 = new ButtonGroup(); ButtonGroup bgq = new ButtonGroup(); // Declare All Labels i will be using somewhere or the other JLabel jLabel, jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLlogin; JLabel jLabel77, jLabel8, jLabel9, jLabelim; JLabel jLabeldlg = new JLabel("Do You Really want to Delete ?"); JLabel jLabelq1, jLabelq2; // Declare All Radiobuttons i will be using somewhere or the other JRadioButton jRadiobutton, Male, Female, mMale, mFemale; JRadioButton jRadiobuttonq1, jRadiobuttonq2; // Declare All Checkboxes i will be using somewhere or the other JCheckBox jCheckbox, Intermediate, PHOTO, CHARCERT, TransferCERT, mIntermediate, mPHOTO, mCHARCERT, mTransferCERT; JCheckBox jCheckboxq1, jCheckboxq2, jCheckboxq3, jCheckboxq4, jCheckboxq5; // Declare All Comboboxes i will be using somewhere or the other JComboBox jCombobox, jCombobox1, jCombobox2 ,mjCombobox1, mjCombobox2, jCombobox3; JComboBox jComboboxq1, jComboboxq2, jcblogin, jcbsid; // Declare All Textboxes i will be using somewhere or the other JTextField jTextfield; JTextField loginname = new JTextField(40); JPasswordField loginpass = new JPasswordField(40); JTextField adds_name = new JTextField(20); JTextField adds_addr = new JTextField(20); JTextField adds_imname = new JTextField(20); JTextField adds_fname = new JTextField(20); JTextField mods_fname = new JTextField(20); JTextField mods_name = new JTextField(20); JTextField mods_addr = new JTextField(20); JTextField fees_name = new JTextField(20); JTextField fees = new JTextField(20); // All String type variables String driver="sun.jdbc.odbc.JdbcOdbcDriver";
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 40
String url="jdbc:odbc:stu"; String strlogin = "Accountant"; String dialogtitle = "Student Record Added"; String dialogf = "LOGIN FAILED"; String dialogm = "DATABASE RECORD UPDATED"; String dialogd = "DATABASE RECORD DELETED"; String Sexsel = "Male"; String Yearsel = "1st Year"; String Sectionsel = "CS"; String currname = ""; String tempname = ""; String qry = ""; String condsel="No Condition", Combo1sel="StudentID", Combo2sel="="; String sql, sql1, dialogmessage, sr, Namesel, reg_no, sid; // All Integer type variables int Intermediatesel, PHOTOsel, CHARCERTsel, TransferCERTsel, mIntermediatesel, mPHOTOsel, mCHARCERTsel, mTransferCERTsel; int dialogtype = JOptionPane.PLAIN_MESSAGE; int tempcnt; int StudentIDsel=0,StudentNamesel=0; int Addresssel=0,FathersNamesel=0,qSexsel=0; //Declaring all JPanel & Tabbed panes to be used JPanel jPanel, p1, p2, p3; JTabbedPane tabbedPane = new JTabbedPane(); // Declare All Submit Buttons i will be using somewhere or the other JButton login = new JButton("LOGIN"); JButton DELETEIT = new JButton("YES DELETE"); JButton DONTDELETE = new JButton("NO DELETE"); JButton button, ADDREC, MODIFY, SHOW_STUDENT_LIST, DELETE; JButton QUERY, Fsubmit; //Required to Build a JTable in Student Reports (also known as DataGrid by VC++ Users) Object[] data = new Object[5]; DefaultTableModel defaulttablemodel = new DefaultTableModel(); JTable jtable = new JTable(defaulttablemodel); // Declare Textarea i will be using to show query result JTextField givencondition; JTextArea resultArea; MetalLookAndFeel metalLF = new MetalLookAndFeel(); MotifLookAndFeel motifLF = new MotifLookAndFeel(); WindowsLookAndFeel windowsLF = new WindowsLookAndFeel(); //---------------------- End Variables -----------//======================= Start main =============== public static void main(String args[]) { StuInfo app = new StuInfo();
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 41
} //------------------------- End main ----------------//================= Start StuInfo ========= public StuInfo() { // Declare Title to my Application super("Niranjan's Java : soft.niranjan@gmail.com"); setup(); pack(); addWindowListener(new WindowEventHandler()); show(); } //--------------------- End StuInfo -----------//======================Start setup =============== void setup() { setupMenuBar(); //Call "setupMenuBar()" to Build the Exit Menu showpane1(); //Call some method to Build the Exit Menu contentPane.add(tabbedPane, BorderLayout.CENTER); } //--------------------- End setup ----------------//=============== Start setupMenuBar ======== void setupMenuBar() { MenuBar menuBar = new MenuBar(); // Main Menu will be "File" Menu fileMenu = new Menu("File"); // Sub menu under it will be "Exit" MenuItem fileExit = new MenuItem("Exit"); // Handle this submenu item clcik event to Exit fileExit.addActionListener(new MenuItemHandler()); fileMenu.add(fileExit); menuBar.add(fileMenu); Menu styleMenu = new Menu("Style"); MenuItem styleWin = new MenuItem("Windows"); styleWin.addActionListener(new MenuItemHandler()); styleMenu.add(styleWin); MenuItem styleMotif = new MenuItem("Motif"); styleMotif.addActionListener(new MenuItemHandler()); styleMenu.add(styleMotif); MenuItem styleMetal = new MenuItem("Metal"); styleMetal.addActionListener(new MenuItemHandler()); styleMenu.add(styleMetal); menuBar.add(styleMenu); setMenuBar(menuBar); } //----------------------- End setupMenuBar-----------
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 42
//===================== Start showpane1 ============ void showpane1() { p1 = new JPanel() //LOGIN TAB { public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); // i set width=785 & height=495 for my login TAB & OTHER TABS will use it size.width = 700; size.height = 495; return size; } }; p1.setBorder(BorderFactory.createTitledBorder(BorderFactory .createEtchedBorder(),"Login Panel")); p1.setFont(titleFont); p1.setLayout(gridbag); jLlogin = new JLabel("Select User : "); jLlogin.setFont(dataFont);// Make this Data Font that we declared before c.weightx = 0.0; //Horizontal Space not required herec.weighty = 0.0; //Vertical Space c.ipady = 2; //Height of Component c.ipadx = 2; //Width of Component c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; //1 columns wide c.gridx = 0; //aligned with button 0 -- Very Important c.gridy = 0; //0th Row -- Very Important // Add all these features to this Label "jLabel1" gridbag.setConstraints(jLlogin, c); // Add this featured Label "jLlogin" into out LOGIN TAB p1.add(jLlogin); jcblogin = new JComboBox(); // Fonts inside combo box be datafont i,e courier new jcblogin.setFont(dataFont); // Adding Elements to combo box jcblogin.addItem("Accountant"); jcblogin.addItem("Cashier"); // fill it align properly with other Elements inside TAB c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10,0,0,30); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 0; jcblogin.addItemListener(cbListener);
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 43
gridbag.setConstraints(jcblogin, c); p1.add(jcblogin); jLabel1 = new JLabel("Enter Username : "); jLabel1.setFont(dataFont);// Make this Data Font that we declared before c.weightx = 0.0; //Horizontal Space not required herec.weighty = 0.0; //Vertical Space c.ipady = 2; //Height of Component c.ipadx = 2; //Width of Component c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; //1 columns wide c.gridx = 0; //aligned with button 0 -- Very Important c.gridy = 1; //0th Row -- Very Important // Add all these features to this Label "jLabel1" gridbag.setConstraints(jLabel1, c); // Add this featured Label "jLabel1" into out LOGIN TAB p1.add(jLabel1); loginname = new JTextField(""); c.ipady = 2; c.ipadx = 2; c.weighty = 0.0; c.anchor = GridBagConstraints.WEST; c.gridwidth = 2; c.gridx = 1; c.gridy = 1; gridbag.setConstraints(loginname, c); p1.add(loginname); jLabel2 = new JLabel("Enter Password : "); jLabel2.setFont(dataFont); c.ipady = 2; c.ipadx = 2; c.weighty = 0.0; c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 0; c.gridy = 2; gridbag.setConstraints(jLabel2, c); p1.add(jLabel2); loginpass = new JPasswordField(""); loginpass.setEchoChar('*'); c.ipady = 2; c.ipadx = 2; c.weighty = 0.0; c.anchor = GridBagConstraints.WEST; c.gridwidth = 2; c.gridx = 1; c.gridy = 2; gridbag.setConstraints(loginpass, c); p1.add(loginpass); button = new JButton("LOGIN"); c.ipady = 2;
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 44
c.ipadx = 2; c.weighty = 0.0; c.anchor = GridBagConstraints.CENTER; c.gridwidth = 1; c.gridx = 1; c.gridy = 3; gridbag.setConstraints(button, c); p1.add(button); button.addActionListener(new ButtonHandler()); tabbedPane.addTab(MYPANEL1, p1); } //---------------------- End__ showpane1 ----------//====================== Start showpane2 =========== void showpane2() //ADD STUDENT DETAILS TAB { p2 = new JPanel(); p2.setBorder(BorderFactory.createTitledBorder(BorderFactory .createEtchedBorder(),"Add Student Details")); p2.setLayout(gridbag); jLabel3 = new JLabel(" Student Name : "); jLabel3.setFont(dataFont); c.fill = GridBagConstraints.BOTH; c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 1; gridbag.setConstraints(jLabel3, c); p2.add(jLabel3); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 1; gridbag.setConstraints(adds_name, c); p2.add(adds_name); jLabel4 = new JLabel(" Student Address : "); jLabel4.setFont(dataFont); c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 2; gridbag.setConstraints(jLabel4, c); p2.add(jLabel4); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 2; gridbag.setConstraints(adds_addr, c); p2.add(adds_addr); jLabel5 = new JLabel(" Father's Name : "); jLabel5.setFont(dataFont);
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 45
c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 3; gridbag.setConstraints(jLabel5, c); p2.add(jLabel5); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 3; gridbag.setConstraints(adds_fname, c); p2.add(adds_fname); // I am checking default sex as male by using 'true' , // U are free to make this false Male = new JRadioButton("Male",true); Male.setFont(dataFont); c.fill = GridBagConstraints.BOTH; c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 4; gridbag.setConstraints(Male, c); Male.addActionListener(rlistener); bg.add(Male); p2.add(Male); Female = new JRadioButton("Female",false); Female.setFont(dataFont); c.fill = GridBagConstraints.BOTH; c.ipady = 2; c.ipadx = 2; c.gridx = 2; c.gridy = 4; gridbag.setConstraints(Female, c); Female.addActionListener(rlistener); bg.add(Female); p2.add(Female); jLabel6 = new JLabel(" B.Tech : "); jLabel6.setFont(dataFont); c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 5; gridbag.setConstraints(jLabel6, c); p2.add(jLabel6); jCombobox1 = new JComboBox(); // Fonts inside combo box be datafont i,e courier new jCombobox1.setFont(dataFont); // Adding Elements to combo box jCombobox1.addItem("1st year"); jCombobox1.addItem("2nd year"); jCombobox1.addItem("3rd year");
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 46
jCombobox1.addItem("4th year"); // fill it align properly with other Elements inside TAB c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10,0,0,30); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 5; jCombobox1.addItemListener(cbListener); gridbag.setConstraints(jCombobox1, c); p2.add(jCombobox1); jCombobox2 = new JComboBox(); jCombobox2.setFont(dataFont); // Adding Elements to combo box jCombobox2.addItem("CS"); jCombobox2.addItem("EC"); jCombobox2.addItem("EI"); jCombobox2.addItem("IT"); c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10,0,0,30); c.ipady = 2; c.ipadx = 2; c.gridx = 2; c.gridy = 5; jCombobox2.addItemListener(cbListener); gridbag.setConstraints(jCombobox2, c); p2.add(jCombobox2); Intermediate = new JCheckBox("Intermediate Marks Sheat "); //Using a Check Box with some Text here c.fill = GridBagConstraints.BOTH; c.ipady = 0; c.ipadx = 0; c.gridx = 1; c.gridy = 6; gridbag.setConstraints(Intermediate, c); Intermediate.setFont(dataFont); Intermediate.addItemListener(myListener); p2.add(Intermediate); PHOTO = new JCheckBox("PHOTO (Passport Size) "); c.ipady = 0; c.ipadx = 0; c.gridx = 2; c.gridy = 6; gridbag.setConstraints(PHOTO, c); PHOTO.setFont(dataFont); PHOTO.addItemListener(myListener); p2.add(PHOTO); CHARCERT = new JCheckBox("Charecter Certificate"); c.ipady = 0; c.ipadx = 0; c.gridx = 1;
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 47
c.gridy = 7; gridbag.setConstraints(CHARCERT, c); CHARCERT.setFont(dataFont); CHARCERT.addItemListener(myListener); p2.add(CHARCERT); TransferCERT = new JCheckBox("Transfer Certificate"); c.ipady = 0; c.ipadx = 0; c.gridx = 2; c.gridy = 7; gridbag.setConstraints(TransferCERT, c); TransferCERT.setFont(dataFont); TransferCERT.addItemListener(myListener); p2.add(TransferCERT); jLabelim = new JLabel(" Image Name : "); jLabelim.setFont(dataFont); c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 8; gridbag.setConstraints(jLabelim, c); p2.add(jLabelim); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 8; gridbag.setConstraints(adds_imname, c); p2.add(adds_imname); ADDREC = new JButton("SAVE RECORD"); c.ipadx = 2; c.gridx = 2; c.gridy = 8; gridbag.setConstraints(ADDREC, c); // Handle "SAVERECORD" button clicked event by "ButtonHandler()" ADDREC.addActionListener(new ButtonHandler()); p2.add(ADDREC); jLabel7 = new JLabel(" ", ii, JLabel.CENTER); c.fill = GridBagConstraints.BOTH; c.gridwidth = 5; c.gridx = 0; c.gridy = 9; gridbag.setConstraints(jLabel7, c); p2.add(jLabel7); tabbedPane.addTab(MYPANEL2, p2); } //------------------------ End showpane2 --------//============================== Start showpane3 ========= void showpane3() //MODIFY STUDENT DETAILS TAB { p3 = new JPanel();
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 48
p3.setBorder(BorderFactory.createTitledBorder(BorderFactory .createEtchedBorder(),"Modify Student Details")); p3.setLayout(gridbag); jCombobox3 = new JComboBox(); jCombobox3.addItem("Select Student : "); jCombobox3.setFont(dataFont); c2.fill = GridBagConstraints.BOTH; c2.ipady = 2; c2.ipadx = 2; c2.gridx = 2; c2.gridy = 1; gridbag.setConstraints(jCombobox3, c2); jCombobox3.addItemListener(cbListener); p3.add(jCombobox3); JLabel jl8 = new JLabel(" Student Name : "); jl8.setFont(dataFont); c2.fill = GridBagConstraints.BOTH; c2.ipady = 2; c2.ipadx = 2; c2.gridx = 0; c2.gridy = 1; gridbag.setConstraints(jl8, c2); p3.add(jl8); mods_name = new JTextField(20); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 1; c2.gridy = 1; gridbag.setConstraints(mods_name, c2); p3.add(mods_name); jl9 = new JLabel(" Student Address : "); jl9.setFont(dataFont); c2.fill = GridBagConstraints.BOTH; c2.ipady = 2; c2.ipadx = 2; c2.gridx = 0; c2.gridy = 2; gridbag.setConstraints(jl9, c2); p3.add(jl9); mods_addr = new JTextField(20); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 1; c2.gridy = 2; gridbag.setConstraints(mods_addr, c2); p3.add(mods_addr); jLabel5 = new JLabel(" Father's Name : "); jLabel5.setFont(dataFont); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 0;
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 49
c2.gridy = 3; gridbag.setConstraints(jLabel5, c2); p3.add(jLabel5); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 1; c2.gridy = 3; gridbag.setConstraints(mods_fname, c2); p3.add(mods_fname); mMale = new JRadioButton("Male",true); mMale.setFont(dataFont); c2.fill = GridBagConstraints.BOTH; c2.ipady = 2; c2.ipadx = 2; c2.gridx = 1; c2.gridy = 4; gridbag.setConstraints(mMale, c2); mMale.addActionListener(rlistener); bg2.add(mMale); p3.add(mMale); mFemale = new JRadioButton("Female",false); mFemale.setFont(dataFont); c2.fill = GridBagConstraints.BOTH; c2.ipady = 2; c2.ipadx = 2; c2.gridx = 2; c2.gridy = 4; gridbag.setConstraints(mFemale, c2); bg2.add(mFemale); mFemale.addActionListener(rlistener); p3.add(mFemale); jLabel6 = new JLabel(" B.Tech : "); jLabel6.setFont(dataFont); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 0; c2.gridy = 5; gridbag.setConstraints(jLabel6, c2); p3.add(jLabel6); mjCombobox1 = new JComboBox(); mjCombobox1.setFont(dataFont); mjCombobox1.addItem("1st year"); mjCombobox1.addItem("2nd year"); mjCombobox1.addItem("3rd year"); mjCombobox1.addItem("4th year"); c2.fill = GridBagConstraints.BOTH; c2.ipady = 2; c2.ipadx = 2; c2.gridx = 1; c2.gridy = 5; mjCombobox1.addItemListener(cbListener);
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 50
gridbag.setConstraints(mjCombobox1, c2); p3.add(mjCombobox1); mjCombobox2 = new JComboBox(); mjCombobox2.setFont(dataFont); mjCombobox2.addItem("CS"); mjCombobox2.addItem("EC"); mjCombobox2.addItem("EI"); mjCombobox2.addItem("IT"); c2.fill = GridBagConstraints.BOTH; c2.insets = new Insets(10,0,0,30); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 2; c2.gridy = 5; mjCombobox2.addItemListener(cbListener); gridbag.setConstraints(mjCombobox2, c2); p3.add(mjCombobox2); mIntermediate = new JCheckBox("Intermediate Marks Sheat "); c2.fill = GridBagConstraints.BOTH; c2.ipady = 0; c2.ipadx = 0; c2.gridx = 1; c2.gridy = 6; gridbag.setConstraints(mIntermediate, c2); mIntermediate.setFont(dataFont); mIntermediate.addItemListener(myListener); p3.add(mIntermediate); mPHOTO = new JCheckBox("PHOTO (Passport Size) "); .ipady = 0; c2.ipadx = 0; c2.gridx = 2; c2.gridy = 6; gridbag.setConstraints(mPHOTO, c2); mPHOTO.setFont(dataFont); mPHOTO.addItemListener(myListener); p3.add(mPHOTO); mCHARCERT = new JCheckBox("Charecter Certificate"); c2.ipady = 0; c2.ipadx = 0; c2.gridx = 1; c2.gridy = 7; gridbag.setConstraints(mCHARCERT, c2); mCHARCERT.setFont(dataFont); mCHARCERT.addItemListener(myListener); p3.add(mCHARCERT); mTransferCERT = new JCheckBox("Transfer Certificate"); c2.ipady = 0; c2.ipadx = 0; c2.gridx = 2; c2.gridy = 7;
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 51
gridbag.setConstraints(mTransferCERT, c2); mTransferCERT.setFont(dataFont); mTransferCERT.addItemListener(myListener); p3.add(mTransferCERT); DELETE = new JButton("DELETE RECORD"); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 1; c2.gridy = 8; gridbag.setConstraints(DELETE, c2); p3.add(DELETE); DELETE.addActionListener(new ButtonHandler()); MODIFY = new JButton("MODIFY RECORD"); c2.ipady = 2; c2.ipadx = 2; c2.gridx = 2; c2.gridy = 8; gridbag.setConstraints(MODIFY, c2); p3.add(MODIFY); MODIFY.addActionListener(new ButtonHandler()); jLabel7 = new JLabel(" ", ii, JLabel.CENTER); c2.fill = GridBagConstraints.BOTH; c2.gridwidth = 5; c2.gridx = 0; c2.gridy = 10; gridbag.setConstraints(jLabel7, c2); p3.add(jLabel7); tabbedPane.addTab(MYPANEL3, p3); accessDBinit(); } //------------------- End showpane3 --------//==================== Start showpane4 ========= void showpane4() // REPORTS TAB WITH JTABLE { JPanel p4 = new JPanel(); p4.setBorder(BorderFactory.createTitledBorder(BorderFactory .createEtchedBorder(),"Student Reports")); try { Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); String query = "SELECT StudentID, Name, Address, FName FROM student_det"; ResultSet rs = statement.executeQuery(query); ResultSetMetaData rmeta = rs.getMetaData(); int numColumns=rmeta.getColumnCount(); for(int i=1;i<=numColumns;++i) { if(i<=numColumns)
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 52
{ defaulttablemodel.addColumn(rmeta.getColumnName(i)); } } while(rs.next()) { for(int i=1;i<=numColumns;++i) { if(i<=numColumns) { tempname = rs.getString(i); tempcnt=i-1; data[tempcnt] = tempname; } } defaulttablemodel.addRow(data); } }catch(Exception ex) { // } p4.add(new JScrollPane(jtable)); tabbedPane.addTab(MYPANEL4, p4); } //------------------------- End showpane4 -----------//====================== Start showpane5 ========= void showpane5() // DYNAMIC QUERY BUILDER TAB { JPanel p5 = new JPanel(); p5.setLayout(gridbag); p5.setBorder(BorderFactory.createTitledBorder(BorderFactory .createEtchedBorder(),"Dynamic Query Builder")); jCheckboxq1 = new JCheckBox("Student ID"); jCheckboxq1.setFont(dataFont); c5.gridx = 0; c5.gridy = 0; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jCheckboxq1, c5); jCheckboxq1.addItemListener(myListener); p5.add(jCheckboxq1); jRadiobuttonq1 = new JRadioButton("No Condition",true); jRadiobuttonq1.setFont(dataFont); c5.gridx = 1; c5.gridy = 0; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jRadiobuttonq1, c5); jRadiobuttonq1.addActionListener(rlistener); bgq.add(jRadiobuttonq1); p5.add(jRadiobuttonq1); jLabelq1 = new JLabel(" WHERE "); jLabelq1.setFont(titleFont); c5.gridx = 2;
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 53
c5.gridy = 0; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jLabelq1, c5); p5.add(jLabelq1); jComboboxq1 = new JComboBox(); jComboboxq1.addItem("StudentID"); jComboboxq1.addItem("Name"); jComboboxq1.addItem("Address"); jComboboxq1.addItem("FName"); jComboboxq1.addItem("Sex"); jComboboxq1.setFont(dataFont); c5.gridx = 3; c5.gridy = 0; c5.fill = GridBagConstraints.BOTH; jComboboxq1.addItemListener(cbListener); gridbag.setConstraints(jComboboxq1, c5); p5.add(jComboboxq1); jComboboxq2 = new JComboBox(); jComboboxq2.addItem("="); jComboboxq2.addItem(">"); jComboboxq2.addItem(">="); jComboboxq2.addItem("<"); jComboboxq2.addItem("<="); jComboboxq2.addItem("LIKE"); jComboboxq2.addItem("NOT LIKE"); jComboboxq2.setFont(dataFont); c5.gridx = 4; c5.gridy = 0; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jComboboxq2, c5); jComboboxq2.addItemListener(cbListener); p5.add(jComboboxq2); givencondition = new JTextField(""); c5.gridx = 5; c5.gridy = 0; gridbag.setConstraints(givencondition, c5); p5.add(givencondition); jCheckboxq2 = new JCheckBox("Student Name"); Checkboxq2.setFont(dataFont); c5.gridx = 0; c5.gridy = 1; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jCheckboxq2, c5); jCheckboxq2.addItemListener(myListener); p5.add(jCheckboxq2); jRadiobuttonq2 = new JRadioButton("Set Condition",false); jRadiobuttonq2.setFont(dataFont); c5.gridx = 1; c5.gridy = 1; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jRadiobuttonq2, c5);
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 54
jRadiobuttonq2.addActionListener(rlistener); bgq.add(jRadiobuttonq2); p5.add(jRadiobuttonq2); jCheckboxq3 = new JCheckBox("Address"); jCheckboxq3.setFont(dataFont); c5.gridx = 0; c5.gridy = 2; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jCheckboxq3, c5); jCheckboxq3.addItemListener(myListener); p5.add(jCheckboxq3); jCheckboxq4 = new JCheckBox("Fathers Name"); jCheckboxq4.setFont(dataFont); c5.gridx = 0; c5.gridy = 3; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jCheckboxq4, c5); jCheckboxq4.addItemListener(myListener); p5.add(jCheckboxq4); jCheckboxq5 = new JCheckBox("Sex"); jCheckboxq5.setFont(dataFont); c5.gridx = 0; c5.gridy = 4; c5.fill = GridBagConstraints.BOTH; gridbag.setConstraints(jCheckboxq5, c5); jCheckboxq5.addItemListener(myListener); p5.add(jCheckboxq5); QUERY = new JButton("QUERY"); c5.gridx = 5; c5.gridy = 4; gridbag.setConstraints(QUERY, c5); gridbag.setConstraints(QUERY, c5); QUERY.addActionListener(new ButtonHandler()); p5.add(QUERY); jLabelq2 = new JLabel(" Query Result "); jLabelq2.setFont(dataFont); c5.weighty = 1.0; c5.gridx = 0; c5.gridy = 5; c5.gridwidth = 6; gridbag.setConstraints(jLabelq2, c5); p5.add(jLabelq2); resultArea = new JTextArea(10,60); resultArea.setFont(dataFont); c5.gridx = 0; c5.gridy = 6; c5.fill = GridBagConstraints.BOTH; c5.gridwidth = 6; gridbag.setConstraints(resultArea, c5); p5.add(resultArea); tabbedPane.addTab(MYPANEL5, p5);
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 55
} //--------------------- End showpane5 -----------//======================= Start showpane6 ========= void showpane6() { JPanel p6 = new JPanel(); p6.setBorder(BorderFactory.createTitledBorder(BorderFactory .createEtchedBorder(),"Submit Student's Fees")); p6.setLayout(gridbag); JLabel FLable = new JLabel(" Student ID : "); FLable.setFont(dataFont); c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10,0,0,30); c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 0; gridbag.setConstraints(FLable, c); p6.add(FLable); jcbsid = new JComboBox(); jcbsid.addItem("<Select Student ID>"); jcbsid.setFont(dataFont); c.fill = GridBagConstraints.BOTH; c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 0; gridbag.setConstraints(jcbsid, c); jcbsid.addItemListener(cbListener); p6.add(jcbsid); JLabel FLable1 = new JLabel(" Student Name : "); FLable1.setFont(dataFont);
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 56
GridBagConstraints.BOTH; c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 1; gridbag.setConstraints(FLable1, c); p6.add(FLable1); fees_name = new JTextField(""); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 1; gridbag.setConstraints(fees_name, c); p6.add(fees_name); JLabel FLable2 = new JLabel(" Fees : "); FLable2.setFont(dataFont); c.fill = GridBagConstraints.BOTH; c.ipady = 2; c.ipadx = 2; c.gridx = 0; c.gridy = 2; gridbag.setConstraints(FLable2, c); p6.add(FLable2); fees = new JTextField("35000"); c.ipady = 2; c.ipadx = 2; c.gridx = 1; c.gridy = 2; gridbag.setConstraints(fees, c); p6.add(fees);
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 57
gridbag.setConstraints(Fsubmit, c); p6.add(Fsubmit); Fsubmit.addActionListener(new ButtonHandler()); tabbedPane.addTab(MYPANEL6, p6); accessDBinit1(); } //----------------------------------------------------------- End showpane6 -----------//=============================================== ============== Start showpane7 ========= void showpane7() { JPanel p7 = new JPanel(); jLabel = new JLabel(" Inside Panel 7 "); p7.add(jLabel); tabbedPane.addTab(MYPANEL7, p7); } //----------------------------------------------------------- End showpane7 -----------void showpane2345() // ACCOUNTANT LOGGEDIN { showpane2(); showpane3(); showpane4(); showpane5(); } void showpane67() // PRINCIPAL LOGGEDIN { showpane6(); showpane7(); } ///////////////////////////////////////////////// //////////////////////////////////////// //=============================================== =========== Start accessDB() ============= void accessDB() { try {
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 58
loginname.getText(); var1 = String var2 = loginpass.getText(); var2 = var2.trim(); //JDBC step 1 : Write your SQL (structured query language) sql = "SELECT * FROM login WHERE username='"+var1+"' AND password='"+var2+"'"; //JDBC step 2 : using driver="sun.jdbc.odbc.JdbcOdbcDriver"; for MSACCESS Class.forName(driver); //JDBC step 3 : using driver="sun.jdbc.odbc.JdbcOdbcDriver"; Connection connection=DriverManager.getConnection(url); //JDBC step 4 : url="jdbc:odbc:stu"; ODBC Comes into picture here Statement statement = connection.createStatement(); //JDBC step 5 : Get JDBC connection boolean hasResults = statement.execute(sql); //JDBC step 6 : Execute your SQL (see if it has any results) if(hasResults) { ResultSet result = statement.getResultSet(); //JDBC step 7 : if there are results Get the "SET" if(result!=null) { //take this "SET" of results from "SQL" //call this method "isplayResults(ResultSet r)" and pass ResultSet to it displayResults(result); } //JDBC step 8 : Close Database Connection u Established connection.close(); } } catch(Exception ex) { } } var1.trim();
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 59
void displayResults(ResultSet r) throws SQLException { ResultSetMetaData rmeta = r.getMetaData(); //Get Metadata from resultset int foundrec = 0; int numColumns=rmeta.getColumnCount(); while(r.next()) { String param3 = r.getString(3).trim(); // 3rd field in the table 'login' , database 'stu.mdb' if ((param3.equals("Accountant")) && (strlogin.equals("Accountant"))) { // for login 'acc' , password 'acc' , if his deparment is "Accounts" // u found record , so set foundrecord = 1 foundrec = 1; //remove login TAB tabbedPane.removeTabAt(0); // Show other panes 2-34-5 showpane2345(); } else if ((param3.equals("Cashier")) && (strlogin.equals("Cashier"))) { // for login 'cas' , password 'cas' , if his deparment is "Cashier" // u found record , so set foundrecord = 1 foundrec = 1; //remove login TAB (TAB 0) tabbedPane.removeTabAt(0); showpane67(); } } if(foundrec==0) { //if foundrecord is zero , invalid login dialogmessage = "Please Re-Login";
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 60
dialogtype = JOptionPane.INFORMATION_MESSAGE; //show message JOptionPane.showMessageDialog((Component) null, dialogmessage, dialogf, dialogtype); //make login and password textboxes empty loginname.setText(""); loginpass.setText(""); } } //------------------------------------------------------------------ End accessDB() ------//=============================================== ==================== Start accessDBADD()==== void accessDBADD() { try { Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); //Generate new register number String query = "SELECT * FROM student_det"; ResultSet rs = statement.executeQuery(query); int cnt = 0; while (rs.next()) { cnt++; } cnt = cnt+1; char ys = Yearsel.charAt(0); String ss = Sectionsel; reg_no = "07PCCS"+ys+""+ss+"-"+cnt; //insert data with new reg no and other details sql = "INSERT INTO student_det (StudentID, Name, Address, FName, Sex, Yearsel, Sectionsel, Intermediate, PHOTO, CHARCERT, TransferCERT, imagename) VALUES ('"+reg_no+"','"+adds_name.getText() +"','"+adds_addr.getText()+"','"+adds_fname.getText() +"','"+Sexsel+"','"+Yearsel+"','"+Sectionsel+"',"+Intermedi atesel+","+PHOTOsel+","+CHARCERTsel+","+TransferCERTsel+",' "+adds_imname.getText()+"')";
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 61
JTable too (DATAGRID) data[0] = reg_no; data[1] = adds_name.getText(); data[2] = adds_addr.getText(); data[3] = adds_fname.getText(); defaulttablemodel.addRow(data); dialogmessage = " "+adds_name.getText().toUpperCase()+" has Registration Number : "+reg_no; dialogtype = JOptionPane.INFORMATION_MESSAGE; //show user the new register number and new record holder name JOptionPane.showMessageDialog((Component) null, dialogmessage, dialogtitle, dialogtype); //rollback combobox selection jCombobox1.setSelectedIndex(0); jCombobox2.setSelectedIndex(0); adds_name.getText(); jCombobox3.addItem(adds_name.getText()); // add name to combobox in modify names TAB //set other textboxes black to enable new record entry adds_name.setText(" "); adds_addr.setText(" "); adds_fname.setText(" "); adds_imname.setText(" "); // uncheck checkboxes if they are checked while adding data Intermediate.setSelected(false); PHOTO.setSelected(false); TransferCERT.setSelected(false); CHARCERT.setSelected(false); //click on the radiobutton male , to make it default again //section //standard
String snametemp =
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 62
} } //------------------------------------------------------------------ End accessDBADD() ------//=============================================== ================ Start accessDBMod() ======== void accessDBMod(String nsel) { try { sql = "SELECT * FROM student_det WHERE Name='"+nsel+"'"; Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); boolean hasResults = statement.execute(sql); if(hasResults) { ResultSet result = statement.getResultSet(); if(result!=null) { displayResultsMod(result); } connection.close(); } } catch(Exception ex) { } } void displayResultsMod(ResultSet r) throws SQLException { ResultSetMetaData rmeta = r.getMetaData(); int foundrec = 0; int numColumns=rmeta.getColumnCount(); String text2=""; String text3=""; String text4="";
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 63
String text5=""; String text6=""; String text7=""; String text8=""; int int9=0; int int10=0; int int11=0; int int12=0; while(r.next()) { reg_no=r.getString(2); text3+=r.getString(3); text4+=r.getString(4); text5+=r.getString(5); text6+=r.getString(6); text7+=r.getString(7); text8+=r.getString(8); int9=r.getInt(9); int10=r.getInt(10); int11=r.getInt(11); int12=r.getInt(12); imagename=r.getString(13); } jLabel7.setIcon(new ImageIcon(imagename)); currname = text3; mods_name.setText(text3); mods_addr.setText(text4); mods_fname.setText(text5); text6 = text6.trim(); if (text6.equals("Male")) { mMale.doClick(); } else { mFemale.doClick(); } text7 = text7.trim(); if (text7.equals("2nd year")) { mjCombobox1.setSelectedIndex(1); } else { mjCombobox1.setSelectedIndex(0); } text8 = text8.trim();
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 64
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 65
//------------------------------------------------------------ End accessDBMod() -------//=============================================== ============== Start accessDBinit()======= void accessDBinit() { try { sql = "SELECT Name FROM student_det ORDER BY Name"; Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); boolean hasResults = statement.execute(sql); if(hasResults) { ResultSet result = statement.getResultSet(); if(result!=null) { displayResultsinit(result); } connection.close(); } } catch(Exception ex) { } } void displayResultsinit(ResultSet r) throws SQLException { ResultSetMetaData rmeta = r.getMetaData(); int numColumns=rmeta.getColumnCount(); while(r.next()) { for(int i=1;i<=numColumns;++i) { if(i<=numColumns) { jCombobox3.addItem(r.getString(i)); }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 66
} //------------------------------------------------------------ End accessDBinit() -------//=============================================== ============== Start accessDBDel()======== void accessDBDel(String nsel) { try { Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); sql = "DELETE FROM student_det WHERE Name='"+nsel+"'"; statement.executeUpdate(sql); connection.close(); mjCombobox1.setSelectedIndex(0); mjCombobox2.setSelectedIndex(0); mods_name.setText(" "); mods_addr.setText(" "); mods_fname.setText(" "); mIntermediate.setSelected(false); mPHOTO.setSelected(false); mTransferCERT.setSelected(false); mCHARCERT.setSelected(false); jCombobox3.removeItem(nsel); // Note : Bug Fixed in This Version mMale.doClick(); } catch(Exception ex) { } } //--------------------------------------------------------------- End accessDBDel()-------
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 67
//=============================================== ================ Start accessDBinit1() ======== void accessDBinit1() { try { sql = "SELECT StudentID FROM student_det ORDER BY StudentID"; Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); boolean hasResults = statement.execute(sql); if(hasResults) { ResultSet result = statement.getResultSet(); if(result!=null) { displayResultsinit1(result); } connection.close(); } } catch(Exception ex) { } } void displayResultsinit1(ResultSet r) throws SQLException { ResultSetMetaData rmeta = r.getMetaData(); int numColumns=rmeta.getColumnCount(); while(r.next()) { for(int i=1;i<=numColumns;++i) { if(i<=numColumns) { jcbsid.addItem(r.getString(i)); } } }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 68
} //------------------------------------------------------------ End accessDBinit1() -------//=============================================== ================ Start accessfees() ======== void accessfees(String sid) { try { sql = "SELECT Name FROM student_det WHERE StudentID='"+sid+"'"; Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); boolean hasResults = statement.execute(sql); if(hasResults) { ResultSet result = statement.getResultSet(); if(result!=null) { displayResultsfees(result); } connection.close(); } } catch(Exception ex) { } } void displayResultsfees(ResultSet r) throws SQLException { ResultSetMetaData rmeta = r.getMetaData(); int foundrec = 0; int numColumns=rmeta.getColumnCount(); String text3=""; while(r.next()) { text3+=r.getString(1); } fees_name.setText(text3); } //------------------------------------------------------------ End accessfees() --------
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 69
//=============================================== ==================== Start accessFessADD()==== void accessFeesADD() { try { Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); //insert data with new reg no and other details sql = "INSERT INTO fees_det (StudentID, Name, Fees) VALUES ('"+sid+"','"+fees_name.getText()+"','"+fees.getText() +"')"; statement.executeUpdate(sql); connection.close(); dialogmessage = " "+fees.getText() +"Rupees Fees Submitted "; dialogtype = JOptionPane.INFORMATION_MESSAGE; JOptionPane.showMessageDialog((Component) null, dialogmessage, dialogm, dialogtype); jcbsid.setSelectedItem("<Select Student ID>"); } catch(Exception ex) { } } //------------------------------------------------------------------ End accessFeesADD() ------//=============================================== ================== Start updateDB() ====== void updateDB() { try { sql = "UPDATE student_det SET Name='"+mods_name.getText()+"', Address='"+mods_addr.getText()+"', FName='"+mods_fname.getText()+"', Sex='"+Sexsel+"', Yearsel='"+Yearsel+"', Sectionsel='"+Sectionsel+"', Intermediate="+mIntermediatesel+", PHOTO="+mPHOTOsel+", CHARCERT="+mCHARCERTsel+",
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 70
TransferCERT="+mTransferCERTsel+" WHERE StudentID='"+reg_no+"'"; Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); statement.executeUpdate(sql); connection.close(); dialogmessage = " "+mods_name.getText().toUpperCase()+" Record is Updated "; dialogtype = JOptionPane.INFORMATION_MESSAGE; JOptionPane.showMessageDialog((Component) null, dialogmessage, dialogm, dialogtype); } catch(Exception ex) { } } //---------------------------------------------------------------- End updateDB() --------//=============================================== ============= Start handleQuery() ======= void handleQuery() { qry="SELECT"; int cnt=0; if(StudentIDsel==1) { cnt++; qry+=" StudentID,"; } if(StudentNamesel==1) { cnt++; qry+=" Name,"; } if(Addresssel==1) { cnt++; qry+=" Address,"; } if(FathersNamesel==1) { cnt++; qry+=" FName,"; } if(qSexsel==1)
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 71
} int slen=qry.length(); int tempslen = slen-1; qry = qry.substring(0,tempslen); qry+=" FROM student_det"; if(condsel=="Set Condition") { qry+=" WHERE "+Combo1sel+" "+Combo2sel+" '"+givencondition.getText().trim()+"'"; } jLabelq2.setText(qry); accessDBquery(qry); } //----------------------------------------------------------- End handleQuery() -------//=============================================== =============== Start accessDBquery() === void accessDBquery(String sqlq) { try { Class.forName(driver); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); boolean hasResults = statement.execute(sqlq); if(hasResults) { ResultSet result = statement.getResultSet(); if(result!=null) { displayResultsQ(result); } else { resultArea.setText(""); } } connection.close(); } catch(Exception ex) { resultArea.setText(ex.toString()); } }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 72
void displayResultsQ(ResultSet r) throws SQLException { ResultSetMetaData rmeta = r.getMetaData(); int numColumns=rmeta.getColumnCount(); String text=""; for(int i=1;i<=numColumns;++i) { if(i<numColumns) text+=rmeta.getColumnName(i)+" | "; else text+=rmeta.getColumnName(i); } text+="\n"; while(r.next()) { for(int i=1;i<=numColumns;++i) { if(i<numColumns) text+=r.getString(i)+" | "; else text+=r.getString(i).trim(); } text+="\n"; } resultArea.setText(text); } //--------------------------------------------------------------- End accessDBquery() --///////////////////////////////////////////////// //////////////////////////////////////// //=============================================== ============== Start ButtonHandler ======== class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent ev) { String s=ev.getActionCommand(); //see which button is click accordingly call its method if(s=="LOGIN") { // call method accessDB(); accessDB(); } else if(s=="SAVE RECORD") { accessDBADD(); String snametemp = adds_name.getText(); }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 73
else if(s=="MODIFY RECORD") { String temp_mname = mods_name.getText().trim(); String temp_currname = currname.trim(); if(temp_mname.equals(temp_currname)) { } else { jCombobox3.addItem(mods_name.getText()); } updateDB(); } else if(s=="DELETE RECORD") { dialogContentPane.setLayout(new FlowLayout()); dialogContentPane.add(jLabeldlg); jLabeldlg.setFont(titleFont); dialogContentPane.add(DELETEIT); DELETEIT.addActionListener(new ButtonHandler()); dialogContentPane.add(DONTDELETE); DONTDELETE.addActionListener(new ButtonHandler()); //Boundry for this dialog box dialog.setBounds(300, 200, 250, 120); //show delete confirmation dialog dialog.show(); } else if(s=="YES DELETE") { dialog.dispose(); Namesel = jCombobox3.getSelectedItem().toString(); accessDBDel(Namesel); } else if(s=="NO DELETE") { dialog.dispose(); } else if(s=="QUERY") { handleQuery(); }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 74
} } //------------------------------------------------------------ End ButtonHandler -------//=============================================== ============ START MenuItemHandler ====== class MenuItemHandler implements ActionListener { public void actionPerformed(ActionEvent ev) { String s=ev.getActionCommand(); if(s=="Exit") { System.exit(0); } else if(s=="Windows") { try { UIManager.setLookAndFeel(windowsLF); SwingUtilities.updateComponentTreeUI(StuInfo.this); } catch(Exception e) { System.out.println("Could not Load Windows Look n Feel"); } } else if(s=="Motif") { try { UIManager.setLookAndFeel(motifLF); SwingUtilities.updateComponentTreeUI(StuInfo.this); } catch(Exception e) { System.out.println("Could not Load Motif Look n Feel"); }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 75
UIManager.setLookAndFeel(metalLF); SwingUtilities.updateComponentTreeUI(StuInfo.this); } catch(Exception e) { System.out.println("Could not Load Metal Look n Feel"); } } } } //---------------------------------------------------------- END__ MenuItemHandler -----//=============================================== ============ START WindowEventHandler === class WindowEventHandler extends WindowAdapter { public void windowClosing(WindowEvent e) { //close window on exit System.exit(0); } } //---------------------------------------------------------- END__ WindowEventHandler --//=============================================== ============ START RadioListener ======== class RadioListener implements ActionListener { public void actionPerformed(ActionEvent e) { Sexsel = e.getActionCommand(); condsel = e.getActionCommand(); } } //---------------------------------------------------------- END__ RadioListener -------//=============================================== ============ START RadioListener ======== class ComboBoxListener implements ItemListener { public void itemStateChanged(ItemEvent e) {
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 76
sr = (String)e.getItem(); if (e.getSource().equals(jcblogin)) { strlogin = jcblogin.getSelectedItem().toString(); } if (e.getSource().equals(jCombobox1)) { Yearsel = jCombobox1.getSelectedItem().toString(); } if (e.getSource().equals(mjCombobox1)) { Yearsel = mjCombobox1.getSelectedItem().toString(); } if (e.getSource().equals(jCombobox2)) { Sectionsel = jCombobox2.getSelectedItem().toString(); } if (e.getSource().equals(mjCombobox2)) { Sectionsel = mjCombobox2.getSelectedItem().toString(); } if (e.getSource().equals(jCombobox3)) { Namesel = jCombobox3.getSelectedItem().toString(); accessDBMod(Namesel); } if (e.getSource().equals(jComboboxq1)) { Combo1sel = jComboboxq1.getSelectedItem().toString(); } if (e.getSource().equals(jComboboxq2)) { Combo2sel = jComboboxq2.getSelectedItem().toString(); } if (e.getSource().equals(jcbsid)) { sid = jcbsid.getSelectedItem().toString(); accessfees(sid); } }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 77
} //---------------------------------------------------------- END__ RadioListener -------//=============================================== ============ START CheckBoxListener ===== class CheckBoxListener implements ItemListener { public void itemStateChanged(ItemEvent e) { Object source = e.getItemSelectable(); if ((e.getStateChange() == ItemEvent.SELECTED) && (source==Intermediate)) { Intermediatesel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==Intermediate)) { Intermediatesel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==PHOTO)) { PHOTOsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==PHOTO)) { PHOTOsel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==TransferCERT)) { TransferCERTsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==TransferCERT)) { TransferCERTsel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==CHARCERT)) { CHARCERTsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==CHARCERT)) { CHARCERTsel = 0; }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 78
if ((e.getStateChange() == ItemEvent.SELECTED) && (source==mIntermediate)) { mIntermediatesel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==mIntermediate)) { mIntermediatesel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==mPHOTO)) { mPHOTOsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==mPHOTO)) { mPHOTOsel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==mTransferCERT)) { mTransferCERTsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==mTransferCERT)) { mTransferCERTsel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==mCHARCERT)) { mCHARCERTsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==mCHARCERT)) { mCHARCERTsel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==jCheckboxq1)) { StudentIDsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==jCheckboxq1)) { StudentIDsel = 0; }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 79
if ((e.getStateChange() == ItemEvent.SELECTED) && (source==jCheckboxq2)) { StudentNamesel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==jCheckboxq2)) { StudentNamesel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==jCheckboxq3)) { Addresssel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==jCheckboxq3)) { Addresssel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==jCheckboxq4)) { FathersNamesel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==jCheckboxq4)) { FathersNamesel = 0; } if ((e.getStateChange() == ItemEvent.SELECTED) && (source==jCheckboxq5)) { qSexsel = 1; } if ((e.getStateChange() == ItemEvent.DESELECTED) && (source==jCheckboxq5)) { qSexsel = 0; } } } //--------------------------------------------------------- END CheckBoxListener ------///////////////////////////////////////////////// //////////////////////////////////////// }
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 80
9. Screen-shots:
9.1. To run the software:
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 81
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 82
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 83
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 84
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 85
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 86
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 87
o o o
I NSTITUTE
OF
P ROFESSIONAL E XCELLENCE
&
M A N A G E M E N T , G Z B 88