src/Pure/GUI/popup.scala
author nipkow
Tue, 17 Jun 2025 14:11:40 +0200
changeset 82733 8b537e1af2ec
parent 80552 973d276e130e
permissions -rw-r--r--
reinstated intersection of lists as inter_list_set

/*  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: Unit = {
    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: Unit = {
    val bounds = component.getBounds()
    layered.remove(component)
    layered.repaint(bounds)
  }
}