This week's book giveaway is in the Agile forum.
We're giving away four copies of Fixing your Scrum and have Ryan Ripley & Todd Miller on-line!
See this thread for details.
Win a copy of Fixing your Scrum this week in the Agile forum!

Lucky Singh

Ranch Hand
+ Follow
since Jan 19, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lucky Singh

Hi,
I am trying to enter task properties for a particular task. I am using the graphical interface to create processes and tasks.

When a right click on a task, and click on Properties, I only get the following - Name, Due Date, Blocking and Assignment. However, according to the JBoss tutorial, I should get a dialog box which says - Advanced, Assignment, Controller and General in the left section.

Where is the problem?

Thanks.
14 years ago
Hi,
I am preparing for an interview that requires knowledge on Java servlets.
I have done a few academic level projects in it but would like to know if there is any website that gives a comprehensive list of all possible interview questions in Java servlets.
Thanks.
15 years ago
Thats interesting. I did study the Singleton pattern but this thought never occurred to me.
Thanks a lot. I'll try it out right away.
15 years ago
Well, thanks for thr reply. My application is a complex one in JADE where I am developing a multi agent system. So, I can't really create a new class that binds everyhting togther (although its the ideal way to do it).

But how do I solve my problem?

Class RecruitmentOfficer creates an object of JobsDB. JobsDB has a hashmap.(the only hashmap for the whle application).

OperationsManager agent wants to access this hashmap and make some searches in it. How can OperationsManager get a hold of the Hashmap?

Thanks.
15 years ago
Hi,
I have a problem quite similar to the previous post.
I have a class - RecruiterAgent who creates an object of class JobDB.

public class RecruiterAgent
{
JobDB jdb;

RecruiterAgent()
{
jdb = new JobDB();
}
}


The JobDB class is a HashMap where I enter details.
public class JobDB
{
public HashMap hm;

public JobDB()
{
hm = new HashMap();
}

public void makeEntry()
{
//Enter some keys and values into the HashMap.
}
}

Now I have a class ManagerAgent, who wants to use the JobDB object, infact, the HashMap in particular. This Manager Agent needs to make searches on the HashMap.

My application must have only 1 HashMap which has all the details.

How do I access the HashMap from my ManagerAgent?
15 years ago
Thanks a lot. I was able to solve the problem. However, I cannot understand why when I add actionListener(this) to a textbox and button, it works fine but for a JComboBox and button it gives me a class cast exception.
15 years ago
Hi,
Can someone tell me why that line is giving me an exception when I run my program?

public void actionPerformed(ActionEvent e)
{
String command = (String) ((JButton)e.getSource()).getText();
if(command.equals ("submit"))
{
nameE = nameInput.getText();
locChoices = (JComboBox)(e.getSource());****CLASS CAST EXCEPTION***
locationE = (String)(locChoices.getSelectedItem());
empAgent.processFormInfo(nameE, locationE);
}
else
{
System.out.println("The reset button was pressed");
}
} //end method actionPerformed.
15 years ago
yes, I have all that.
I just want to know how do I print the age in the method - processFormInput()?
When I do what I've written, I just get a blank, infact control does not even go to that other method.
15 years ago
Hi,
I have a clss with the following code -
public class ABC extends JFrame implements ActionListener
{
String myAge;
JButton jb;
JTextBox ageInput;

In the constructor,
//Create panels

public void actionPerformed(ActionEvent e)
{
String name = (Strng) ((JButton)e.getSource()).getText();
if(name.equals("submit"))
{
myAge = nameInput.getText();
processMyAge();
}
}

public void processMyAge()
{
System.out.println(myAge); ******NOT PRINTING THE INPUT GOT FROM THE FORM.********
//put it into a vector and return the vector to the calling class.

}
}

How do I correct the above?
15 years ago
have a GUI class that has 2 text fields and a submit and reset button.
I have added all the listeners and would like to process this form if auser clicks on the submit button.However, if he clicks on the reset button, I want the form to clear.

What should I do so that when I click the submit button, I get the values of the two text fields and when I click the reset button, the form just resets.

Below are snippets of code for the rest of my Gui.


class NameL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
nameE = nameInput.getText();
}
}

class LocationL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
locChoices = (JComboBox)e.getSource();
locationE = (String)locChoices.getSelectedItem();
}
}

class ButtonL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String name = ((JButton)e.getSource()).getText();
if(name.equals("submit"))
System.out.println("create a vector with all the values you have got " + nameE + " and" + locationE);
else
System.out.println("you have pressed the reset button and must clear all the fields");
}
}
15 years ago
Thanks for your response. Well, this is for an application using agents hence I don't have the main class.
I also have a problem here-

class ManagerGUI extends JFrame
{
String nameE, locE;
//create panels, buttons and textfields and set up the JFrame all in the
//constructor. call method addListeners();

// Then add the listeners to both form fields as follows.
void addListeners()
{
nameInput.addActionListener(new NameL());
locChoices.addActionListener(new LocationL());
}

class NameL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
nameE = nameInput.getText();
}
}

//Likewise I use a class LocL that implements ActionListener.

//Now I want to use the values got, nameE and locE. I want to do some checks and further processing. I finally want to return both these form values to another class as a vector.However, I cannot understand how do I get these values here in the ManagerGUI class and how do I send them to another class?
15 years ago
Hi,
I have a class Manager and a class ManagerGUI.

My ManagerGUI class looks somehting like this-

public class ManagerGUI extends JFrame
{
String name;
JPanel namePanel;
JTextField nameInput;
JLabel nameLabel;
Manager empAgent;

ManagerGUI(Manager ea)
{
super(ea.getLocalName());
empAgent = ea;

//make the name panel and add it to the topPanel.

addListeners();

getContentPane().add(topPanel, BorderLayout.CENTER);
setResizable(false);
}//end constructor.

public void show()
{
pack();
super.setVisible(true);
}

void addListeners()
{
nameInput.addActionListener(new NameL());
}

class NameL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
nameE = nameInput.getText();
}
}
}//end class ManagerGUI.

I have tried to seperate it out so that any changes can be easily implemented (although it perhaps is a long way of doing things).

Now I have a class Manager that wants to call the GUI and then process the information got from the text field.

I use the following lines to call the GUI class.
manGui = new ManagerGUI(this);
manGui.show();

Is this the correct way of calling the GUI class?
How do I get to use the variable nameE here, in the Manager?

Thanks,
Lucky.
15 years ago
Hi,
I am writing a simple Java swing application.
I have a class Student that calls my swing application.

public class Student
{
Student()
{
//call my swing application
}
}

public class SwingApplication extends JFrame
{
public void createGUI()
{
JFrame f = new JFrame("hello");
JButton but = new JButton("button");
f.add(but);
}
}

How do I call my createGUI() method()?
Where do I call it?
How do I compile and execute this program?

Thanks.
15 years ago
Hi,
Can you suggest some websites or books which help me design a LAN ? This is an academic project so does not involve much complexity.

Thanks
15 years ago
Hi,
DNS works on UDP. When a client wants the IP address of some server, the DNS server returns the IP address in the form of a UDP packet.
Is there any formula that held me calculate the time to get an IP address?
If not, then typically, is the RTT (round trip time) equal to almost zero?