1. Panel on Splitpane: Fully occupy the Pane coderanch.compublic class P extends JPanel { JList list = new JList(); private DefaultListModel m; public P() { m = new DefaultListModel(); list.setModel(m); JScrollPane scroller = new JScrollPane(list); scroller.setVerticalScrollBarPolicy(scroller.VERTICAL_SCROLLBAR_AS_NEEDED); scroller.setHorizontalScrollBarPolicy(scroller.HORIZONTAL_SCROLLBAR_NEVER); this.add(scroller); } } public class F extends JFrame { Public F() { P panel_1; //assume panel_2 is already declared JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT,panel_1, panel_2); sp.setDividerLocation(250); this.getContentPane().add(sp, BorderLayout.CENTER); this.setVisible(true); this.setDefaultCloseOperation(this.EXIT_ON_CLOSE); } } ... |
2. Loading and unloading panels on one side of JSplitPane coderanch.comHi all I'm trying to create an application where on one side of a JSplitPane is the navigation and on the other side panels are loaded. For example, on the left side, when i click Add Item, on the right side the panel that is for adding an item is displayed. If I click Options on the left side, the Add ... |