Keshan Pillay

Greenhorn
+ Follow
since May 21, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Keshan Pillay

I believe I've read before (I'll try and look it up to cite this) that with Jbuttons you set the mnemonic but you need to access it with the 'ALT' key.
So try 'ALT + B' etc. Let me know.

I cant find the documentation however...

JavaDocs

This is a little SSCCE example from the website which is a JButton with the Mnemonic 'A' set to it. Indeed, if you press 'A' nothing happens
however if you try 'Alt + A' then the button is pressed.
10 years ago
oh! I got it! I changed "at.rotate(Math.toRadians(angle), w/2.0, h/2.0); " to

at.rotate(angle, w/2.0, h/2.0);

now it works!

only there are these vertical black boxes shadowing the original position of the icons =p
12 years ago
Thank you for your reply. Actually, all the code I presented was given to us as a skeleton for the assignment. The everything was given, and certain
parts are missing.

// FOR YOU... (these are parts we need to complete)


rotateImageIcon is the method I had a go at completing. It hasn't seemed to worked.
12 years ago
Hello Everyone! Thank you for taking the time to look at my thread.
I have an assignment to do on concurrency. That's fine, however I face an initial hurdle.

This assignment is based on the dining philosophers problem.
I can change the number of philosophers at present by changing the appropriate variable in the code. I'm supposed to rotate the
philosophers around the table so they all "face" the centre, but at present they all remain upright around the table.

The rotateImageIcon method is the one I need to implement. It is stated in the handout that it is called in the correct places, and that we just need to implement it. Initially it is empty, except for the return statement "return picture".
What is currently within the method is my attempt.

We were given a URL as a hint.
This is the URL

However I can't seem to make any headway =[ I would appreciate it if someone could please push me in the right direction =]

Here is my code, and thanks again =D









Cheers!
12 years ago
Hi thanks very much for your response. However, what I meant to say but I forgot was: Assume that I want this method to be executed ALWAYS, AND, assume that someone else has access to my subclasses. They will override my method, but how can I still guarantee that a particular command called in the superclass' method is called, regardless if they change the implementation in the subclass.

Cheers!
13 years ago
Thanks for checking this out =]

What I would like to know is, if I have a superclass: A and a subclass B with a particular method in A and that method is overriden in B.
Lets say that A has a certain function...maybe to paint text. How can I guarantee that this function is always called, and that it cannot be changed in
the overriden classes?

Many thanks
13 years ago
Thanks for the reply! Hmm, I kind of understand...but how does this guarantee that the shapes MUST have the text?
13 years ago
Hi everyone! Thank you for looking at my thread.

I'm in the middle of an assignment for a cs course on OOP, and I have to use template method to accomplish a particular task.
I was wondering if someone could explain the template method to me in simple terms or link me somewhere where it's explained well.
I've googled it and the notes online don't make much sense to me.

My current task: I have Shape superclass, and various shape type subclasses. The paint method is defined in Shape, and implemented in the subclasses. Now, one of the constructors in Shape, allow for text to be printed on the shape being displayed. What I need to do is, assume that someone else can edit my subclasses, but not my Shape class (they only have the byte code for it ;D ) and If a shape has text, I have to guarantee that it's displayed, and that the text cannot be changed or removed by the subclasses.
I'm pretty certain I have to use the template method for this, so like I said, if anyone could explain it to me or such that would be wonderful and most appreciated.

Many thanks,
Keshan Pillay =]

EDIT: I apologise if this is in the wrong board, but I don't know what level of Java this is, but I'm pretty sure it's not beginner =D
13 years ago
Hey thanks for the reply. I can't say that your "clue" helped me very much, I already had the tree, but I should have mentioned that. But I managed to get it in the end, so thanks anyway!
13 years ago
Firstly, thanks to everyone for answering my previous topics, my assignment is going really well. I'm now on part 2, and I need to construct a binary tree from its post-order and in-order traversals. The sample traversals given were:

Inorder traversal: ADHGKLMRUVTW
Postorder traversal: AHDLKGUVRWTM

Can someone please help me with the algorithm to complete this process?

Many thanks,
Yoonsi
13 years ago
Hello everyone! Thanks for checking out my topic.
What I need to do for this assignment, is I need to pass a string as an argument to my program. Then I need to put the letters into a binary search tree. I successfully managed to pass the string, say..."MGABDF" and then I used a for loop, and string.chatAt() to put each letter of the String into an array for easier access later. What i'm having trouble with, is my use of the binary search tree. I'm quite stuck actually.


This is what i've got so far and i can't seem to set the root. Let me know if you need to see the code for the BinarySearchTree and TreeNode.

Many Thanks.
13 years ago
Hello everyone!

Could someone please explain what an abstract class is and what it's used for? I'm having trouble grasping the concept. I've also been unable to find anything online that is helpful to me personally. If think something might help, please link!

Many Thanks
13 years ago
Thanks for the reply! I got it sorted! turns out I had to make a file I/O method, because the calculations were in a text file, and then pass the textfile as an argument through the command prompt.
13 years ago
Hey everyone! I have to make a postfix calculator, and I think i'm pretty sorted as to the code for it. However, something that confuses me is:



I use textpad to do my editing, compiling etc. I've been told I need to pass a textfile, as an argument? Or I'm just confused... How do I do this? I think its something to do with run parameters.

Many Thanks
Keshan Pillay
13 years ago
Thanks for your reply Rob, It really helped me out, and I've got it sorted. ^^
13 years ago