1

What I am looking to do is have a button click create and load a new image to the panel. The image should be draggable as well as for me able to find its position on screen etc. Im not sure how to do this. The idea being after multiple clicks I will have multiple new images all able to drag and move about.

The code looks something like this :-

val top = new MainFrame {

     //General code for menus

      val button = new Button {
        text = "Click for Image"   
      }

      val panel = new Panel {
        override def paint(g:Graphics2D){

        }

        listenTo (button
                 mouse.clicks,
                 mouse.moves)

        reactions += {
            case ButtonClicked(`button`) => {
                new ImagePanel{ imagePath = ("bottoming.jpg")}

            }    

            case e: MousePressed =>{}     
            case e: MouseDragged =>{}
            case e: MouseReleased =>{}
        } 

     }
     import BorderPanel.Position._         
     contents = 
        new BorderPanel {
            layout += new Label("label") -> North
            layout += panel -> Center
            layout += button -> West

        }                      

   }
Mark
  • 131
  • 1
  • 3

0 Answers0