当列表很大时,带有自定义ListView的JavaFX SplitPane不会滚动

时间:2021-11-06 17:01:09

like the title said I have a little aplicaiton that has a splitPane and in eache part of the pane there are two listviews with custom items. The problem is that when the listview is too large, a vertcia bar to scroll down appears... BUT it dosn't work.

就像标题所说我有一个有一个splitPane的aplicaiton,在窗格的eache部分有两个自定义项目列表视图。问题是当列表视图太大时,会出现一个向下滚动的垂直条...但它不起作用。

Here's my fxml:

这是我的fxml:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.layout.AnchorPane?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="557.0" prefWidth="1012.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <SplitPane fx:id="splitPane" dividerPositions="0.5" layoutX="-8.0" layoutY="35.0" mouseTransparent="true" prefHeight="529.0" prefWidth="1027.0" style="-fx-background-color: #EEEEEE;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="28.0">
        <items>
            <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
               <children>
                  <ListView fx:id="list_todo" layoutY="-8.0" prefHeight="527.0" prefWidth="584.0" style="-fx-padding: 3px;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
               </children>
            </AnchorPane>
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
               <children>
                  <ListView fx:id="list_done" layoutY="14.0" prefHeight="527.0" prefWidth="420.0" style="-fx-padding: 3px;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
               </children></AnchorPane>
        </items>
      </SplitPane>
      <MenuBar prefHeight="30.0" prefWidth="1012.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
        <menus>
          <Menu fx:id="menu_cambiarUser" mnemonicParsing="false" text="Cambiar usuario" />
          <Menu mnemonicParsing="false" text="Edit">
            <items>
              <MenuItem mnemonicParsing="false" text="Delete" />
            </items>
          </Menu>
          <Menu mnemonicParsing="false" text="Help">
            <items>
              <MenuItem mnemonicParsing="false" text="About" />
            </items>
          </Menu>
        </menus>
      </MenuBar>
   </children>
</AnchorPane>

I think the issue is with the SplitPlabe attribute mouseTransparent="true" that i used to make the separator stationary. Any idea what's happening and how to solve it?

我认为问题在于SplitPlabe属性mouseTransparent =“true”,我用它来使分隔符静止。知道发生了什么以及如何解决它?

1 个解决方案

#1


0  

Well, the problem was what I was thinking, the SplitPlane attribute mouseTransparent="true", I only needed to remove it and it worked!

好吧,问题出在我的想法,SplitPlane属性mouseTransparent =“true”,我只需要删除它就可以了!

#1


0  

Well, the problem was what I was thinking, the SplitPlane attribute mouseTransparent="true", I only needed to remove it and it worked!

好吧,问题出在我的想法,SplitPlane属性mouseTransparent =“true”,我只需要删除它就可以了!