3 Replies - 27145 Views - Last Post: 03 December 2011 - 09:11 PM Rate Topic: -----

#1 SweetSarah06   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 01-December 11

Student Registration Program using a GUI

Posted 03 December 2011 - 07:31 PM

I've been working on this program and I've got the basic mechanics worked out.

Undergrad

1 array for each student = 6 arrays of size 4 each

Example:
Student1Array
[0] = 
[1] =
[2] =
[3] =

User selects Student to register from list of students

Student1
Student2
Student3
Student4
Student5
Student6

Int Index = 0

Loop until index > 4
	User clicks Student1 = Undergrad classes are displayed

	User clicks a class = class name is added to array in position [index]
	Index++


Graduate

1 array for each student = 4 arrays of size 2 each

Example:
Student01Array
[0] = 
[1] = 

User selects Student to register from list of students

Student1
Student2
Student3
Student4

Index = 0

Loop until index > 2
	User clicks Student1 = Graduate classes are displayed

	User clicks a class = class name is added to array in position [index]
	Index++
	
	


Pseudocode thoughts behind this

Undergrad

1 array for each student = 6 arrays of size 4 each

Example:
Student1Array
[0] =
[1] =
[2] =
[3] =

User selects Student to register from list of students

Student1
Student2
Student3
Student4
Student5
Student6

Int Index = 0

Loop until index > 4
User clicks Student1 = Undergrad classes are displayed

User clicks a class = class name is added to array in position [index]
Index++


Graduate

1 array for each student = 4 arrays of size 2 each

Example:
Student01Array
[0] =
[1] =

User selects Student to register from list of students

Student1
Student2
Student3
Student4

Index = 0

Loop until index > 2
User clicks Student1 = Graduate classes are displayed

User clicks a class = class name is added to array in position [index]
Index++

I'm reading about combo boxes right now. I think I want to have a combo box to display grads or undergrads and have each screen display a list of the classes available. What I need to know is how to get all these GUI elements to play nice together.

Here is my code, I messed up the copy pasta in the OP.

import java.util.*;
import javax.swing.*;


public class memoryJog
{

public static void main (String[] args)
	{
	
	Scanner input = new Scanner (System.in);
	
	int totalStudents = 10;
	int tab = 0;
	String answer;
	int index = 0;
	
	String[] Student1 = new String[4];
	
	while (tab != totalStudents)
		{
		System.out.println("Undergrads or Graduates? 1 for UG or 2 for G");
		
		answer = input.nextLine();
		
		if (answer.equals("1"))
			{
			System.out.println("Select a Student by typing their number");
			System.out.println("1. Smith, David - 777 Hell Street");
			System.out.println("2. Jane, Sarah - 839 Bullion");
			System.out.println("3. Watson, Charles - 101 Evolution");
			System.out.println("4. Young, Neil - 937 Funky");
			System.out.println("5. Thompson, Betty - 293 Sky Lane");
			System.out.println("6. Song, River - 402 TARDIS Avenue");
			
			answer = input.nextLine();
			
			if (answer.equals("1"))
				{
				System.out.println("Select a course to add by typing the number");
				System.out.println("1. Hoop Jumping 101");
				System.out.println("2. Lying Congressionally 103");
				System.out.println("3. Coping with Humanity 203");
				System.out.println("4. Busy Work 401");
				System.out.println("5. Salsa Dancing 309");
				
				answer = input.nextLine();
				
				if (answer.equals("1"))
					{
					Student1[index] = "Hoop Jumping 101";
					}
				}
			
			}
			
		else
			{
			System.out.println("Select a Student by typing their number");
			System.out.println("1. Banner, Bruce - 902 Irate");
			System.out.println("2. Wayne, Bruce - 205 Arkham");
			System.out.println("3. Pilgrim, Scott - 204 Maple");
			System.out.println("4. Skully, Dana - 355 Enigma");	
			}	
	
		}
	}
}


Is This A Good Question/Topic? 0
  • +

Replies To: Student Registration Program using a GUI

#2 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12680
  • View blog
  • Posts: 45,864
  • Joined: 27-December 08

Re: Student Registration Program using a GUI

Posted 03 December 2011 - 08:27 PM

That's a broad question. The best answer I can really answer is to look at some tutorials on GUI programming. Remember that GUIs as well are Event-Driven. It is different than writing a traditional console program, or even using JOptionPane alone. The Java GUI Framework is also designed to be extensible, so make use of OOP here.

We have some Swing tutorials on DIC, and Oracle's tutorials are really good as well.
Was This Post Helpful? 1
  • +
  • -

#3 smohd   User is offline

  • Critical Section
  • member icon


Reputation: 1825
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Student Registration Program using a GUI

Posted 03 December 2011 - 08:29 PM

Quote

What I need to know is how to get all these GUI elements to play nice together.

Are you sure you have any GUI element in your code?
But we have some GUI tutorials which may help you to get started:
Basic GUI Concepts
Basic GUI Tutorial
Was This Post Helpful? 1
  • +
  • -

#4 SweetSarah06   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 01-December 11

Re: Student Registration Program using a GUI

Posted 03 December 2011 - 09:11 PM

Sorry for being too vague. I've actually just stumbled upon this site which is helping me a lot.

http://www.javaswing.org

I'll be back if I hit any further snags. Thanks everyone!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1