コンソールで高橋メソッドを入力し、画面に表示するサンプル

つまらないサンプルですみません。

package xibbar
 
import javax.swing.{JFrame,JLabel,JButton,SwingConstants}
import java.awt.{BorderLayout,Font}
import java.awt.event.{ActionListener,ActionEvent}
 
object RealtimeTakahashiMethod {
  def main(args: Array[String]){
    val window=new MainWindow()
    val textLabel=new JLabel("テキスト入力してね")
    textLabel.setHorizontalAlignment(SwingConstants.CENTER)
    textLabel.setFont(new Font("Arial", Font.PLAIN, 80));
    window.getContentPane().add(textLabel,BorderLayout.CENTER)
    window.show
    while(true){
      print("> ")
      textLabel.setText(Console.readLine)
    }
  }
}
class MainWindow extends JFrame{
  this.setSize(800,600)
  this.setTitle("リアルタイム高橋メソッド")
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
 
  val finishButton=new JButton("終了")
  this.getContentPane().add(finishButton,BorderLayout.SOUTH)
 
  finishButton.addActionListener(new ActionListener(){
      def actionPerformed(e:ActionEvent){
        System.exit(0)
      }
    }
  )
}

実行するには

scalac RealtimeTakahashiMethod.scala
scala xibbar.RealtimeTakahashiMethod

です。実行すると、

とコンソールが出ます。

ウィンドウはこんな感じです。

コンソールにテキストを入れてエンターを押すと

ウィンドウの文字が変化します。