Skip to content

Commit 219fe96

Browse files
committed
scala: swing to scala's swing refactoring
1 parent 1b16f2d commit 219fe96

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

RubyScript/src/org/knime/ext/jruby/RubyScriptNodeDialog.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import java.awt.event._
77
import javax.swing.Box
88
import javax.swing.BoxLayout
99
import javax.swing.DefaultCellEditor
10-
import javax.swing.JFileChooser
1110
import javax.swing.JComboBox
1211
import javax.swing.table.TableColumn
1312
import javax.swing.table.TableCellEditor
@@ -33,6 +32,7 @@ import scala.swing._
3332
import scala.swing.event._
3433
import scala.swing.Table
3534
import scala.swing.Container
35+
import scala.swing.FileChooser
3636

3737
/**
3838
* <code>NodeDialog</code> for the "JRuby Script" Node.
@@ -69,7 +69,7 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
6969

7070
private var columnTables: Array[Table] = _
7171

72-
private val fileChooser = new JFileChooser()
72+
private val fileChooser = new FileChooser()
7373

7474
createColumnSelectionTab()
7575

@@ -179,9 +179,9 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
179179
layout(new Button("Load Script from File") {
180180
reactions += {
181181
case ButtonClicked(b) =>
182-
val returnVal = fileChooser.showOpenDialog(b.peer)
183-
if (returnVal == JFileChooser.APPROVE_OPTION) {
184-
val file = fileChooser.getSelectedFile
182+
val returnVal = fileChooser.showOpenDialog(b)
183+
if (returnVal == FileChooser.Result.Approve) {
184+
val file = fileChooser.selectedFile
185185
if (file.exists()) {
186186
val file_content = scala.io.Source.fromFile(file, "utf-8").mkString
187187
scriptTextArea.setText(file_content)
@@ -193,7 +193,7 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
193193

194194
layout(new Label("Ruby Script")) = BorderPanel.Position.Center
195195
}
196-
peer.add(scriptButtonPanel.peer, BorderLayout.PAGE_START)
196+
layout(scriptButtonPanel) = BorderPanel.Position.North
197197

198198
layout(new BorderPanel() {
199199
layout(new SplitPane(Orientation.Horizontal,

0 commit comments

Comments
 (0)