src/Pure/GUI/popup.scala
author wenzelm
Fri, 03 Apr 2020 17:35:10 +0200
changeset 71675 55cb4271858b
parent 64370 865b39487b5d
child 73340 0ffcad1f6130
permissions -rw-r--r--
less redundant markup reports;

/*  Title:      Pure/GUI/popup.scala
    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.DEFAULT_LAYER)
    layered.moveToFront(component)
    layered.repaint(component.getBounds())
  }

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