[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4050
  • Last Modified:

Multiplex Theatre Ticket Booking System-Netbeans-MySQL-Java Project

Note: Answers and helps can be to any part of the question.

I am developing a Java Application with front end GUI developed through Netbeans with backend - MySQL Database. I passed initial hurdles. Now I am facing these troubles while development:

- How to Refresh/Redraw table after a row is added/deleted- automatically or using a jbutton. Note my table model is defaulttablemodel and note abstracttablemodel or connected to Vector.

- How to obtain values from a row in a table? I should get cell values from each column in a row and want to display in a separate textfields(look for screenshot). I used Binding- found from this site: http://netbeans.dzone.com/news/binding-jtable-swing-controls-
I received text from each cell value in a row when Binding is used. However it made my coding complex. Is there any other alternative simple way?

 I thought of this method -when a user clicks a row in a table, the following event and  code executes:
private void movTableMouseClicked(java.awt.event.MouseEvent evt) {                                      

       

    
  
           
int row = movTable.getSelectedRow();
int column = movTable.getSelectedColumn();

    Object a = movTable.getValueAt(row, column);
    
    Object b = movTable.getValueAt(row, column+1);
    
    Object c = movTable.getValueAt(row, column+2);
    
    Object d = movTable.getValueAt(row, column+3);
    
    
    
    
    movLab.setText(""+a);
    
    langLab.setText(""+b);
    
    stLab.setText(""+c);
    
    screenLab.setText(""+d);

Open in new window


In this way I can display row values in separate JTextfields. However in this case I want to make all my columns except Movie column unselectable? Otherwise error will appear. How can I select only one column of a row at a single click? The rest of the cells in a row except movie cell should be disabled. Is it possible through property options of JTable?

- I want to assign a ticket number for each ticket booked. I am planning to have 8 theater screens. Screen name: A,B,C,D,E,F,G,H or 1,2,3,4,5,6,7,8.
All the screens will have 200 seats. Each row contain 10 seats and there are 20 rows in every theater. When the first user in a day book movie in 'A'(1st) Screen and books one ticket, the ticket number assigned will be 'A001'. If he books two tickets, the ticket numbers should be 'A001', 'A002'. If he books for movie in 'C' Screen(i.e 3rd Theatre/Screen), the ticket number assigned should be 'C001'.
Ticket number once assigned should not be available to subsequent bookings. The whole process resets when the show finishes.

I think while or do while clause can do the above job.

- I want to show currents booking position of each screen(no seats remaining) after each ticket(s) is booked. I need to display remaining seats in JTextfields after each successful booking. ( Using some kind of decrementation).

There are more problems coming up...

Please suggest some ideas to simplify this project. I would like to  delete few details and components. However the basic features of a Real time Multiplex Theatre Counter Booking should remain.

Please ask me for any questions concerned.
0
octoberqueen
Asked:
octoberqueen
  • 5
  • 2
2 Solutions
 
CEHJCommented:
>>
- How to Refresh/Redraw table after a row is added/deleted- automatically or using a jbutton. Note my table model is defaulttablemodel and note abstracttablemodel or connected to Vector.
>>

Shouldn't be a problem:

http://download.oracle.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html#removeRow(int)
0
 
CEHJCommented:
>> Is there any other alternative simple way?

If you keep your text fields in an array:
int row = movTable.getSelectedRow();
	TableModel m = movTable.getModel();
	for(int col = 0;col < m.getColumnCount();col++) {	
	    textFields[i].setText(m.getValueAt(row, col).toString());
	}

Open in new window

0
 
CEHJCommented:
btw, there are too many questions in one posting - i've already answered one too many really ;)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
octoberqueenAuthor Commented:
Is there any simple way to implement my Multiplex Theatre Booking System in Netbeans JAVA?
Only requirements are there should be a JTable and  Database connectivity-MySQL.
Any simpler modification of GUI Front so that whole process can be easily done.
0
 
CEHJCommented:
There are no secret or obscure ways to get your job done.
0
 
octoberqueenAuthor Commented:
Sorry I only wanted my project to be as simple as possible. If any of you can suggest better ideas, I will be very grateful.
0
 
CEHJCommented:
:)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now