Help making a JTree with a JCheckBox

前端 未结 3 1408
梦如初夏
梦如初夏 2021-01-03 06:43

I have an unusual situation where I need to have a JTree with each node containing 2 checkboxes and a label (with the ability to add a listener to tell when any of the poten

3条回答
  •  清歌不尽
    2021-01-03 07:08

    It wasn't clear where the buildFrame(), addStuffToFrame() and createNodes() methods go. I put them all into an OutlineJFrame class I created that extends JFrame, and deleted the 'frame.' preface where-ever it appeared. Then in my project's main() method, it just created one of those OutlineJFrame objects and set its visible to true. When it ran, I got a resizable but empty window. Where were the rows? Where were the nodes?

    Then I asked Geertjan, the NetBeans guru, what I was doing wrong, and he sent me a re-write. But it had the same behaviour.

    But I know that my java is fine, because another demo project I did (FileTreeJFrame) displays outline.java objects just fine.

提交回复
热议问题