public ListScrollPane(final ListAdapter<E> listAdapter) { this.listAdapter = listAdapter; this.cache = new ArrayList<>(listAdapter.getSize()); content = new JPanel(); content.setLayout(new VerticalBagLayout()); setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; final JScrollPane scrollPane = new JScrollPane(content); add(scrollPane, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.FIRST_LINE_START; c.weightx = 1; c.weighty = 1; update(); }
/** * This method initializes navigationPanel. * * @return javax.swing.JPanel. */ private JPanel getNavigationPanel() { if (navigationPanel == null) { navigationPanel = new JPanel(new VerticalBagLayout()); navigationPanel.add(getPlaceFinder()); navigationPanel.add(getPlacesToGoPanel()); JPanel buttons = new JPanel(); buttons.setBackground(UIManager .getColor("TaskPaneGroup.background")); final int rows = 3; buttons.setLayout(new GridLayout(rows, 2)); buttons.add(getRouteButton(), null); buttons.add(getDownloadButton(), null); buttons.add(getCenterOnGPSButton(), null); buttons.add(getShowTrailButton(), null); buttons.add(getAutoCenterModeButton(), null); buttons.add(getAutoRotateModeButton(), null); navigationPanel.add(buttons); // setup minimum size for correct displaying with selected layout int minimumWidth = getPlaceFinder().getPreferredSize().width; int minimumHeight = getPlaceFinder().getPreferredSize().height + getPlacesToGoPanel().getPreferredSize().height + buttons.getPreferredSize().height; Dimension dimension = new Dimension(minimumWidth, minimumHeight); navigationPanel.setMinimumSize(dimension); } return navigationPanel; }
/** * Create the graphical-interface. */ private void initialize() { this.setLayout(new VerticalBagLayout(3)); this.box = new MapOverBox(BOUNDS.getSize()); box.setLayout(new BorderLayout()); JComponent intersection = new Intersection(); this.myCurrentInstructionLabel.setForeground(Color.WHITE); this.myCurrentInstructionLabel.setHorizontalTextPosition(SwingConstants.CENTER); box.add(intersection, BorderLayout.NORTH); box.add(this.myCurrentInstructionLabel, BorderLayout.CENTER); this.add(box); }