lakmal padmakumara

Ranch Hand
+ Follow
since Aug 08, 2009
Merit badge: grant badges
For More
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 lakmal padmakumara

Thanks for the reply Darryl ! It helped!!
13 years ago
Thank you Stephen for the quick reply !

I tried with Jpanel without any luck ! It didnt work for me ! But then I came across the concept of this "Box" container where we can create a Box using the static method createHorizontalBox(); Now It is working fine except for the fact that I cannot control the width of the Box.When I have some long names as the nodes in a Jtree Box fails to show the full name. Can anyone give me a better way to do it ? is it possible using a JPanel ?

Thanks in advance!
13 years ago
Hi there,



In the above code shortCutPane is a JScrollPane and the getFileTree(path) returns a JTree. No problems occurs when I call this statement only once .The JTree component get added to the ScrollPane. But when I call this statement again at runtime the new JTree replaces the existing ones where originally I want to keep all of them on the ScrollPane.

How can I add multiple JTree components to a ScrollPane at runtime ?

Any Help would be much appreciated .Thank you !
13 years ago
Congratulations
13 years ago
Keep that in my mind java always use pass by value.But in object passing the idea may be little bit ambiguous.Because what you pass is the bit pattern of the reference variable . So when you pass the bit pattern ,the reference in the method will point to the same object .So if you update one other will get changed.But if you try to say something like i=new int[3]; then you create a completely different object.
Actually when you assign a new array object to the i in the change i method you create two different arrays.
Try this code


This will explain it better.
Edited :To give code example
I think you will have to test the second condition manually.Using some String manipulation.
13 years ago
when you change

to

you have said GoodBye to your main method. That's another static method which only allows to be use inside the same package.
13 years ago
Several things to consider ,
According to your code "input" isn't an array.It's a String object .Your arrayLookALike name is "numbers".And That is a wrong way of declaring an array. It should be


JOption method returns a String .So Using these tips try to change your code.You will be having a good time then
13 years ago
Change to


Do you get idea now ?
David is spot on.Another easy example would be think you have a class Call Egg .So you can create Egg objects using that class .Now you might be having several instance variables which describes a particular egg like eggColor .eggSize . So these are instance variables .Value of those variables are unique to that particular object .And You cannot have a eggColor unless you already got an Egg Object.So remember you can never use instance variables without creating a actual object.

Now you also want to keep track of how many eggs do you have in your System. So this howManyEggs variable is not unique to each and every egg object.It is a common attribute to all the eggs .

If you ask from egg1 :Hey What is your color ? He might say I'm white
If you ask from egg2: Hey what is your color ? He might say I'm yellow

But if you ask How many eggs are in the system by them both should give the same answer.So noOfEggs is a attribute represents the class Egg.So use a class member(attribute) to represent it.

Hope this will Help!
13 years ago
Btw when you comment the hashCode() method (use the default method) then all your objects will be in the same bucket .Now compile and run it .Then you will see the expected answer.
This is the exact thing I explained earlier .You can pass a string value to Boolean constructor and it doesn't check for Case sensitiveness. Whether you pass TRuE TRUE or true it makes a boolean Wrapper object of true value.

printf only returns false if you convert a boolean false value to a boolean.Here what you pass is a String object ("FAlse").Whether you change it to "false" it still returns true, until you pass a boolean false value .

check this code