src/Tools/jEdit/src/jedit_options.scala
changeset 49296 313369027391
parent 49289 60424f123621
child 49317 5eff42e69edb
equal deleted inserted replaced
49295:2750756db9c5 49296:313369027391
    12 import javax.swing.{InputVerifier, JComponent, UIManager}
    12 import javax.swing.{InputVerifier, JComponent, UIManager}
    13 import javax.swing.text.JTextComponent
    13 import javax.swing.text.JTextComponent
    14 
    14 
    15 import scala.swing.{Component, CheckBox, TextArea}
    15 import scala.swing.{Component, CheckBox, TextArea}
    16 
    16 
       
    17 import org.gjt.sp.jedit.gui.ColorWellButton
       
    18 
    17 
    19 
    18 trait Option_Component extends Component
    20 trait Option_Component extends Component
    19 {
    21 {
    20   val title: String
    22   val title: String
    21   def load(): Unit
    23   def load(): Unit
    22   def save(): Unit
    24   def save(): Unit
    23 }
    25 }
    24 
    26 
    25 class JEdit_Options extends Options_Variable
    27 class JEdit_Options extends Options_Variable
    26 {
    28 {
       
    29   def make_color_component(opt: Options.Opt): Option_Component =
       
    30   {
       
    31     Swing_Thread.require()
       
    32 
       
    33     val opt_name = opt.name
       
    34     val opt_title = opt.title("jedit")
       
    35 
       
    36     val button = new ColorWellButton(Color_Value(opt.value))
       
    37     val component = new Component with Option_Component {
       
    38       override lazy val peer = button
       
    39       name = opt_name
       
    40       val title = opt_title
       
    41       def load = button.setSelectedColor(Color_Value(string(opt_name)))
       
    42       def save = string(opt_name) = Color_Value.print(button.getSelectedColor)
       
    43     }
       
    44     component.tooltip = Isabelle.tooltip(opt.print_default)
       
    45     component
       
    46   }
       
    47 
    27   def make_component(opt: Options.Opt): Option_Component =
    48   def make_component(opt: Options.Opt): Option_Component =
    28   {
    49   {
    29     Swing_Thread.require()
    50     Swing_Thread.require()
    30 
    51 
    31     val opt_name = opt.name
    52     val opt_name = opt.name