• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A couple of questions about images

 
Neil Cartmell
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, i'm finally starting to try and make my applications look a bit better. I have a couple of questions.

I was wondering if it's considered best to work out how big you want your icons or images to be before using them in your program rather than altering their size in the program?

At the moment my program draws a chord box and all these little black circles with numbers in it for the finger positions. It has to use font metrics to center the number and antialiasing to smooth out the circle. Would it be
better to just use images instead?

Oh and when I say better/ best, I mean what's considered to be to be the best programming practice, that a professional would most likely do.


 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neil Cartmell wrote:At the moment my program draws a chord box and all these little black circles with numbers in it for the finger positions. It has to use font metrics to center the number and antialiasing to smooth out the circle. Would it be better to just use images instead?


Just use a JLabel and set appropriate horizontal and vertical alignments and text positions. Also, it's easy to write an Icon implementation that draws filled black circle (with a line through to represent the guitar string, if you so desire). Set the foreground to whatever color you want the number to be.

A GridLayout might be the best way to lay out the chord box.
 
Neil Cartmell
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

Your answer kind of surprises me. I never really thought about using layout managers and such for this application. I thought it would be just easier to paint it all in a JPanel. I have individual view classes but they are all just painted on the JPanel. I've posted a thumbnail below. It's pretty simple looking at the moment. The guitar strings are just lines!


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic