Ejemplo n.º 1
0
  private void initComponents() {
    groupsList = new JList();
    add(groupsList);

    slider = new MultiListSlider();
    add(slider);

    groupsList.setCellRenderer(new MultiListCellRenderer());

    updateList();
    slider.setMultiListSlidable(this);
    setPreferredSize(
        new Dimension(
            LABEL_SPACE + groupsList.getPreferredSize().width + slider.getWidth(),
            groupsList.getPreferredSize().height));
    setSize(getPreferredSize());
    updateLocations();
  }
Ejemplo n.º 2
0
 private void updateLocations() {
   groupsList.setBounds(
       LABEL_SPACE, 0, groupsList.getPreferredSize().width, groupsList.getPreferredSize().height);
   slider.setBounds(LABEL_SPACE + groupsList.getWidth(), 0, slider.getWidth(), slider.getHeight());
 }
Ejemplo n.º 3
0
 @Override
 public Dimension getPreferredScrollableViewportSize() {
   final Dimension dim = groupsList.getPreferredScrollableViewportSize();
   return new Dimension(
       (int) (LABEL_SPACE + dim.getWidth() + slider.getWidth()), (int) dim.getHeight());
 }