I dont know if this is asked before, pardon me if it does.
I am currently studying the basics of Object Orientation Programming, so kind of rather blur with stuff.
I have this particular "main class" which is a GUI that serves as a "Online Movie Booking System", i have not much of a problem till when i attempt to use Vectors. Another problem which i encounter is, i have 2 separate classes, how do i link to another class using a button? Is that possible?
Vectors
At first, i tired using arrays, meaning, i get the input from the textfield, and initialized them into specific arrays. But when i attempted the same with Vectors, i got error like
(Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String)
What does it mean? Oh and in addition, the code is as below
class BookHandler implements ActionListener
{
public void actionPerformed(ActionEvent evt)
{
refNum[x] = x;
int tShow1 = Integer.parseInt(topShow1[x]);
int tShow2 = Integer.parseInt(topShow2[x]);
int bShow1 = Integer.parseInt(btmShow1[x]);
int bShow2 = Integer.parseInt(btmShow2[x]);
Classes
I have got this booking class and a seating arrangement class, how do i, say... for eg. click this particular button in booking class and it links to the seating arrangment class, showing the seating arrangement? Is that possible?
FYI : Everything is displayed using JFrame, not JApplet.
It's not a matter of "linking" to another class. One of your classes will be the class which is actually being run - that'll be whichever one that extends Applet or a subclass of Applet, in the case of using a java applet.
You don't "link" to a class, you create an instance of that class, called an object. That object will then be used in the main class, in whatever way necessary. You would construct a new object pf your seating arrangement class, and show that on the screen in whatever way you have facilitated for.
>I suck at this game, can you give me some pointers?
Bookmarks