Ejemplo n.º 1
0
    public void init(GameContainer container, StateBasedGame game) throws SlickException {
      indv = new Display(container);
      indv.setSendingGlobalEvents(false);

      final Frame win1 = new Frame("State 2");
      win1.setBounds(200, 205, 200, 100);
      win1.setVisible(true);
      win1.setResizable(false);
      indvWindows.add(win1);
      indv.add(win1);

      ToggleButton button = new ToggleButton("Click");
      button.pack();
      button.setLocation(200, 150);
      button.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              win1.setResizable(!win1.isResizable());
            }
          });
      indv.add(button);

      Label label = new Label("Use the button to toggle window resizing.");
      label.pack();
      label.setLocation(button.getX(), button.getY() - label.getHeight() - 5);
      label.setOpaque(true);
      label.setBackground(new Color(1f, 1f, 1f, 0.85f));

      indv.add(label);
    }