Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Simon Evans

Ranch Hand
+ Follow
since Mar 27, 2008
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 Simon Evans

Dear Henry Wong,
Thank you for your response.
I am posting this not because it deals with a new topic, but because I couldn't get a 'post a reply' button at the bottom of the post bearing your reply. I only posted that topic as 'Missing thread' 'cause I couldn't find the thread I had started yesterday, it must've been lifted, as I said, okay you say it has been moved to a forum - where? I can't see it anywhere, also it'd be listed under 'My Posts' anyway, which it isn't - it seems like its been simply erased. If it hadn't been lifted/ erased, then I wouldn't be obliged to refer to it in a new thread, Yes?
Could you tell me what was the matter with yesterday's/ this morning's thread? If you won't tell then I won't know, and can't thereby defend my position, which I reckon is an acceptable one. Can you or Campbell Ritchie tell me what is the matter, without any further shilly shallying, Please? Thank you.
hoping to hear,
Yours
Simon.
13 years ago
Dear Campbell Ritchie & programmers in general,
I started a thread yesterday November 17th on Javaranch, only to log in later today to have found it got lifted.
I was wondering why, if I may make so bold, as it would've just begun to get interesting (unless that was the problem - ie: it not being hypothetical enough for those concerned (enough to've lifted it)).
Actually, upon reflection, It has now occurred to me that you might be suspicious that my post - having given the address of another site, may be trying to advertise another site, well I was kept being asked for evidence as to what I claimed was true, as you just wouldn't accept what I said, so that is why I gave the site address for past results, anyway that address isn't the site of the subscriber's system, it is just a site of past results of the game organisers, that the system uses. I am sorry if my post sounded if it was promoting the system but as I did not give the address of the system using site, and will not be anyway, I think you must be misconstruing my intention, which is merely to find out the system's method, for my own greedy ends, and those of who want to assist.
With that matter hopefully cleared up, would it a) be possible for you to put the thread back or b) Do I start again from scratch or c) Is this thread banished forthwith never again to darken the portals of Javaranch?
Yours,
Hoping to hear,
Simon.
13 years ago
Dear Henry Wong & Ernest Friedman Hill,
I got rid of the break statements as you suggested, see code excerpt below:-

getting:-

or:-

Which I am pleased about, all the same I was wondering - only one of the switch statements is required to be

called at a time - so why aren't the 'break' statements necessary? I thought they were integral to the switch

statement - or else all the other statements would execute- okay so they don't in this case - so why didn't

they ?- sorry to be a pain- but you must've experienced similar such conundrums ie: Why isn't it not working?
Thank you for your help, all the same, hoping to hear,
Yours
Simon.
13 years ago
Dear Programmers,
I have been trying to get the following program : 'Flowers' to run.
It is meant to run off a group of subclasses to abstract class Flower.
I have been getting the following output to the console, though:-

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\simon.BLUECHIP-KDOCDA>cd c:\lab_files\Lesson_3

C:\lab_files\Lesson_3>set PATH=c:\Sun\AppServer\jdk\bin;%PATH%


C:\lab_files\Lesson_3>javac Flowers.java
Flowers.java:19: unreachable statement
break;
^
Flowers.java:22: unreachable statement
break;
^
Flowers.java:25: unreachable statement
break;
^
Flowers.java:28: unreachable statement
break;
^
Flowers.java:31: unreachable statement
break;
^
Flowers.java:35: missing return statement
}
^
6 errors

C:\lab_files\Lesson_3>

I take it therefore that the switch statment is amiss, somehow?
If so, then the error must lie with the two 'for' loops, which compiler okays now, but didn't previously.
Hoping you might be able to give me a clue.
Thank you for your attention.
Yours
Simon.
code follows:-







13 years ago
Dear Campbell Ritchie, and particularly Michael Dunn,
Thank you for putting me out of my misery.
My loops are a bit shaky, so in a perverse, twisted sort of way, I thought
I'd create a program that'd rely heavily on this subject.
These are the bits I recoded, though you probably know what they look

like:-

and


Anyhow, thank you for your expert advice.

Hoping to talk again soon.

Yours

Simon.

[ October 20, 2008: Message edited by: Simon Evans ]
[ October 21, 2008: Message edited by: Simon Evans ]
13 years ago
Dear Campbell Ritchie, and Michael Dunn, and other programmers.

Thank you for your advice.
I have seen the error in the inner loop, and had reckoned on a way to fix it.
Looking for example at the first name I'd give it:-
SIMON

In such a loop would register as:-

i j
0, 1 = (0 + 1*5) = 5
0, 2 = (0 + 2*5) = 10
0, 3 = (0 + 3*5) = 15
0, 4 = (0 + 4*5) = 20
0, 5 = (0 + 5*5) = 25

but if

were instead :

it'd read:

i j
0, 1 = (1 + 5*0) = 1
0, 2 = (2 + 5*0) = 2
0, 3 = (3 + 5*0) = 3
0, 4 = (4 + 5*0) = 4
0, 5 = (5 + 5*0) = 5

then (for ANGUS EVANS ) :-

i j
1, 1 = (1 + 5*1) = 6
1, 2 = (2 + 5*1) = 7
1, 3 = (3 + 5*1) = 8
1, 4 = (4 + 5*1) = 9
1, 5 = (5 + 5*1) = 10

and:-

i j
2 1 = (1 + 5*2) = 11
2 2 = (2 + 5*2) = 12
2 3 = (3 + 5*2) = 13
2 4 = (4 + 5*2) = 14
2 5 = (5 + 5*2) = 15

So that would seem to be the appropriate code.
I noticed that I'd mistranslated one line from program FT3 that read:-

to

whereas it should've read:


I would've liked to see the program now run alright, but now it returns an array exception out of bounds exception, which reads on the compiler as such:-

Line 52 being the one that I have just ammended, ie:

I was wondering where I have gone wrong in my alteration of this part of the code?
I am sorry its dragging on, I'd hoped this last alteration would've fixed things.
I hope you can help.
Thank you for reading.
Yours
Simon
13 years ago
Dear Campbell Ritchie, Michael Dunn, Henry Wong, Paul Yule & other programmers,

Thank you for your advice regarding the alteration of my program FT3, which I have used to create FT4, as now it only uses one JOptionpane, and the split string method, and the recommended name for the numofNames array as also recommended.

I have changed the Total initialsement, so that it obtains the amount of letters inputter gives.

The program compiles and runs alright, but I still am getting the problem with not all of the ActionListeners functioning upon irregular names - such as 'Jane Alison Rebecca Evans' f'rinstance.

I have made the variable for the amount of names returned from the split string the array numofNames.

I was wondering - having in a sense eliminated those causes, why all the ActionListeners are still not functioning as hoped?

Yours, hoping to hear,
Simon (code follows-)

[ October 17, 2008: Message edited by: Simon Evans ]
13 years ago
Dear Campbell Ritchie, Michael Dunn, Henry Wong, Paul Yule & other programmers

Thank you for your advice regarding debugging my program FT3.
I have got program FT3 to run to some degree, and it presents a gui of JLabels to JPanels or Rows according to the number of Names inputter gives, and a number of columns corresponding to the length of the respective names that are input.

The drawbacks are that firstly if I put in a name of two words or less it returns an array out of bounds exception, and secondly that if I input irregularly lengthed names, the action listeners don't seem to work upon all of the Jlabels that it generates.

If I try a regularly lengthed name - such as my own, being 3 rows by 5 columns, all action listeners seem to work, but if I input say my sister's name:- 'Jane Alison Rebecca Evans' then most of the first name's and some of the second and third name's action listeners don't work.

I have used the same looping code for the creation of the Action Listeners as I have for the creation of the Jlabels, so I was wondering what could be wrong, as using the same loop in program FT2 gets all the labels action listeners to work alright.

I will try to get them to work in the meantime, but I would be glad if you could give me some idea what is going amiss with the program.
I know I have been told to keep the length of posts down, but I am pretty sure this thread is near an end - so I am posting the entire program as it is.

Yours, hoping to hear,

Simon
(code follows:-)



[ October 15, 2008: Message edited by: Simon Evans ]
[ October 15, 2008: Message edited by: Campbell Ritchie ]
13 years ago
Dear Programmers,
I was wondering if when a thread goes to more than one page ie: into two pages, then the first page obscured or elsewise renders the thread thus far invisible ?
I am asking this, as my thread 'Out of bounds Exceptions and the Eradication thereof' just ran into a second page, and since then I've had no replies in regard of it, whereas I used to get replies within the next day or less.
I would get rid of the first page if that is the case, although there is code that I wanted to refer back to.
It seems a shame as I thought I was near to getting the program in question to work.
Yours hoping to hear,
Simon.
13 years ago
Dear Campell Ritchie, Paul Yule and Michael Dunn
Thank you for your respective advice.
I amended code in accordance with Michael Dunn's advice, I now see that the JPanel creation should occur after the i++ incrementation - therefore in the outer loop - than before it - so
have changed the erroneous:-

to:-

and also declared int i globally, so it'd be accessible in outer loop.
However this still returns an array out of bounds exception (& crash) from compiler, this
time at line 34 that Campbell Ritchie said his version did, ie:


Looking at that line:-

In which I had wanted to get two things, a total amount of letters that were input that'd be returned by the values of i for each of the values stored in usersNames[i] hence in the example given Total would be 15 (3 j's times 5 i's or 3 Names * 5 usersNames[i].length()'s) and that 15 would then be used to create the necessary number of Jlabels after loop in the subsequent line:-

Going back to program Name Layout, using the same loop ie:-

will get :-
[CODE]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\simon.BLUECHIP-KDOCDA>cd c:\backup\Project Tarot Two

C:\backup\Project Tarot Two>set PATH=c:\Sun\AppServer\jdk\bin;%PATH%

C:\backup\Project Tarot Two>javac NameLayout.java

C:\backup\Project Tarot Two>java NameLayout
LabelLabelLabelLabelLabel

LabelLabelLabelLabelLabel

LabelLabelLabelLabelLabel

[CODE]
This means that usersNames[j] got initialised to the length of the names input to the JOptionPane - and using the same syntax as I used in FT3's problem line 34, nonetheless returned/returns what usersNames[i] got initialised to - it works without an array oob exception there - so why doesn't it here in program FT3 ? - is my conundrum.
Not wishing to put the cart before the horse as it were, I will get on to changing the JOptionPane if and when this point is resolved.

Hope you can help,
Thank you for reading,
Yours
Simon.
[ October 11, 2008: Message edited by: Simon Evans ]
13 years ago
Dear Campbell Ritchie, Michael Dunn, Henry Wong and other programmers

I have made a program based on the previous one FT2, and NameLayout, to create a gui of a number of panels of labels, the number of those panels and of labels being decided by users input of how many names they have, and how many letters they have in each name.

The program FT3 compiles and runs, but has a runtime 'out of bounds exception' perhaps the code and compiler response would show the current situation more clearly :-

gives the JOption pane requesting number of names user has, so I put in 3, and press Enter.
Then JOption pane comes back requesting those names, so I key in 'Simon Angus Evans' and press Enter.
Then a runtime error occurs, and compiler crashes, after giving:-


The line 32 is: for (int j = 0; j< Names; j++)
The int Names would've been intialised to 3 by my input, and j would'nt increment beyond 3, it'd cover 0,1,2, ie: three places before ending the outer and inner loops. It should'nt go to 4 - therefore I was wondering why it quoted 4 as the oob exception ?

I hope you can offer me some help with this, I will continue to tinker with this program in the meantime, but this is how it is performing at the present, and as said, I don't get why it should be going out of bounds.
Yours
Hoping to hear,
Yours
Simon
[ October 10, 2008: Message edited by: Simon Evans ]
13 years ago
Dear Michael Dunn,
I tried what you suggested on top of the code I put to you last - and it works - Hoorah - much thanks,
I am going to try and adopt this program to take user input as in the NameLayout program further up.
I will post it here when it is finished.
Again thank you for your kind help.
Bye for now,
Yours
Simon
[ October 09, 2008: Message edited by: Simon Evans ]
13 years ago
Dear Michael Dunn,
Thank you for your help.
I have tried changing the layout of Frame object f, as you suggested.

This changes the gui a little - the seven labels appear at the bottom of the
gui upon running program FT2,instead of at the middle, but the rest of the gui is still blank.
Is this anything like what you had in mind?
I will continue try tinkering with it, but this is best or least bad I have come up with in the interim.

Dear Henry Wong,
Thank you for your advice regarding code format. I will try the format you suggest, as

it seems to clarify the difficulties that braces usually present.

Yours
Hoping to hear,
Simon.
13 years ago
Thank you, after searching for a a while I got: http://java.sun.com/javafx/tutorials/simple_javafx_nb_app/
which looks like it could well be useful.
Yours
Simon.
13 years ago
Dear Programmers,
I wanted to post a new thread as the earlier I get started with it the sooner I can make progress on it.

I want to create a program which would use a circular image- say a jpg, or gif that would revolve.
I could get the rate of degrees that the jpg/gif would revolve from the return of one of the Date(); methods.

The shifting image itself wouldn't have to be operant, ie contain any operating buttons or scrollbars etc, but the gui into which it is projected upon, being faithful to its name (user interface), might return the current time, date etc.

My aim is to create an two dimensional orrery that'd give an accurate representation of the layout of the planets at the given time of day it is logged onto, hence there would be a different rate of revolution for each superimposed circular images of planet represented thereon.

Perhaps it sounds complicated - but it is quite a simple concept, provided I could get a means to get the image/s to revolve at specified amount/s of degrees.

Are there any methods out there that could effect this?

Hope you can help.

Thanks for reading.

Hoping to hear
Yours
Simon.
13 years ago