• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Images in Swing

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Im workin on a project that involves the coding of a calculator like object. I would like to use LED like display panels for the display of the results..But how would one do that ??
Please tell me asap
Reg
Muralidhar
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the easiest thing to do would be to make images of the numerals 0 - 9 that look like what you want. Then just do some parsing of the number that you want to display to display the appropriate graphics. Make sure that all the numeral graphics are the same size. Then, load them up as ImageIcons in your program... Have a series of JPanels or something in your program to display each numeral.

HTH,
-Nate
 
Muralidhar Krishnamoorthy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thanx for replyin...This is the very same idea ive thought of but the trouble is there is some gap between two image icons whenever i tried to display the numbers...Is there any method to make them look as a single panel?
Reg
Muralidhar
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using GridLayout to display them? The default hGap and vGap spacing give a few pixels of space between components... and even if you set hGap and vGap to 0, there is still a little space between components. So set hGap and vGap to negative values! I was suprised... but it works! Try a value around -2 and your components will have no space between them...

-Nate
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic