Java JLabel JPanel Graphics etc...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jean-Philippe Martin

    Java JLabel JPanel Graphics etc...

    Hi all,

    It's my first post here, so you doubt I have a question :o)

    I want to develop a mini graphical editor. Imagine that I have 2 JFrame, I
    want to have one with a list of JToggleButton with a ImageIcon and one
    called DrawingAeraWind with nothing into.

    I would like to be able to draw the ImageIcon of the selected JToggleButton
    in the DrawingAeraWind if I click into this window. I would like to be able
    to drag and drop the drawn image in the DrawingAeraWind (just to change its
    position).

    For now, I'm able to do this.

    I want to add a functionality to my light editor. I want to add a
    JToggleButton which didn't represent a ImageIcon to add in the
    DrawingAeraWind but wich represent a link between 2 drawn Images. For
    exemple, if I already have drawn 2 images in the DrawingAeraWind and that I
    select this new (link) JToggleButton, I want to be able to select the 2
    drawn images in the DrawingAeraWind (by clicking on it) and to display a
    line (graphic.drawli ne(image1, image2) )between these 2 images.

    My problem is that my 'link' line is not visible, or is clipped, etc...

    I use some JLabel to represent my drawn Image (to be able to do drag and
    drop on it) and I use graphic.drawlin e() for the link line.


    ps: excuse my english :o) I hope you have understand my problem.


  • Jean-Philippe Martin

    #2
    Re: Java JLabel JPanel Graphics etc...

    > ps: excuse my english :o) I hope you have understand my problem.

    and understood ;o)


    Comment

    • Tom N

      #3
      Re: Java JLabel JPanel Graphics etc...

      You have to integrate your painting of the lines in with Swing's painting.
      You could override paintComponent( Graphics g) (inherited from JComponent) on
      the JFrame.
      Don't forget to call super.paintComp onent(g)

      "Jean-Philippe Martin" wrote:[color=blue]
      > Hi all,
      >
      > It's my first post here, so you doubt I have a question :o)
      >
      > I want to develop a mini graphical editor. Imagine that I have 2 JFrame, I
      > want to have one with a list of JToggleButton with a ImageIcon and one
      > called DrawingAeraWind with nothing into.
      >
      > I would like to be able to draw the ImageIcon of the selected[/color]
      JToggleButton[color=blue]
      > in the DrawingAeraWind if I click into this window. I would like to be[/color]
      able[color=blue]
      > to drag and drop the drawn image in the DrawingAeraWind (just to change[/color]
      its[color=blue]
      > position).
      >
      > For now, I'm able to do this.
      >
      > I want to add a functionality to my light editor. I want to add a
      > JToggleButton which didn't represent a ImageIcon to add in the
      > DrawingAeraWind but wich represent a link between 2 drawn Images. For
      > exemple, if I already have drawn 2 images in the DrawingAeraWind and that[/color]
      I[color=blue]
      > select this new (link) JToggleButton, I want to be able to select the 2
      > drawn images in the DrawingAeraWind (by clicking on it) and to display a
      > line (graphic.drawli ne(image1, image2) )between these 2 images.
      >
      > My problem is that my 'link' line is not visible, or is clipped, etc...
      >
      > I use some JLabel to represent my drawn Image (to be able to do drag and
      > drop on it) and I use graphic.drawlin e() for the link line.
      >
      >
      > ps: excuse my english :o) I hope you have understand my problem.
      >
      >[/color]


      Comment

      Working...