icon on JFrame and then GridLayout

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kalar
    New Member
    • Aug 2007
    • 82

    #1

    icon on JFrame and then GridLayout

    I want to ask something about swing.
    Can i set an icon ( it is a big picture) in JFrame and then add labels with GridLayout over the picture?What i want to do is :
    in my window i want to have a big picture
    and then i want to put with GridLayout other labels or buttons , i mean i will put these in specific positions in the image.I don't want to delete the image.Is this possible?
    One of those things that i want to add on the picture it would me some little circles,how will i do this? I thing to put a gif ( which has a circle ) in a label, is this good technic ? or not?

    and something else : in the sun java tutorial where says how can i set a picture, because i can't find it?


    Thanks
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    You can't put images in JLabels, those are for text. To add an icon to a JFrame, look at the Image class. I don't know how to add the additional images, but I'd guess it involves Panes.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by Laharl
      You can't put images in JLabels, those are for text. To add an icon to a JFrame, look at the Image class. I don't know how to add the additional images, but I'd guess it involves Panes.
      You can put an icon (e.g. an ImageIcon) in a JLabel; read its API. About that
      picture and other things: be creative with a LayeredLayout and transparent (i.e.
      not opaque) JPanels and possibly other layout managers.

      kind regards,

      Jos

      Comment

      Working...