Thana Bujakorn

Greenhorn
+ Follow
since Dec 18, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Thana Bujakorn

Does anyone know if I can ask for the new one. The one sent to me had been destroyed by my dog. (The postman must had been frighten by him while trying to put it in the mail box! I guess he then drop it over the fence. And guess! He destroyed it before peeing on it). . Now I'm very piss off with him. All I got left was one card, one pin and few bit and pieces of yellow paper. One more question, do I have to pay for it?
Thanks a lot
20 years ago
Well Done! Good luck for SCWCD
20 years ago
I passed it with 67%. The preparation I did was to study really hard on K&B book, the one and only for 4 days. I didn't have time to do any mock up exams only the questions at the back of each chapter. I personlly believe that if you read K&B book and understand them all (I estimate that, with 12 hrs/day it would take me a week and a half to do that), You could pass this exam with 95% up. This is the only one reference you ever needed.
20 years ago
I think line 6 is wrong, it should be
In my opinion, it should compile just fine.


It doesn't seem to violate any of the exception rules. You must declare that a method "throws" exception or provide a catch clause for it only if it is checked exception. RuntimeException and its subclasses are considered unchecked.
Hi

Could anyone please tell me?
I purchase a voucher with expire date on June 24 2005, Does that mean I must sit for the exam before the date, or Does it mean I must register with prometric before the date? In the first case, what should I do if im not ready by then? Can I extend the time?

Thanks
Hi, Merry Chrismas all.
I try to put my web page with an applet on my Geocities page, it doesn't work (I have jre 1.4 running and covert my html file using Sun HTML converter. Does anyone know why?
Thanks in advance
21 years ago
There are differences b/w: length and length(), i modified your prog, hope it will help you understand better.

[ December 23, 2002: Message edited by: Marilyn de Queiroz ]
21 years ago
Hi
I need to do an animation with series of pictures. The only way I know is to use the Timer Object, but its constructor required an event to trigger the animation in the panel. The problem is that, the animation will be driven by a method from another class, not the GUI and therefore, has no event. How do I create anevent in this case? Or any other suggestions!? Please help! Thanks
21 years ago
I took a whole day try to fig it out! herrrr, how dump? Thanks a lot.
21 years ago
Thanks so much for the reply, and in case my question is ambiguity, here is what I try to ask, how could I avoid using staic keyword for People object and createPerson() method, are there any other techniques? The reason is this, if I want to, says, add more method(s) to the SimManager class and the method deal with person object, for example isplayPanel.addPerson(person); the compiler error : non-static variable displayPanel cannot be referenced from a static context
displayPanel.addPerson(person); occurs everytime, which is again can be overcome by static keyword. I read from the book (could you please tell me if my understanding is right about this) that using static keword should be avoid as it violates a good object oriented programming practice.
I also miss typed the constructor for SimManager class. The correct two classes are:
//****************************************
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Simulator extends JApplet{
protected JButton floor1Button, floor2Button;
protected JPanel buttonPanel;
protected JTextArea ta;
protected BuildingCanvas buildingCanvas;
protected SimManager manager;
protected BorderLayout mainLayout;
ButtonHandler handler;

public void init(){

mainLayout = new BorderLayout();
Box b = Box.createHorizontalBox();
ta = new JTextArea(3,45);
ta.setLineWrap(true);
b.add(new JScrollPane(ta));

buttonPanel = new JPanel();
floor1Button = new JButton("Floor1");
floor2Button = new JButton("Floor2");
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(floor1Button);
buttonPanel.add(floor2Button);

buildingCanvas = new BuildingCanvas();
SimManager manager = new SimManager(buildingCanvas);

getContentPane().add(b, BorderLayout.NORTH);
getContentPane().add(buildingCanvas, BorderLayout.CENTER);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);

ButtonHandler handler = new ButtonHandler();
floor1Button.addActionListener(handler);
floor2Button.addActionListener(handler);
}

public void paint(){

}
private class ButtonHandler implements ActionListener{

public void actionPerformed(ActionEvent e){

if(e.getSource() == floor1Button)
manager.createPerson();
}
}
}
//****************************************
public class SimManager extends Object{

Person person;
BuildingCanvas displayPanel;

public SimManager(BuildingCanvas mainPanel){

displayPanel = mainPanel;
}

public void createPerson(){
Person person = new Person();
}

}
//**********************************
This is what happend when not declaring People object static:
C:\Documents and Settings\Thana\Desktop\Elevator>appletviewer Simulator.html
created
Exception occurred during event dispatching:
java.lang.NullPointerException
at Simulator$ButtonHandler.actionPerformed(Simulator.java:53)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3715)
at java.awt.Component.processEvent(Component.java:3544)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
21 years ago
I have a problem with the following code:
//***Applet Class***
...
//declaration (buildingCanvas extends JPanel)
protected BuildingCanvas buildingCanvas;
protected SimManager manager;
//init()
...
BuildingCanvas buildingCanvas = new BuildingCanvas();
SimManager manager = new SimManager(buildingCanvas);
...
//my action method is as follow
public void actionPerformed(ActionEvent e){

if(e.getSource() == floor1Button)
manager.createPerson();
}
//***class SimManager***
//declaration
Person person; // class
BuildingCanvas displayPanel;
//Constructor
public SimManager(){
displayPanel = mainPanel;
}
public void createPerson(){

person = new Person();
displayPanel.addPerson(person);
}
The problem is: I get a NullPointer exception thrown everytime I try to call manager.createPerson();by clicking the button in the Applet class. The problem can be solved by declaring both variables(Person and BuildingCanvas) of SimManager static, what I wonder is, are there any better ways to solve the problem beside declaring everything static(cause there are many more of similar variables that need to be accessed in similar manner? Please help. and forgive me for my poor english.
21 years ago