celine mcgowan

Ranch Hand
+ Follow
since Nov 22, 2003
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 celine mcgowan

Hi All,

I have a little javascript file that connects to my server & downloads another file. Basically, what I want to do is write a small script that deals with the possibility of the server being down. It will check the server's url, if it is found then it will continue there, if it is not found it will try a different server.

I can't find anything on the web for a function to manage this. If anyone knows a function that will do it, i'd appreciate it.

Thanks a million,
Celine
Hi John,

Welcome to JavaRanch. You've come to the right place!

Sun have a great Java tutorial online: Sun's Java Tutorial
In fact, for pretty much any info you need on java, check out http://java.sun.com/. If you get stuck, the people here will help you thru!!

As for books, i can't recommend any 'cos i haven't found my ideal one yet!!!

Enjoy!
Celine
19 years ago
No need to be modest Clio! I get the feeling you've helped many people before me!!!

Thanks again for your time...
Celine
19 years ago
Hi Clio,

You're a lifesaver! I changed "setIcon" to "new JLabel( new ImageIcon..." & took out the panel formatting stuff from the updateLED method as you suggested and it works!!! Makes sense i guess - how can you reset an icon you haven't initialised in the first place. I won't forget this lesson in a hurry!!! Thank you so much for your help & for giving so much of your valuable time to do so.

I have saved the code you posted which is a much more elegant solution to this problem - thanks again. I'm still very much a newbie though & i don't totally understand what's happening there, but i'm gonna spend a bit of time looking at it & running it etc so that i'll understand it by this evening.

Gratefully yours,
Celine
19 years ago
Hi All,

Sorry to post again, but this problem is driving me nuts. I can't figure it out. I have 2 classes (code below); one extends JPanel & creates a panel which arranges gif's into an LED 'figure of 8' configuration. This class has a method updateLED( int ) which allows the user to specify which bars of the LED are on/off etc so they can output characters in LED format. The second class is supposed to create a panel of 8 LED's so that words can be formed on the LED display. But, the LEDPanel code only outputs one of the 8 LED's. Incidentally, it is the last LED that gets displayed. And it displays on the far right of the LEDPanel window suggesting that room is made for the previous 7, but they got lost along the way somewhere. Can anyone tell me what i'm doing wrong? Or is there an easier way to change gifs in a panel based on user input?

Thanks again guys,
Celine



19 years ago
Hi All,

Thanks for your help. I have changed the code in LEDPanel so that there is a GridLayout manager (one row, eight columns) on the main Panel:


This still only outputs one LED... Am i doing something really silly?

Thanks,
Celine
19 years ago
Hi All,

Thanks for your help. I have changed the code in LEDPanel so that there is a GridLayout manager (one row, eight columns) on the main Panel:


This still only outputs one LED... Am i doing something really silly?

Thanks,
Celine
19 years ago
Hi Tony,

Junilu is right - no-one will do your homework for you. But don't be too disappointed - it's a ploy they have here to make you learn Java!!! Anywho, the problems you have are simple enough - as long as you know where to start...

So, go to your local library (or maybe look at your Java course notes!) and find out how to write a very simple class in Java. Then find out how to do maths in Java. Once the maths is finished, most of your work is done. Just one more step - you'll need to know how to get input from the user & how to return output to the user. Any good java book or set of notes will cover these topics in the first couple of chapters/sections.

Build what you do up slowly but surely & you'll be amazed how quickly you get there. If you get stuck the people here are really, really helpful so post any questions you like!!!

Good luck with it!
Celine
19 years ago
Hi Everyone,

Sorry to bother you all again. I am again having probs with an accursed LED panel thingy. I have finally got it to compile etc - thanks everyone for your help with that (see post here:Non-default constructor problem)! Anyway, I have a method which updates the gifs which are in an LEDPanel:


I am calling the above method 8 times in another class in order to output 8 LED displays. Here's that code:


When i run LEDPanel, i only get one panel displaying. It seems to be the last panel, but i'm not sure! Does anyone know why there is only one LED displaying, and not all 8?

Thanks again all.
Celine
19 years ago
Hi Everyone,

Sorry to bother you all again. I am again having probs with an accursed LED panel thingy. I have finally got it to compile etc - thanks everyone for your help with that (see post here:Non-default constructor problem)! Anyway, I have a method which updates the gifs which are in an LEDPanel:


I am calling the above method 8 times in another class in order to output 8 LED displays. Here's that code:


When i run LEDPanel, i only get one panel displaying. It seems to be the last panel, but i'm not sure! Does anyone know why there is only one LED displaying, and not all 8?

Thanks again all.
Celine
19 years ago
Hi Hans,
Yeah, i'm using SunONE Studio. Spaces like this would make a difference? Oh no!!! The people in the cattle drive won't like me taking them out!!
Haha! I'll try that now - thank you all very much for your help.

Hi Again Pascal,
Here's the code calling the LED( int ) constructor:


Thanks again,
Celine
19 years ago
Hi Pascal & Siu

Thanks for your help. Sorry Pascal, please ignore the 'main' method in class LED. I am calling constructor new LED( int ) from another class.

Siu, i tried your suggestion & i the default constructor is found. No error message is received. Now i'm really confused!!!

Thanks again,
Celine
19 years ago
Hi there!

I was looking into the same problem myself not so long ago! Hard to find the solution, isn't it?!!! Behind the .toHexString etc. all that's happening is:
Convert int to Hex:

To go back to int from hex:


Similarly to convert from int to Binary String:

To go back to int from hex:


Hope this helps... By the way, i find it easier (less cumbersome) to convert to Binary before converting to Hex. When you get the binary number, you're then just converting every four bits to the Hex equivalent...

Cheers,
Celine
19 years ago
Hi All,

I wonder if you could help me. I have the following code, which creates a JPanel with a 'Figure of eight' formation of gifs to represent an LED:

When i try to call this from another class, eg:

I get a compilation error: Method not found: Constructor LED( int ).

Obviously there is a constructor LED(int) in the LED class. Why can't other classes see it?

Thanks a million,
Celine
19 years ago
Hi Jignesh,
I am posting here because i have a very similar question to your question number 1. I know that to set text in the title bar you can do:

in the constructor of your JFrame. What i need to know is how to change this text afterwards. Say, to add a filename that's been opened in the app. If i create a String variable say, 'filename' & update it on opening a file, like so:

and then do super("title bar text" + filename ) in the constructor, will a change to filename update to the title bar???

Thanks everyone!
Celine
19 years ago