Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 23rd, 2006, 12:52 PM   #1
hemanth.balaji
Programmer
 
Join Date: May 2005
Posts: 54
Rep Power: 0 hemanth.balaji is an unknown quantity at this point
Send a message via Yahoo to hemanth.balaji Send a message via Skype™ to hemanth.balaji
Automatic Refresh of JComboBox Implementation

After the user logs in the "Student Management System" using "system" and "password" you get to view Student details. Also you get to choose a Student to delete or modify from the Combo box on the right hand top. When I select a student and delete using the delete button it gets deleted in the databse but how do i autorefresh the same in the Select student combobox...


I was not able to implement it...The code needs to be implemented in the ButtonHandler Classs. The snippet is as shown below

else if(s.equals("DELETE")){
						int returnValue  = JOptionPane.showConfirmDialog(null, "Delete Confirmation", 
											"Are you sure you wanna delete", JOptionPane.YES_NO_OPTION);
						if(returnValue == JOptionPane.YES_OPTION){
							selectedStudentname = jcmbStudentName.getSelectedItem().toString();
							String student_regNo= selectedStudentname.substring(0,7);
		  					deleteStudentRecord(student_regNo);
/*			JCOMBOBOX Refreshing Student Combo logic not implemented yet				
 * 			jcmbStudentName.addItem("Select Student Name");
						    PopulateStudentCombo();*/
						}

Note: PopulateStudentCombo() is a function used to populate the ComboBox.

The entire code for the above project is available at

http://www.java-swing-tutorial.com/student.zip

Database Created in Oracle

create table student_details (
	reg_no VARCHAR(30),
	name	VARCHAR(30),
	address	VARCHAR(50),
	fname	VARCHAR(30),
	dob	VARCHAR(30),
	phone	INTEGER,
	gender	VARCHAR(2),
	year	VARCHAR(30),
	course	VARCHAR(30),
	degree	INTEGER,
	charcert INTEGER,
	ncccert	INTEGER
);

create table student_login (
	login VARCHAR(30),
	password VARCHAR(30)
);

insert into student_login values('system', 'password');


These are the Database Specific settigns for JDBC

static String userid="scott", password = "tiger";
static String url = "jdbc:odbc:bob";


Regards,
Hemanth
Beginner Java Tutorial
hemanth.balaji is offline   Reply With Quote
Old Dec 23rd, 2006, 7:11 PM   #2
BinarySurfer
Programmer
 
BinarySurfer's Avatar
 
Join Date: Dec 2006
Posts: 50
Rep Power: 2 BinarySurfer is on a distinguished road
I finished a student database a week ago. I made a method that loaded the students onto a JList. When a student was deleted, it ran the method after the deletion was completed, basically refreshing the list being viewed. Do keep in mind to not forget to erase contents on the list before refreshing (depending on how you do it of course).
No offense, but I will never trust another programmer enough to download their code, sorry. I would look back on how you are loading the data with the "PopulateStudentCombo()". Do you have it broken down to a decent number of operations because if you did it right, it should be working. I mean, there could be something interfering in that class. Another possiblility is in your "deleteStudentRecord(student_regNo)". Are you sure the record is deleted from the database? I know it sounds stupid, but you never know.

Last edited by BinarySurfer; Dec 23rd, 2006 at 7:25 PM. Reason: One more detail
BinarySurfer is offline   Reply With Quote
Old Dec 24th, 2006, 1:08 AM   #3
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
How is downloading a bunch of text going to hurt you computer? You do run Linux, Mac, or Windows with a virus scanner right? This just looks it was copied right from a homework assignment.
Game_Ender is offline   Reply With Quote
Old Dec 24th, 2006, 8:49 AM   #4
BinarySurfer
Programmer
 
BinarySurfer's Avatar
 
Join Date: Dec 2006
Posts: 50
Rep Power: 2 BinarySurfer is on a distinguished road
I don't want to risk it. Is that such a bad thing? I care for my computer and I find it silly to make a risk without any return of benefit or profit. I know it should be text, but that doesn't mean it is. You know as well as I know that antiviruses are not perfect and all knowing, so how would it pick up on a good custom made virus? I'm just a very cautious person.
Besides, I think the help was sufficient. If he or she wants more, I'll be more than happy to comply.
BinarySurfer is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP sessions/ page refresh??? ktsirig PHP 2 Jun 1st, 2006 4:16 PM
implementation of cpuid and graph in my benchmark programm chorijan C++ 0 Sep 7th, 2005 6:27 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC