`

JList 滚动条滚动到最底部的问题

阅读更多

不多说,上代码。

使用getViewport()就好。

				String newProd = JOptionPane.showInputDialog(SettingFrame.this, "Please enter the name of queue you want to monitor.");
				if(newProd != null && newProd.trim().length() > 0) {
					SettingFrame.this.prodListModel.addElement(newProd);
					int endIndex = SettingFrame.this.prodListModel.size() - 1;
					
					Point point = SettingFrame.this.listProducts.indexToLocation(endIndex);
					selectJListIndex(SettingFrame.this.listProducts, endIndex);
					SettingFrame.this.scrollPaneProd.getViewport().setViewPosition(point);
				}
			}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics