0

this is a part of my code :

    listNumber1 = new JList();
    listNumber1.setListData(numbers);
    listNumber1.setVisibleRowCount(5);
    scroll1 = new JScrollPane(listNumber1);
    scroll1.setPreferredSize(new Dimension(50,100));


    listOperations = new JList();
    listOperations.setListData(operations);
    listOperations.setVisibleRowCount(5);
    scroll2 = new JScrollPane(listOperations);
    scroll2.setPreferredSize(new Dimension(50,100));

    listNumber2 = new JList();
    listNumber2.setListData(numbers);
    listNumber2.setVisibleRowCount(5);
    scroll3 = new JScrollPane(listNumber2);
    scroll3.setPreferredSize(new Dimension(50,100));

example

My Question : How to increase the vertical gabs between (+), (-) and (*) to be like the middle JList in the picture

4

3 回答 3

2

您可以尝试覆盖getFixedCellHeight()以返回 JList / 3 的高度。

于 2013-11-09T16:12:06.607 回答
0

您可以只使用空字符串作为间隙。这并不理想,因为如果用户选择它们,您将无需执行任何操作或显示用户友好的错误,但它会起作用。

于 2013-11-09T08:39:44.093 回答
0

根据 camickr 的回答:

要增加单元格高度:

 list.setFixedCellHeight(Hight );

对于问题高度 = 30将给出一个很好的结果:

 listOperations.setFixedCellHeight(30);
于 2013-11-09T16:34:45.780 回答