468,740 Members | 1,982 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,740 developers. It's quick & easy.

Simple Hotel Front-Desk System.

539 512MB
This is for my friend. He is a HRM student and was assigned to demo on how to operate a Simple Hotel front-desk system.

I've searched on the net to help him, but all of those freeware softwares are difficult to handle and manipulate.....

My last option is to create a program for him.
Easy to deploy and no hustle to maintain version.
First version is to implement it through "Pure file handling"
Second is to use a database.

(Adding to my experience while learning java)

Im now starting @ first version

Im now designing this program which i call it Simple Hotel Front-Desk System.

There are 17 values that should be handled in every guest's data

eg. complete guest's name, contact numbers etc.....

What came first on my mind is to implement them with few arrays
The purpose is to manipulate them carefully ( an experiment )

I doubt about the other options to reimplement it in a safer handling.

Can you advice me experts? about how to implement it more safer?
Maybe arraylist, but for me it is more heavy to implement when it comes to updating those values inside of it if the primary value ( primary key in database ) will be changed in position

This is for the first version, "pure file handling"

Im waiting for your replies,
sukatoa
May 5 '08 #1
41 2732
JosAH
11,448 Expert 8TB
Never, ever go the route of those silly arrays:

Expand|Select|Wrap|Line Numbers
  1. String[] firstName;
  2. String[] lastName;
  3.  
Java compilers should forbid such code and wipe your harddisk for it. Better think
of your data model a bit more, especially when you want to take the route of a
RDBMS for storage purposes. What comes to mind is:

Expand|Select|Wrap|Line Numbers
  1. interface PK extends Comparable<PK> { .. }
  2. ...
  3. interface Record {
  4.    PK getPrimaryKey();
  5. }
  6. ...
  7. class Table extends HashMap<PK, Record> { ... }
  8.  
but never go for that silly arrays route.

kind regards,

Jos
May 5 '08 #2
sukatoa
539 512MB
Never, ever go the route of those silly arrays:

Expand|Select|Wrap|Line Numbers
  1. String[] firstName;
  2. String[] lastName;
  3.  
Java compilers should forbid such code and wipe your harddisk for it. Better think
of your data model a bit more, especially when you want to take the route of a
RDBMS for storage purposes. What comes to mind is:

Expand|Select|Wrap|Line Numbers
  1. interface PK extends Comparable<PK> { .. }
  2. ...
  3. interface Record {
  4.    PK getPrimaryKey();
  5. }
  6. ...
  7. class Table extends HashMap<PK, Record> { ... }
  8.  
but never go for that silly arrays route.

kind regards,

Jos
Ok, im on my way to hashmap..... Thank you....

This program's max data set input is limited to 100.

It is ok if i implement a class that uses Collator setting it into PRIMARY strength to compare all of those datas?
(For Black List Search Feature purposes)

Im afraid im starting again a bad idea... hope not.....

Thanks for your reply Jos,
It really helps
May 5 '08 #3
JosAH
11,448 Expert 8TB
Ok, im on my way to hashmap..... Thank you....

This program's max data set input is limited to 100.

It is ok if i implement a class that uses Collator setting it into PRIMARY strength to compare all of those datas?
(For Black List Search Feature purposes)

Im afraid im starting again a bad idea... hope not.....

Thanks for your reply Jos,
It really helps
There's a small hotel just a few blocks away from me; it has 120 rooms so I can't
sell them your software then? How silly ...

Most of the time ideas aren't bad, it's the implementations that are extremely bad.
Better think about the requirements a bit more and think about your object model
first before you start thinking about nifty data structures.

kind regards,

Jos
May 5 '08 #4
sukatoa
539 512MB
There's a small hotel just a few blocks away from me; it has 120 rooms so I can't
sell them your software then? How silly ...

Most of the time ideas aren't bad, it's the implementations that are extremely bad.
Better think about the requirements a bit more and think about your object model
first before you start thinking about nifty data structures.

kind regards,

Jos
Yah, i got it, thanks again...
May 5 '08 #5
sukatoa
539 512MB
Here is what i've done so far on the experiment

Expand|Select|Wrap|Line Numbers
  1. import java.util.HashMap;
  2. import java.util.Iterator;
  3. import java.util.ArrayList;
  4. import java.util.Scanner;
  5. import java.util.Random;
  6.  
  7. public class HashMapTest{
  8.  
  9.     HashMap<String,ArrayList> table = new HashMap<String,ArrayList>();
  10.     ArrayList<String> list;
  11.     Scanner scan = new Scanner(System.in);
  12.     int key = 0; //UniqueKey
  13.     Random r = new Random();
  14.  
  15.     public static void main(String sukatoa[]){
  16.         new HashMapTest();
  17.     }
  18.  
  19.     public HashMapTest(){
  20.         while(true){
  21.             try{
  22.                 System.out.print("[1]Add\n[2]Show\n\n[3]Exit  ");
  23.                 int t = Integer.valueOf(scan.next());
  24.                 switch(t){
  25.                     case 1:add();break;
  26.                     case 2:show();break;
  27.                     case 3:scan.close();System.gc();System.exit(0);
  28.                     default: continue;
  29.                 }
  30.             }catch(Exception e){
  31.                 System.out.println("\nWrong input\n\n\n");
  32.             }System.gc();
  33.         }
  34.     }
  35.  
  36.     void add(){
  37.         list = new ArrayList<String>();
  38.         list.add("Surname: ".concat(getRandomValue()));
  39.         list.add("Firstname: ".concat(getRandomValue()));
  40.         list.add("MiddleName: ".concat(getRandomValue()));
  41.         list.add("Address: ".concat(getRandomValue()));
  42.         list.add("CompanyAddress: ".concat(getRandomValue()));
  43.         list.add("Landline: ".concat(getRandomValue()));
  44.         list.add("Mobile: ".concat(getRandomValue()));
  45.         list.add("Fax: ".concat(getRandomValue()));
  46.         list.add("Email: ".concat(getRandomValue()));
  47.         list.add("Room Type: ".concat(getRandomValue()));
  48.         list.add("Room Number: ".concat(getRandomValue()));
  49.         list.add("Additional Guests: ".concat(getRandomValue()));
  50.         list.add("Their Names: ".concat(getRandomValue()));
  51.         list.add("Payment Type: ".concat(getRandomValue()));
  52.         list.add("Arrival & Departure: ".concat(getRandomValue()));
  53.         list.add("Billing Arrangement: ".concat(getRandomValue()));
  54.         list.add("Desk Clerk: ".concat(getRandomValue()));
  55.         table.put(getUniqueKey(),list);
  56.         key++;
  57.     }
  58.  
  59.     void show(){
  60.         Iterator i = table.keySet().iterator();
  61.         while(i.hasNext()){
  62.             String t = (String)i.next();
  63.             System.out.println("\n\n"+t);
  64.             for(Object entry : table.get(t)){
  65.                 System.out.println("\t-"+entry);
  66.             }
  67.         }
  68.     }
  69.  
  70.     String getUniqueKey(){
  71.         return String.valueOf(key);
  72.     }
  73.  
  74.     String getRandomValue(){
  75.         return String.valueOf(r.nextInt(500));
  76.     }
  77. }
  78. }
since the returned elements are not in particular order. (iterator)

I have no idea how to implement like

(unless this set is an instance of some class that provides a guarantee). this comes from the API iterator method on Set
Can you advice me how to deal about it?

it should be 0 1 2 3 4 5 6 7 8 etc....

Is there a safer way to sort this first after showing the output?

May idea is,
to get all of those key, store in an array... sort,
and iterate to get the list by using

table.get(key) where key is from an sorted array.....


waiting for you replies,
sukatoa
May 6 '08 #6
r035198x
13,262 8TB
Have a look at TreeSet.

Also read the initializers article for where to put all those add calls.
May 6 '08 #7
sukatoa
539 512MB
Have a look at TreeSet.

Also read the initializers article for where to put all those add calls.

Copy that,

Thanks for the reply.
sukatoa
May 6 '08 #8
JosAH
11,448 Expert 8TB
I still think this is a silly array solution in disguise. Those data members (first name,
last name, payment etc.) belong in another class object, say, Reservation.
Such a Reservation object should be able to cough up a unique primary key
and it should override equals, hashCode and be Comparable at least; oh,
before I forget make the Reservation class implement the Serializable object.

Also don't, I repeat don't stick all that input jam in the Reservation class and
especially not in its constructor. This is intended as positive criticism but don't
mix all that I/O stuff in your classes. Separate that stuff into a ReservationFactory
class and the Reservation class itself.

As I wrote: ideas are not that bad; implementations are bad and yours' is going
to be one if you don't take care.

kind regards,

Jos
May 6 '08 #9
sukatoa
539 512MB
Such a Reservation object should be able to cough up a unique primary key
and it should override equals,
I have doubt about this. Can you explain it further Jos?

Separate that stuff into a ReservationFactory
class and the Reservation class itself.
That was one of my plan.... now confirmed... :)

As I wrote: ideas are not that bad; implementations are bad and yours' is going
to be one if you don't take care.
I should care of it.

Thanks for the reply. :)
sukatoa
May 7 '08 #10
JosAH
11,448 Expert 8TB
I have doubt about this. Can you explain it further Jos?
Given those records you showed us; think of questions you want to be able to
answer:

- is room X taken? if so, show the inhabitants' details.
- family Y leaves; what do they have to pay?
- family Z wants three rooms; are they available?
- etc.

for each of those questions you want to iterate over certain rooms, associated
with certain primary keys to do it fast.

kind regards,

Jos
May 7 '08 #11
sukatoa
539 512MB
Given those records you showed us; think of questions you want to be able to
answer:

- is room X taken? if so, show the inhabitants' details.
- family Y leaves; what do they have to pay?
- family Z wants three rooms; are they available?
- etc.

for each of those questions you want to iterate over certain rooms, associated
with certain primary keys to do it fast.

kind regards,

Jos
Ok, i got it. I doubt about what kind of primary key should i use. It should be one of the records.

My choice is the room number, since room number never be duplicated....
What's the advantage when it choose this to be the prime key?

What can you suggest?

About comparing Strings.

Which is a little bit faster when comparing?
Expand|Select|Wrap|Line Numbers
  1. Collator.compare(st 1,st 2) 
that was set to PRIMARY strength

or
Expand|Select|Wrap|Line Numbers
  1. String.compareToIgnoreCase(another string)
Waiting for your replies,
Sukatoa
May 7 '08 #12
r035198x
13,262 8TB
Ok, i got it. I doubt about what kind of primary key should i use. It should be one of the records.

My choice is the room number, since room number never be duplicated....
What's the advantage when it choose this to be the prime key?

What can you suggest?

About comparing Strings.

Which is a little bit faster when comparing?
Expand|Select|Wrap|Line Numbers
  1. Collator.compare(st 1,st 2) 
that was set to PRIMARY strength

or
Expand|Select|Wrap|Line Numbers
  1. String.compareToIgnoreCase(another string)
Waiting for your replies,
Sukatoa
Primary key : Room number is OK if you don't have duplicates for them (you could if you have many floors and reset the count on each floor).
Comparing Strings? Just use the equals or equalsIgnoreCase method.
May 7 '08 #13
sukatoa
539 512MB
Primary key : Room number is OK if you don't have duplicates for them (you could if you have many floors and reset the count on each floor).
Comparing Strings? Just use the equals or equalsIgnoreCase method.
Thanks, im on my way.....

Thanks again....
May 7 '08 #14
sukatoa
539 512MB
Just a quick,

What if i will not serialized my classes...
eg. not setting the serialVersionUID....
What will happen to my program?
What will be the disadvantage of doing like this?

waiting for your replies,
sukatoa
May 10 '08 #15
JosAH
11,448 Expert 8TB
Just a quick,

What if i will not serialized my classes...
eg. not setting the serialVersionUID....
What will happen to my program?
What will be the disadvantage of doing like this?

waiting for your replies,
sukatoa
Nothing much will happen, you just can't serialize instances of your classes then.
It depends on what you want to do with those instances.

kind regards,

Jos
May 10 '08 #16
sukatoa
539 512MB
Nothing much will happen, you just can't serialize instances of your classes then.
It depends on what you want to do with those instances.

kind regards,

Jos
Thanks for the reply Jos.

I don't no what should be the most important about it. Other says, they will be useful if i will implement it through a module type updating of a software.

As an exception occurs when the serialVersionUID of the software is not exactly/logically equal to the module to be used for updating the said software..
It is true?

By the way, i will not delete those settings, maybe this might be useful soon...
(Obviously im not aware of it)....

Here we go,

About for each statement,

which is faster,

Expand|Select|Wrap|Line Numbers
  1. for(Object store:ROOMS.getUniqueKeys(true).toArray()){
  2.                 dlm.addElement(store);
  3.             }
or

Expand|Select|Wrap|Line Numbers
  1. Object[] t = ROOMS.getUniqueKeys(true).toArray();
  2. for(Object store:t){
  3.                 dlm.addElement(store);
  4.             }
I doubt about the REAL algorithm of for:each statement....

Can you discuss me here Jos? and somebody here in java forum who knows the real algo of for:each statement(they way it performs).....
Or the best URL you know that explains it well?

Waiting for your replies,
sukatoa <----- stucked.
May 10 '08 #17
JosAH
11,448 Expert 8TB
What is the return type of getUniqueKeys()? If it is a collection you don't have
to turn it into an array first to use the new for-each loop.

kind regards,

Jos
May 10 '08 #18
sukatoa
539 512MB
What is the return type of getUniqueKeys()? If it is a collection you don't have
to turn it into an array first to use the new for-each loop.

kind regards,

Jos
Thanks for the reply,

An ArrayList that contents all the keys to be shown on the JList....

dlm is an object of DefaultListModel.
May 10 '08 #19
JosAH
11,448 Expert 8TB
Thanks for the reply,

An ArrayList that contents all the keys to be shown on the JList....

dlm is an object of DefaultListModel.
If that is so you can do a simple:

Expand|Select|Wrap|Line Numbers
  1. for (Room room : getUniqueKeys(true))
  2.    dlm.addElement(room);
  3.  
The getUniqueKeys() method returns a Collection (an ArrayList) which can be
used directly in that for-each loop.

kind regards,

Jos
May 10 '08 #20
sukatoa
539 512MB
If that is so you can do a simple:

Expand|Select|Wrap|Line Numbers
  1. for (Room room : getUniqueKeys(true))
  2.    dlm.addElement(room);
  3.  
The getUniqueKeys() method returns a Collection (an ArrayList) which can be
used directly in that for-each loop.

kind regards,

Jos
Ooppss!!! Let me correct my phrase...

An ArrayList that contains all the keys to be shown on the JList....

Im sorry, i forgot to say Jos.....

ROOM is an object created from my DataSetHandler class...
( a public class that implements Serializable and takes care of data sets ).
May 10 '08 #21
JosAH
11,448 Expert 8TB
Ooppss!!! Let me correct my phrase...

An ArrayList that contains all the keys to be shown on the JList....

Im sorry, i forgot to say Jos.....

ROOM is an object created from my DataSetHandler class...
( a public class that implements Serializable and takes care of data sets ).
It still doesn't matter: if that method returns a List of some sort you can still use
that for-each loop on it; no need to build an array out of it first and use that loop
on the array.

kind regards,

Jos
May 10 '08 #22
sukatoa
539 512MB
It still doesn't matter: if that method returns a List of some sort you can still use
that for-each loop on it; no need to build an array out of it first and use that loop
on the array.

kind regards,

Jos
That example you've posted is really new to me...
I'll try and update the results...
May 10 '08 #23
JosAH
11,448 Expert 8TB
That example you've posted is really new to me...
I'll try and update the results...
Read this.

kind regards,

Jos
May 10 '08 #24
sukatoa
539 512MB
That example you've posted is really new to me...
I'll try and update the results...
Ok, That scenario happens on my main class named Hotel....

Can't find Symbol..... I doubt...

parameter of addElement is Object type....

maybe i can just invoke the getUniqueKeys if my DataSetHandler was extends on my Main class.....

But it was already extends on JFrame...

Please correct me if i forgot something to adjust.....
May 10 '08 #25
sukatoa
539 512MB
Ahhh, ok... i got an idea....

Here is the current method that implements the for each....

Expand|Select|Wrap|Line Numbers
  1. private void UpdateRoomList(){
  2.         if(RetrieveRoomList()){
  3.             dlm.removeAllElements();
  4.             Object[] t = ROOMS.getUniqueKeys(true).toArray();
  5.             for(Object o:t)
  6.                 dlm.addElement(o);
  7.         }else{
  8.             shw.showMessageDialog(null,
  9.                 "An error occured while updating the list on room preference",
  10.                 "Report to the Developer ASAP..",1);
  11.         }
  12.     }
Maybe your example is not applicable on the method's design....
But im impress the way how it simplified... base on the URL you've post....

I should change this...

Thanks Jos,
sukatoa
May 10 '08 #26
JosAH
11,448 Expert 8TB
Ahhh, ok... i got an idea....

Here is the current method that implements the for each....

Expand|Select|Wrap|Line Numbers
  1. private void UpdateRoomList(){
  2.         if(RetrieveRoomList()){
  3.             dlm.removeAllElements();
  4.             Object[] t = ROOMS.getUniqueKeys(true).toArray();
  5.             for(Object o:t)
  6.                 dlm.addElement(o);
  7.         }else{
  8.             shw.showMessageDialog(null,
  9.                 "An error occured while updating the list on room preference",
  10.                 "Report to the Developer ASAP..",1);
  11.         }
  12.     }
Maybe your example is not applicable on the method's design....
But im impress the way how it simplified... base on the URL you've post....

I should change this...

Thanks Jos,
sukatoa
No need to do it that way if the getUniqueKeys() method returns a List of some sort:

Expand|Select|Wrap|Line Numbers
  1.             for(Object o: ROOMS.getUniqueKeys(true))
  2.                 dlm.addElement(o);
  3.  
kind regards,

Jos
May 10 '08 #27
sukatoa
539 512MB
No need to do it that way if the getUniqueKeys() method returns a List of some sort:

Expand|Select|Wrap|Line Numbers
  1.             for(Object o: ROOMS.getUniqueKeys(true))
  2.                 dlm.addElement(o);
  3.  
kind regards,

Jos
Wow, i thought that was not possible to implement....
Thinking that all values of the list are Objects.... :) I amazed...

Thanks Jos,

When we compare the code

Expand|Select|Wrap|Line Numbers
  1. ArrayList al = ROOMS.getUniqueKeys(true);  
  2. for(Object o: al)
  3.       dlm.addElement(o);
to your example,

Does it make any sense? Which should be the better/faster one?
May 10 '08 #28
JosAH
11,448 Expert 8TB
Wow, i thought that was not possible to implement....
Thinking that all values of the list are Objects.... :) I amazed...

Thanks Jos,

When we compare the code

Expand|Select|Wrap|Line Numbers
  1. ArrayList al = ROOMS.getUniqueKeys(true);  
  2. for(Object o: al)
  3.       dlm.addElement(o);
to your example,

Does it make any sense? Which should be the better/faster one?
That makes sense and it doesn't differ much from my example, you are just using
a needles local variable. Your previous versions however created an explicit array
and you looped over the array.

Your next step should be to use generics for type safety, i.e. that list of yours
doesn't contain just Objects, it contains something more specific.

kind regards,

Jos
May 10 '08 #29
sukatoa
539 512MB
That makes sense and it doesn't differ much from my example, you are just using
a needles local variable. Your previous versions however created an explicit array
and you looped over the array.

Your next step should be to use generics for type safety, i.e. that list of yours
doesn't contain just Objects, it contains something more specific.

kind regards,

Jos
Ok....

Thank you very much....
May 11 '08 #30
sukatoa
539 512MB
After few weeks of developing.... ( slow development ) :(

Im now facing a problem that i've never encountered before...

And that problem is in my DataSetHandler....

I've initialized ROOMS, CURRENTGUESTS and RESERVEDGUESTS (DataSetHandler objects) as members of the main class.

@ RESERVEDGUESTS

I've made a button(EDIT) to be able to update the data that was stored on RESERVEDGUESTS....

Expand|Select|Wrap|Line Numbers
  1.          if(!jList2.isSelectionEmpty()){
  2.             Object ob = RESERVEDKEYS.get(jList2.getSelectedIndex());            
  3.             ArrayList<Object> al = new ArrayList<Object>();
  4.             al.add(RESERVEDGUESTS.getNthElement(ob,0));
  5.             al.add(RESERVEDGUESTS.getNthElement(ob,15));
  6.             al.add(RESERVEDGUESTS.getNthElement(ob,16));
  7.             DataSetHandler dsh = RESERVEDGUESTS; //<<<<<<SUSPECTED
  8.             dsh.removeDataSet(ob);
  9.             new RegisterFilter(this,true,CURRENTGUESTS,dsh,al).setVisible(true);
  10.             if(new File("schedule.temp").exists()){
  11.  
  12.             }
  13.         }
The code above is where i get stucked....
On that implementation,
I was just initializing dsh from DataSetHandler object RESERVEDGUESTS.

my purpose is to remove the specific key and its member and pass to the Dialog that manipulates the rescheduling, guest's prefered rooms etc....

RESERVEDGUESTS should not be touched... so i've created another one....
If the editing is successful(updated), then no problem because the RSVN(Reservation) number was removed and replaced by a new one or the updated one....

But if the editing was canceled, so the current values will just be refreshed...
But, after refreshing the lists,

I now can't find the key and its member.... ( nullpointerexception occured )...
I get stucked for a half an hour, tracing that F* bug.

and now it was proven 100% that the responsible for removing that key(supposed to be removed to use as a reference on editing) is the

Expand|Select|Wrap|Line Numbers
  1. DataSetHandler dsh = RESERVEDGUESTS; //<<<<<<SUSPECTED
  2.             dsh.removeDataSet(ob);
Base on my observation, the dsh and the RESERVEDGUESTS are one,
I can't imagine, because on my other implementation, there was no problem...
(That is exactly the same on this, the only difference is more keys was also removed)
Base on the snippet above(that 2 lines), What's wrong?

whatever i will do to dsh, RESERVEDGUESTS should not be changed right?
But, the RESERVEDGUESTS is affected, whatever i did to dsh, it reflects to RESERVEDGUESTS.... Please correct me( i might forgot something here)

As i've remove the key ob in dsh, the RESERVEDGUESTS also affected,
I expect that ob is still in RESERVEDGUESTS after the snippet above(2 lines)...

I tried to use clone method, that returns an object, but i get an error that says,

clone method is protected in Object class at java.lang....
If this can be the other alternative, can you show me a sample code that implements a copying of object through clone? or just a URL?

I tried this,

Expand|Select|Wrap|Line Numbers
  1. DataSetHandler dsh = (DataSetHandler)RESERVEDGUESTS.clone();
The compiler says that CloneNotSupportedException must be handled(or put a try/catch block)

Now, if that exception occurs, How can i reimplement my DataSetHandler to be able to support cloning of that object?
May 30 '08 #31
JosAH
11,448 Expert 8TB
I don't know what you're talking about (it doesn't make sense to me) but if you
want your class to be cloneable it must implement the Cloneable interface and
possibly make the clone() method public. Read the API documentation.

kind regards,

Jos
May 30 '08 #32
sukatoa
539 512MB
I don't know what you're talking about (it doesn't make sense to me) but if you
want your class to be cloneable it must implement the Cloneable interface and
possibly make the clone() method public. Read the API documentation.

kind regards,

Jos
Ok, here is an example, ( I forcely assume that String is similar to DataSetHandler )

Expand|Select|Wrap|Line Numbers
  1. String RESERVEDGUESTS = new String("I_am_who_am");
  2. String dsh = RESERVEDGUESTS;
  3.  
  4. String[] st=dsh.split("_");
  5. dsh = "";
  6. for(String s:st){
  7.        System.out.print(s+" ");
  8.        dsh = dsh.concat(s+" ");
  9. }
The code above is just to represent my problem....
Suppose dsh was initialized by RESERVEDGUESTS,

After the code
Expand|Select|Wrap|Line Numbers
  1. dsh = "";
the RESERVEDGUESTS also equal to dsh, expected to be unchanged (obviously)... But as dsh is changing, the RESERVEDGUESTS also changing....

Now, i guess when you try to print the content of the object RESERVEDGUESTS, it should still be "I_am_who_am" right?

But, it's not... just like i said, RESERVEDGUESTS is proportional to dsh...
Now, when we try to print RESERVEDGUESTS, it will show "I am who am "

I am just representing my problem on my own class, these should not, and must not happen to String....

That's my problem yesterday.....
Now, i have the solution, but needs to reconstruct a new DataSetHandler...
Here is my solution,

Expand|Select|Wrap|Line Numbers
  1. DataSetHandler dsh = new DataSetHandler(22);
  2. for(Object key : RESERVEDGUESTS.getUniqueKeys()){
  3.        dsh.addDataSet(key, RESERVEDGUESTS.getMembers(key));
  4. }
But, it consumes 4 lines of code......

So, for implementing Cloneable interface, i will try it at this moment Jos...
Thanks for your reply....
May 31 '08 #33
sukatoa
539 512MB
I wonder why static boolean variable in a Dialog doesn't reset's its value in the next invocation....

at first invoke,

Expand|Select|Wrap|Line Numbers
  1. static boolean val=false;
val is false,

after some calculations, assigning val to true then dispose,

and then invoke that dialog again,

val now sets to true, the initialization at member's field have now no effect at all...
Other datatypes that are static members are resets except val....(or all static booleans)

Why is it happening?
Whenever i call System.gc() and System.runFinalization() method
still no effect... it sets on the previous value after some processes....

initializing it with just private(declaring it with non static), no problem....

Am i forgot something here?
Jun 2 '08 #34
JosAH
11,448 Expert 8TB
Am i forgot something here?
Normally, i.e. when you don't take special precautions, after a class is loaded
by a ClassLoader it will never be released from memory by a garbage collector
anymore. A static variable is a member of the class so it will never be released
nor re-initialized anymore.

kind regards,

Jos
Jun 2 '08 #35
sukatoa
539 512MB
Thanks for you reply Jos....

Now, i have doubt what should i choose to be the primary info on a black-listed guests....

Honestly, i never tried to live on a hotel before... even just a day....

I know the other fields to be added, but, to be sure....

Here are the infos from the current guests

*Room Number
*Complete Name
*Additional Guests
*Address
*Company Address
*Contacts: landline,mobile,fax and email
*Passport Info ( Passport number and Place of issue )
*Guest's remarks
Method of Payment:
Cash,Cheque(From company/walk-in guest),Credit Card
If Credit Card --> Credit Card Number and Expiry Date...
Credit Card Info can be modified only by the admin...
(For security reasons and to protect the guests from hacking their CC)

*Arrival and Departure Time

Deposit, Discount and total Charges....
*Registered by: On duty clerk...
*Modified by: On duty clerk...

There is a button (Add to black List) that will transfer/copy the whole data from current/reserved guests to black listed guests... but, i like to remove those unnecessary data... (if any)

ergo, transfering those data that are necessary for investigations/future preferences etc....

And to save allocated values on registers and memory...( Just practicing )

Im not sure the other infos that i've choose to be added on black list....
For those info that i've choosen to be added( * ), what should be removed? what should be added?

I've searched through the web, but all i got is black listed IP addresses, and blogs, discussion... most of them sucks....

Can you help me on this? ( Im very sorry for asking this kind of questions, well!!!obviously not related to programming )
Jun 4 '08 #36
sukatoa
539 512MB
What should setFocusable(boolean literal) do on JButton?

I was trying to do such that, the button can't be clicked, or any event that can fire that component yet still on its current GUI state(Enabled),
But i still can clicked,tabbed, etc....

I don't like the button to be disabled(My eyes can't accept) :)

How can i reproduce that?
Jun 11 '08 #37
JosAH
11,448 Expert 8TB
What should setFocusable(boolean literal) do on JButton?

I was trying to do such that, the button can't be clicked, or any event that can fire that component yet still on its current GUI state(Enabled),
But i still can clicked,tabbed, etc....

I don't like the button to be disabled(My eyes can't accept) :)

How can i reproduce that?
Users find it very annoying when they click on a button and nothing happens;
especially when they don't see that the button *can't* be clicked. That's what
the disabled state is for. When users tab around and the button is focusable
they can tab to it and press 'space' to click it. That's what the focusable state
is for. Some text components also have an editable state; that doesn't apply
to a button though. Pick your choice.

kind regards,

Jos
Jun 11 '08 #38
sukatoa
539 512MB
Users find it very annoying when they click on a button and nothing happens;
especially when they don't see that the button *can't* be clicked. That's what
the disabled state is for. When users tab around and the button is focusable
they can tab to it and press 'space' to click it. That's what the focusable state
is for. Some text components also have an editable state; that doesn't apply
to a button though. Pick your choice.

kind regards,

Jos
Thank you very much for the information Jos, it did help me decide. :)

Thanks again...
Jun 12 '08 #39
sukatoa
539 512MB
Project DONE....

I would like to thank JoshAH and r035198x for helping on my simple project.....
I learned something new from you guys.... :)

CHEERS,
Red Horse
Jun 14 '08 #40
JosAH
11,448 Expert 8TB
Project DONE....

I would like to thank JoshAH and r035198x for helping on my simple project.....
I learned something new from you guys.... :)

CHEERS,
Red Horse
Good; congrats. Did you deploy it already and did your friend like it?

kind regards,

Jos
Jun 14 '08 #41
sukatoa
539 512MB
Good; congrats. Did you deploy it already and did your friend like it?

kind regards,

Jos
Yah, i already send him the installer.... we we're communicating on YM last 7 or 8 hours as im still guiding him for the installation( i forgot to create a documentation about the installation guidelines)......

Successful..... and he like it... :)

Sad to think that, im developing that program over a month, and then he will just use that program for 3 days demo or a week(i think) in this semester.... hahahahhh :(

Most of the time ideas aren't bad, it's the implementations that are extremely bad.
That phrases are really inspiring(for me)....

Thanks again,
Cheers
Jun 14 '08 #42

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Dan | last post: by
6 posts views Thread by Jim M | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.