List of usage examples for javax.swing JSplitPane setLastDividerLocation
@BeanProperty(description = "The last location the divider was at.") public void setLastDividerLocation(int newLastLocation)
newLastLocation
. From source file:edu.ku.brc.specify.utilapps.RegisterApp.java
/** * /*from ww w . j av a 2 s.co m*/ */ protected void createUI() { JTabbedPane tabbedPane = new JTabbedPane(); rp = new RegProcessor(); rp.processSQL(); tree = new JTree(rp.getRoot(INCL_ANON)); propsTable = new JTable(); tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { fillPropsTable(); } }); tree.setCellRenderer(new MyTreeCellRenderer()); Component topComp = UIHelper.createScrollPane(tree); Component botComp = UIHelper.createScrollPane(propsTable); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComp, botComp); splitPane.setDividerLocation(0.5); splitPane.setOneTouchExpandable(true); splitPane.setLastDividerLocation(300); Dimension minimumSize = new Dimension(200, 400); topComp.setMinimumSize(minimumSize); botComp.setMinimumSize(minimumSize); tabbedPane.add("Registration", splitPane); final List<Pair<String, String>> trackDescPairs = rp.getTrackKeyDescPairs(); Vector<String> trkItems = new Vector<String>(); for (Pair<String, String> p : trackDescPairs) { trkItems.add(p.second); } //Collections.sort(trkItems); final JList list = new JList(trkItems); //pb.add(UIHelper.createScrollPane(list), cc.xy(1, 1)); list.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int inx = list.getSelectedIndex(); if (inx > -1) { fillUsageItemsList(trackDescPairs.get(inx).first); } } } }); tabbedPane.add("Reg Stats", getStatsPane("Registration", rp.getRegNumHash().values(), "register")); DefaultListModel model = new DefaultListModel(); trackItemsList = new JList(model); topComp = UIHelper.createScrollPane(list); botComp = UIHelper.createScrollPane(trackItemsList); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComp, botComp); splitPane.setDividerLocation(0.5); splitPane.setOneTouchExpandable(true); topComp.setMinimumSize(minimumSize); botComp.setMinimumSize(minimumSize); splitPane.setDividerLocation(0.5); trackUsageHash = rp.getTrackCatsHash(); tabbedPane.add("Usage Tracking", splitPane); tabbedPane.add("User Stats", getStatsPane("Tracking", rp.getTrackIdHash().values(), "track")); add(tabbedPane, BorderLayout.CENTER); }