Exemplo n.º 1
0
  @Override
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() == spvp.getDeleteAllButton()) {
      Icy.getMainInterface().getSwimmingPool().removeAll();
    }
  }
Exemplo n.º 2
0
  private void refreshGUI() {
    spvp.getScrollPanel().removeAll();

    for (SwimmingObject result : Icy.getMainInterface().getSwimmingPool().getObjects()) {
      JPanel panel = new SwimmingPoolObjectPanel(result);
      ComponentUtil.setFixedHeight(panel, 40);
      spvp.getScrollPanel().add(panel);
    }

    spvp.getScrollPanel().add(Box.createVerticalGlue());

    String text = "No object in swimming pool.";

    int numberOfSwimmingObject = Icy.getMainInterface().getSwimmingPool().getObjects().size();
    if (numberOfSwimmingObject > 0) {
      text = "" + numberOfSwimmingObject + " objects in swimming pool.";
    }

    spvp.getNumberOfSwimmingObjectLabel().setText(text);

    spvp.getScrollPane().invalidate();
    spvp.getScrollPane().repaint();
  }
Exemplo n.º 3
0
  public SwimmingPoolViewer() {

    mainFrame.getContentPane().setLayout(new BorderLayout());
    mainFrame.getContentPane().add(spvp, BorderLayout.CENTER);
    mainFrame.setVisible(true);
    mainFrame.setPreferredSize(new Dimension(400, 400));
    mainFrame.addToDesktopPane();
    mainFrame.center();
    mainFrame.pack();

    Icy.getMainInterface().getSwimmingPool().addListener(this);
    spvp.getDeleteAllButton().addActionListener(this);

    refreshGUI();

    mainFrame.requestFocus();
  }