author | wenzelm |
Tue, 18 Feb 2014 20:20:42 +0100 | |
changeset 55558 | 298274c970b6 |
parent 53787 | e64389fe2d2c |
child 56906 | 408b526911f7 |
permissions | -rw-r--r-- |
43282
5d294220ca43
moved sources -- eliminated Netbeans artifact of jedit package directory;
wenzelm
parents:
37067
diff
changeset
|
1 |
/* Title: Tools/jEdit/src/dockable.scala |
37066 | 2 |
Author: Makarius |
3 |
||
4 |
Generic dockable window. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle.jedit |
|
8 |
||
9 |
||
10 |
import isabelle._ |
|
11 |
||
12 |
import java.awt.{Dimension, Component, BorderLayout} |
|
13 |
import javax.swing.JPanel |
|
14 |
||
15 |
import org.gjt.sp.jedit.View |
|
53787
e64389fe2d2c
focus on default component according to jEdit window management;
wenzelm
parents:
43282
diff
changeset
|
16 |
import org.gjt.sp.jedit.gui.{DefaultFocusComponent, DockableWindowManager} |
37066 | 17 |
|
18 |
||
53787
e64389fe2d2c
focus on default component according to jEdit window management;
wenzelm
parents:
43282
diff
changeset
|
19 |
class Dockable(view: View, position: String) |
e64389fe2d2c
focus on default component according to jEdit window management;
wenzelm
parents:
43282
diff
changeset
|
20 |
extends JPanel(new BorderLayout) with DefaultFocusComponent |
37066 | 21 |
{ |
22 |
if (position == DockableWindowManager.FLOATING) |
|
23 |
setPreferredSize(new Dimension(500, 250)) |
|
24 |
||
53787
e64389fe2d2c
focus on default component according to jEdit window management;
wenzelm
parents:
43282
diff
changeset
|
25 |
def focusOnDefaultComponent { requestFocus } |
e64389fe2d2c
focus on default component according to jEdit window management;
wenzelm
parents:
43282
diff
changeset
|
26 |
|
37067 | 27 |
def set_content(c: Component) { add(c, BorderLayout.CENTER) } |
28 |
def set_content(c: scala.swing.Component) { add(c.peer, BorderLayout.CENTER) } |
|
37066 | 29 |
|
30 |
protected def init() { } |
|
31 |
protected def exit() { } |
|
32 |
||
33 |
override def addNotify() |
|
34 |
{ |
|
35 |
super.addNotify() |
|
36 |
init() |
|
37 |
} |
|
38 |
||
39 |
override def removeNotify() |
|
40 |
{ |
|
41 |
exit() |
|
42 |
super.removeNotify() |
|
43 |
} |
|
44 |
} |