PDA

View Full Version : Java Digits



tashe
December 3rd, 2008, 07:10 PM
Hi everybody.
Is there a way to make in Java digits to look like digits from old calculators, like this:
http://technabob.com/blog/wp-content/uploads/2007/03/single_digit_clock.jpg

and to be able to turn on and off some of the lines in the digit so I can make arrangements of them different than the arrangements of the existing decade numbers.
Thank you
Greetings

tinny
December 3rd, 2008, 08:52 PM
Hi everybody.
Is there a way to make in Java digits to look like digits from old calculators, like this:
http://technabob.com/blog/wp-content/uploads/2007/03/single_digit_clock.jpg

and to be able to turn on and off some of the lines in the digit so I can make arrangements of them different than the arrangements of the existing decade numbers.
Thank you
Greetings

This is called a seven segment display. Have a search around with google for "Java 7 segment display". Here is the first useful link I found.

http://au.answers.yahoo.com/question/index?qid=20080221085453AAdOisx

tashe
December 4th, 2008, 12:15 PM
Thanks for the reply.
I tried it,but somehow I don't feel that it will work for me. My goal is to make a representation of the 0's and 1's in a digital signal. I think a line like the one below will be better, but I just don't know how to draw one. I know I can make it from more lines, but that makes the job ugly and more complex.
Is there any way I can draw this picture with one line?

Tomosaur
December 4th, 2008, 11:42 PM
It really depends on the application you're creating - is it GUI, command line, or what? Java has drawing toolkits which should do what you want.

Alternatively you could do some clever string printing to the command line, which would be more complicated but way cooler.

tashe
December 8th, 2008, 01:09 AM
It should be a GUI.
thanks for the replies

jimi_hendrix
December 8th, 2008, 02:40 AM
i know theres a graphics object that can draw lines and stuff on your gui

tinny
December 8th, 2008, 08:00 AM
http://leepoint.net/notes-java/GUI-lowlevel/graphics/40drawingpanel/10drawingpanel.html

The Graphics class contains various methods for painting.

http://java.sun.com/j2se/1.5.0/docs/api/

The above info should get you started.

rbprogrammer
December 8th, 2008, 06:59 PM
http://leepoint.net/notes-java/GUI-lowlevel/graphics/40drawingpanel/10drawingpanel.html

The Graphics class contains various methods for painting.

http://java.sun.com/j2se/1.5.0/docs/api/

The above info should get you started.

As noted in tinny's post, he suggested "painting". In which case the easiest way of doing this would be to find a font file online from somewhere and somehow incorporate it into your project.

tashe
December 13th, 2008, 01:03 PM
I'm almost at the end of the project. I did it with extending JFrame and using the g.drawline() method. At the end it turned out that it's easy.
Thanks for the suggestions to everyone
):P