我对 Java 很陌生,所以请放轻松。经过大量研究,我相信我明白该JScrollPane选项默认显示滚动条。我正在尝试在某些现有代码中更改此行为。我相信默认值只需要更改为VERTICAL_SCROLLBAR_NEVER. 但是,我很难确定它在代码中的设置位置。有人可以帮我看看这个属性的设置位置(或者我是否在正确的轨道上)?
这是我认为与此问题相关的代码段。滚动条出现在拆分窗格窗口的右侧。我想永久隐藏这一点。
public class LauncherFrame extends JFrame {
private final Launcher launcher;
@Getter
private final InstanceTable instancesTable = new InstanceTable();
private final InstanceTableModel instancesModel;
@Getter
private final JScrollPane instanceScroll = new JScrollPane(instancesTable);
private WebpagePanel webView;
private JSplitPane splitPane;
private final JButton launchButton = new JButton(SharedLocale.tr("launcher.launch"));
private final JButton refreshButton = new JButton(SharedLocale.tr("launcher.checkForUpdates"));
private final JButton optionsButton = new JButton(SharedLocale.tr("launcher.options"));
private final JButton selfUpdateButton = new JButton(SharedLocale.tr("launcher.updateLauncher"));
private final JCheckBox updateCheck = new JCheckBox(SharedLocale.tr("launcher.downloadUpdates"));
public LauncherFrame(@NonNull Launcher launcher) {
super(tr("launcher.title", launcher.getVersion()));
this.launcher = launcher;
instancesModel = new InstanceTableModel(launcher.getInstances());
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setSize(new Dimension(615, 322));
setResizable(false);
initComponents();
setLocationRelativeTo(null);
SwingHelper.setFrameIcon(this, Launcher.class, "icon.png");
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
loadInstances();
}
});
}
梦里花落0921
皈依舞
相关分类