2011-12-05 4 views
1

私には2つの問題があります。私はListViewとcrudを作成しようとしています。 Now here's how I want my UI to lookJavaFX 1.3:ListViewを使ったCRUD

私は、次のコードでこれを作成しました:今ここ

var studentManagementListView: ListView = ListView { 
     items: ["bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla"] 
     cellFactory: function() { 
      def listCell: ListCell = ListCell { 
         node: HBox { 
          spacing: 10 
          content: [ 
           Label { 
            text: bind if (listCell.empty) then "" else "{listCell.item}" 
            visible: bind not listCell.selected and not listCell.empty 
           } 
           TextBox { 
            text: bind listCell.item.toString() 
            columns: 12 
            visible: bind listCell.selected and not listCell.empty 
            selectOnFocus: true 
           } 
           SwingComboBox { 
            visible: bind listCell.selected and not listCell.empty 

            items: for (classItem in classes) { 
             SwingComboBoxItem { 
              selected: false 
              text: classItem.toString() 
              value: classItem 
             } 
            } 
           } 
           Button { 
            text: "delete" 
            visible: bind listCell.selected and not listCell.empty 
            action: function() { 

            } 
           } 
           Button { 
            text: "save" 
            visible: bind listCell.selected and not listCell.empty 
            action: function() { 

            } 
           } 
          ] 
         } 
        } 
     } 
    }; 

私がいるトラブルがあります。

  1. SwingComboBoxは非常に奇妙な行動しているListCellが新鮮に選択されている場合、それだけで開きます。 SwingComboBoxItemを選択することも不可能です。
  2. 保存ボタンのアクション内で「テキスト」変数にアクセスするにはどうすればよいですか? (選択されたComboBoxのような)他の変数はありますか?私はListViewの外でListCellを定義しようとしましたが、一般的にはListViewの外にあるものをすべて定義するので、すべてを簡単に使うことができますが、いくつかのことがすでに定義されているというエラーがあります。

基本的に2番目の問題については、ListViewを別の方法で入力する方法を知りたいと思っています。

私は実際にGoogleマシンで何も使用されていません。誰かが助けてくれたら、私はそれを感謝します!

答えて

0

私はthis linkが役に立ったと思います。

関連する問題