src/Pure/GUI/popup.scala
author wenzelm
Sun, 06 Apr 2014 16:36:28 +0200
changeset 56438 7f6b2634d853
parent 53853 e8430d668f44
child 56588 272d173cd398
permissions -rw-r--r--
more source positions;

/*  Title:      Pure/GUI/popup.scala
    Module:     PIDE-GUI
    Author:     Makarius

Popup within layered pane.
*/

package isabelle


import java.awt.{Point, Dimension}
import javax.swing.{JLayeredPane, JComponent}


class Popup(
  layered: JLayeredPane,
  component: JComponent,
  location: Point,
  size: Dimension)
{
  def show
  {
    component.setLocation(location)
    component.setSize(size)
    component.setPreferredSize(size)
    component.setOpaque(true)
    layered.add(component, JLayeredPane.POPUP_LAYER)
    layered.moveToFront(component)
    layered.repaint(component.getBounds())
  }

  def hide
  {
    val bounds = component.getBounds()
    layered.remove(component)
    layered.repaint(bounds)
  }
}