Simple GUI application attempted.

From: flesh_eating_dragon (dragon_at_netyp.com.au)
Date: 07/23/04


Date: 23 Jul 2004 05:13:05 -0700

Some assistance in the development of a simple GUI application would
be appreciated.

Not long ago I completed a computer science degree, and right now I
want to get a bit more experience and confidence by trying to write
applications that are just a bit beyond what I had to write at
university. However, in the early stages of designing the application
that I have in mind, I have hit a brick wall. I can't write it the way
that I thought at first would work, because of the ColorModel classes
having no 'set' methods, so I'd like to know what _will_ work.

Please imagine the following scenario (this is not a description of
the application, but it is a simpler illustration of the same
problem). Suppose you are writing a graphical application that
simulates a digit on a traditional LCD display, as for example on
a handheld calculator. This should be achievable using a Raster that
encodes something akin to the following:

  011110
  200003
  200003
  044440
  500006
  500006
  077770

and a changeable ColorModel, in which 0 always represents the
BACKGROUND colour and the other indexes 1 to 7 represent colours that
we will call ON and OFF. For example, if the digit to be displayed is
"4", then indexes 2, 3, 4 and 6 will be set to represent colour ON
whilst indexes 1, 5 and 7 will be set to represent colour OFF.
Similarly, if the digit to be displayed is "3", then indexes 1, 3, 4,
5 and 7 will represent ON and indexes 2 and 6 will represent OFF.

It would be nice if the ColorModel classes had 'set' methods, because
then you could make the relevant class (let's call it
DigitDisplayImage) a subclass of Image, and the rest would be elegant
and easy. But it doesn't, although I feel there _should_ be a similar
solution. Then you could write setIndex(int, Color) methods in the
DigitDisplayImage class, after which the following code example would
work to display the digit "4".

   digitDisplay.setIndex(1, OFF);
   digitDisplay.setIndex(2, ON);
   digitDisplay.setIndex(3, ON);
   digitDisplay.setIndex(4, ON);
   digitDisplay.setIndex(5, OFF);
   digitDisplay.setIndex(6, ON);
   digitDisplay.setIndex(7, OFF);

This would be lovely.

In the absence of ColorModel classes with 'set' methods, how, in
practise, should I go about achieving a similar functionality? (In the
real application, the corresponding object needs a lot more than eight
index values and will be called upon to display far more than just
digits between 0 and 9, but I think it is better to discuss the
problem with reference to this simplified example.)

Thanks,

Adrian.



Relevant Pages

  • Re: tech: Stern displays issues
    ... The easy one - The six-digit match/credit display is missing the ... 10'000's digit (which is the tens digit of the credits left half of the ... problem, and two, the 100K resistor in this circuit registers 97K ohms, ... 300K resistor in the other bad circuit would show 297 for a single beat, ...
    (rec.games.pinball)
  • Re: Number Of Decimal Digits In Frequency Display
    ... >> Is the signle digit in the decimal poriton of the frequency display, ... newsagents in the city used to stock the South/West and London ... he hasn't seem more than one place of decimals. ...
    (alt.radio.digital)
  • Re: Need Help.
    ... you'll be using the "mul" instruction. ... but gives a quotient and remainder. ... If you want to accept multiple digit numbers as input... ... Once you can display a correct answer all the way up to 9 + 9, ...
    (comp.lang.asm.x86)
  • Re: Tech: Bally Solid State 6-digit repair also WTB
    ... missing a single digit, etc. ... working displays get burnt also? ... The 100k resistors are the ones to upgrade, I do it if any look burnt (the resistor not the display.) If you don't leave them on for a long time I wouldn't worry about this..... ...
    (rec.games.pinball)