Exemplo n.º 1
0
  // This method starts a newGame by initializing everything that is necessary before calling the
  // game() method
  public void newGame() {
    // Calls the loadMap method to load the map for the game
    loadMap();

    // Calls the createPlayers method to create the players needed for the game
    createPlayers();

    // Starts the powerup manager to make powerups
    pum.startPowerUps();

    // Makes the gamePanel the only visible panel
    gamePanel.setVisible(true);
    optionsPanel.setVisible(false);
    rulesPanel.setVisible(false);
    controlsPanel.setVisible(false);
    creditsPanel.setVisible(false);
    titlePanel.setVisible(false);

    // Resets some variables needed to play the game
    winPlayer = 5;
    deadPlayers = 0;

    // Calls the game() method to play the game
    game();
  }
Exemplo n.º 2
0
 // This method makes only the credits panel visible
 public void credits() {
   // Makes only the creditsPanel visible
   gamePanel.setVisible(false);
   optionsPanel.setVisible(false);
   rulesPanel.setVisible(false);
   controlsPanel.setVisible(false);
   creditsPanel.setVisible(true);
   titlePanel.setVisible(false);
 }
Exemplo n.º 3
0
 /**
  * setEDPData
  *
  * @param data EDPCellData
  */
 public void setCellData(EDPCellData data) {
   m_data = data;
   paramKeys = data.getPlugin().getPrintfDescrs(!m_isCrawlRuleEditor);
   data.getPlugin().addParamListener(this);
   setTemplate((PrintfTemplate) data.getData());
   m_isCrawlRuleEditor = data.getKey().equals(DefinableArchivalUnit.KEY_AU_CRAWL_RULES);
   // initialize the combobox
   updateParams(data);
   if (m_isCrawlRuleEditor) {
     matchPanel.setVisible(true);
   } else {
     matchPanel.setVisible(false);
   }
 }
  private JComponent createSettingsPanel() {
    JPanel result = new JPanel(new FlowLayout(FlowLayout.RIGHT, 3, 0));
    result.add(new JLabel(ApplicationBundle.message("label.font.size")));
    myFontSizeSlider = new JSlider(JSlider.HORIZONTAL, 0, FontSize.values().length - 1, 3);
    myFontSizeSlider.setMinorTickSpacing(1);
    myFontSizeSlider.setPaintTicks(true);
    myFontSizeSlider.setPaintTrack(true);
    myFontSizeSlider.setSnapToTicks(true);
    UIUtil.setSliderIsFilled(myFontSizeSlider, true);
    result.add(myFontSizeSlider);
    result.setBorder(BorderFactory.createLineBorder(UIUtil.getBorderColor(), 1));

    myFontSizeSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            if (myIgnoreFontSizeSliderChange) {
              return;
            }
            EditorColorsManager colorsManager = EditorColorsManager.getInstance();
            EditorColorsScheme scheme = colorsManager.getGlobalScheme();
            scheme.setQuickDocFontSize(FontSize.values()[myFontSizeSlider.getValue()]);
            applyFontSize();
          }
        });

    String tooltipText = ApplicationBundle.message("quickdoc.tooltip.font.size.by.wheel");
    result.setToolTipText(tooltipText);
    myFontSizeSlider.setToolTipText(tooltipText);
    result.setVisible(false);
    result.setOpaque(true);
    myFontSizeSlider.setOpaque(true);
    return result;
  }
Exemplo n.º 5
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == enableDefaultEncryption) {
     loadStates();
   } else if (e.getSource() == cmdExpandAdvancedSettings) {
     pnlAdvancedSettings.setVisible(!pnlAdvancedSettings.isVisible());
   }
 }
  HeatMapControls(ControlBar creator) {
    super();
    parent = creator;

    setLayout(new BorderLayout());
    super.setPreferredSize(new Dimension(255, 170));

    String[] organisms = SpeciesTable.getOrganisms();
    String[] options = new String[organisms.length + 1];

    options[0] = "None";
    for (int i = 0; i < organisms.length; i++) {
      options[i + 1] = organisms[i];
    }

    species = new JComboBox(options);
    species.addActionListener(this);
    for (String str : SpeciesTable.getOrganisms()) {}

    super.add(species, BorderLayout.SOUTH);
    super.add(new Gradient(), BorderLayout.CENTER);
    super.add(new JLabel("Least"), BorderLayout.WEST);
    super.add(new JLabel("Most"), BorderLayout.EAST);
    super.add(new JLabel("Heat Map Controls"), BorderLayout.NORTH);
    super.setVisible(true);
  }
Exemplo n.º 7
0
  public void enableControlPanel() {
    boolean bVisible = false;

    int nmembers = buttonPane.getComponentCount();
    for (int k = 0; k < nmembers; k++) {
      Component comp = buttonPane.getComponent(k);
      if (comp != null) {
        if (comp.isVisible() || comp.isEnabled()) {
          bVisible = true;
          break;
        }
      }
    }

    if (bVisible && !buttonPane.isVisible()) {
      Dimension dim = getSize();
      Dimension dim1 = buttonPane.getPreferredSize();
      int w = dim.width;
      int h = dim.height + dim1.height;
      if (dim1.width > w) w = dim1.width;
      if (w < 300) w = 300;
      if (h < 200) h = 200;
      setSize(w, h);
    }
    buttonPane.setVisible(bVisible);
  }
Exemplo n.º 8
0
  public JFrame buildFrame() {

    f = new JFrame("AMSA World");
    f.setSize(800, 600);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLayout(new GridBagLayout());

    textArea.setFocusable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            checkInput();
          }
        };
    inputText.addActionListener(listener);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1.0;
    c.gridwidth = 3;
    c.weighty = 0.025;
    c.gridx = 0;
    c.gridy = 0;
    f.add(topPanel, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 1;
    f.add(scrollPane, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 1;
    c.gridx = 2;
    c.gridy = 1;
    f.add(sidePanel, c);
    sidePanel.setVisible(false);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 0.025;
    c.gridwidth = 3;
    c.gridx = 0;
    c.gridy = 2;
    f.add(inputText, c);

    f.setVisible(true);

    return f;
  }
Exemplo n.º 9
0
  /** Update the interface display to show the current value of the calculator. */
  private void redisplay() {
    if (calc.isHexOn()) {
      int displayInt = calc.getDisplayValue();
      if (displayInt < 0) {
        // toHexString() returns an unsigned integer as a String,
        // meaning negative values return (String)(ffffffff - n) instead of (-n)
        // example: -9 would show ffffffff - 9 = fffffff4
        display.setText("-" + Integer.toHexString(Math.abs(displayInt)));
      } else {
        display.setText(Integer.toHexString(displayInt));
      }

      // show all hexButtons since hexSwitch is true
      hexPanel.setVisible(true);
    } else {
      display.setText("" + calc.getDisplayValue());
      // hide all hexButtons since hexSwitch is false
      hexPanel.setVisible(false);
    }
  }
 public void setPlayerControlsVisible(boolean b) {
   boolean oldValue = forwardButton.isVisible();
   if (oldValue != b) {
     forwardButton.setVisible(b);
     rewindButton.setVisible(b);
     startButton.setVisible(b);
     slider.setVisible(b);
     spacer.setVisible(!b);
     revalidate();
   }
 }
Exemplo n.º 11
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == easy) {
      invSpeed = 50000;
      bombN = 1;
      timeDifficulty1 = 1000;
      distanceLimit = 400;
      monsterMultiplier = 1;
      multiplier = 1;
      setup();
    } else if (e.getSource() == hard) {
      invSpeed = 30000;
      bombN = 4;
      timeDifficulty1 = 500;
      distanceLimit = 200;
      monsterMultiplier = 2;
      multiplier = 2;
      setup();
    } else if (e.getSource() == back) {
      r = null;
      menu.setVisible(true);
      back.setVisible(false);
      this.revalidate();
      repaint();
    } else if (e.getSource() == howTo) {
      menu.removeAll();

      menu.add(howToBack);
      menu.add(howToIMGL);

      menu.revalidate();
      menu.repaint();
    } else if (e.getSource() == howToBack) {
      menu.remove(howToIMGL);
      menu.remove(howToBack);

      menu.add(keyboardSpeedL1);
      menu.add(keyboardSpeedL2);
      menu.add(easy);
      menu.add(hard);
      menu.add(howTo);
      menu.add(onePlayerRB);
      menu.add(twoPlayerRB);
      menu.add(mouseRB);
      menu.add(keyboardRB);
      menu.add(keyboardSpeedS1);
      menu.add(keyboardSpeedS2);
      menu.add(musicCB);
      menu.add(highscoreL);
      menu.add(menuIMGL);

      menu.revalidate();
      menu.repaint();
    }
  }
Exemplo n.º 12
0
  public void showFrame(final Editor editor, boolean activateErrorPanel, final boolean loading) {
    this.editor = editor;

    setLayout(editor, activateErrorPanel, loading);
    contributionListPanel.setVisible(!loading);
    loaderLabel.setVisible(loading);
    errorPanel.setVisible(activateErrorPanel);

    validate();
    repaint();
  }
Exemplo n.º 13
0
  public void setVisible(boolean state) {
    super.setVisible(state);

    // has to be *after* previous call for SwingMagic reasons.
    if (state == false
        && tableData.changedByUser()) // user made changes - were they saved?  (i.e., are we
    {
      /*
       *    The setVisible() method may be called multiple time.  Only prompt
       *    the user the first time.
       */
      checkForUnsavedChanges();
    }
  }
Exemplo n.º 14
0
  private void setup() {
    playerSetup();

    deathLocation = new int[4];
    Arrays.fill(deathLocation, -1);

    menu.setVisible(false);
    this.revalidate();

    audioSetup();

    Iterator i = players.iterator();
    Player p;
    while (i.hasNext()) {
      p = (Player) i.next();
      p.resetLives(3);
      p.setActive(true);
    }

    BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
    Cursor blank =
        Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, new Point(0, 0), "BLANK");
    this.setCursor(blank);

    reset();

    ballN = 1;
    level = 1;
    timeLast = 0;
    score = 0;
    counterN = 10;
    timeCircle = 0;
    timeCircleSwitch = 0;
    programLoopCounter = 1;
    programSpeedAdjust = 1;

    onePlayerAlive = true;
    countdownF = true;
    circular = true;
    spawnIncrease = true;
    spawnCircleB = false;
    spawnMonsterB = false;
    spawnRandomersB = false;

    levelSetup();
    countdown();
    animate();
  }
Exemplo n.º 15
0
    /**
     * Set the fields from the ProjectionClass
     *
     * @param projClass projection class to use
     */
    private void setFieldsWithClassParams(ProjectionClass projClass) {

      // set the projection in the JComboBox
      String want = projClass.toString();
      for (int i = 0; i < projClassCB.getItemCount(); i++) {
        ProjectionClass pc = (ProjectionClass) projClassCB.getItemAt(i);
        if (pc.toString().equals(want)) {
          projClassCB.setSelectedItem((Object) pc);
          break;
        }
      }

      // set the parameter fields
      paramPanel.removeAll();
      paramPanel.setVisible(0 < projClass.paramList.size());

      List widgets = new ArrayList();
      for (int i = 0; i < projClass.paramList.size(); i++) {
        ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i);
        // construct the label
        String name = pp.name;
        String text = "";
        // Create a decent looking label
        for (int cIdx = 0; cIdx < name.length(); cIdx++) {
          char c = name.charAt(cIdx);
          if (cIdx == 0) {
            c = Character.toUpperCase(c);
          } else {
            if (Character.isUpperCase(c)) {
              text += " ";
              c = Character.toLowerCase(c);
            }
          }
          text += c;
        }
        widgets.add(GuiUtils.rLabel(text + ": "));
        // text input field
        JTextField tf = new JTextField();
        pp.setTextField(tf);
        tf.setColumns(12);
        widgets.add(tf);
      }
      GuiUtils.tmpInsets = new Insets(4, 4, 4, 4);
      JPanel widgetPanel = GuiUtils.doLayout(widgets, 2, GuiUtils.WT_N, GuiUtils.WT_N);

      paramPanel.add("North", widgetPanel);
      paramPanel.add("Center", GuiUtils.filler());
    }
Exemplo n.º 16
0
 protected void show0() {
   JRootPane rp = null;
   if (getOwner() instanceof JFrame) {
     rp = ((JFrame) getOwner()).getRootPane();
   } else if (getOwner() instanceof JDialog) {
     rp = ((JDialog) getOwner()).getRootPane();
   }
   if (rp != null && !isDocumentModalitySupported() && !isExperimentalSheet()) {
     ownersGlassPane = rp.getGlassPane();
     JPanel blockingPanel = new JPanel();
     blockingPanel.setOpaque(false);
     rp.setGlassPane(blockingPanel);
     blockingPanel.setVisible(true);
   }
   super.show();
 }
Exemplo n.º 17
0
  TimerControls(ControlBar creator) {
    parent = creator;
    super.setPreferredSize(new Dimension(200, 172));
    setLayout(new BorderLayout());

    pausePlay = new JButton("Play");
    speed = makeJSlider();

    pausePlay.addActionListener(this);
    speed.addChangeListener(this);

    super.add(pausePlay, BorderLayout.WEST);
    super.add(speed, BorderLayout.EAST);
    super.add(new JLabel(" Simulation Speed Controls"), BorderLayout.NORTH);

    super.repaint();
    super.setVisible(true);
  }
Exemplo n.º 18
0
  public void actionPerformed(ActionEvent e) {
    String cmd = (e.getActionCommand());

    if (cmd.equals(aboutItem.getText()))
      JOptionPane.showMessageDialog(
          this,
          "Simple Image Program for DB2004\nversion 0.1\nThanks to BvS",
          "About imageLab",
          JOptionPane.INFORMATION_MESSAGE);
    else if (cmd.equals(quitItem.getText())) System.exit(0);
    else if (cmd.equals(openItem.getText())) {
      int returnVal = chooser.showOpenDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2 = new Picture(chooser.getSelectedFile().getName());
          pic1 = new Picture(pic2.width(), pic2.height());
          lab.setIcon(pic2.getJLabel().getIcon());
          sliderPanel.setVisible(false);
          pack();
          repaint();
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not open " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Open Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }

    } else if (cmd.equals(saveItem.getText())) {
      int returnVal = chooser.showSaveDialog(this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        try {
          pic2.save(chooser.getSelectedFile().getName());
        } catch (Exception ex) {
          JOptionPane.showMessageDialog(
              this,
              "Could not write " + chooser.getSelectedFile().getName() + "\n" + ex.getMessage(),
              "Save Error",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }
    }
  }
Exemplo n.º 19
0
  public AdvancedPanel() {

    super();

    contentPanel = getJContentPane();
    contentPanel.setVisible(true);
    contentPanel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
    setLayout(new java.awt.BorderLayout());

    icon = getImageIcon();
    iconLabel = new JLabel();

    if (icon != null) iconLabel.setIcon(icon);

    iconLabel.setBorder(new EtchedBorder(EtchedBorder.RAISED));

    add(iconLabel, BorderLayout.WEST);
    add(contentPanel, BorderLayout.CENTER);
  }
Exemplo n.º 20
0
  ControlBar(MainWindow creator) {
    parent = creator;

    super.setPreferredSize(new Dimension(720, 172));
    setLayout(new BorderLayout());

    // add timer, save, and heatmap controls to the bar

    tc = new TimerControls(this);
    sc = new SaveControls(parent.getGrid(), this);
    hc = new HeatMapControls(this);
    add(tc, BorderLayout.WEST);
    add(hc, BorderLayout.CENTER);
    add(sc, BorderLayout.EAST);

    super.repaint();
    super.setVisible(true);
    System.out.println("Done Constucting");
  }
Exemplo n.º 21
0
  SaveControls(Grid currentGrid, ControlBar creator) {
    parent = creator;
    grid = currentGrid;
    super.setPreferredSize(new Dimension(200, 172));
    setLayout(new GridLayout(3, 0));

    fileName = new JTextField("SaveName");
    save = new JButton("Save");
    load = new JButton("Load");

    save.addActionListener(this);
    load.addActionListener(this);

    super.add(fileName);
    super.add(save);
    super.add(load);

    super.repaint();
    super.setVisible(true);
  }
Exemplo n.º 22
0
  // Transitions from Overworld to Battle scene
  public void battleBegin() {
    scene = BATTLE;
    moveUp = false;
    moveDown = false;
    moveLeft = false;
    moveRight = false;

    // Background changer
    int bgSelector = (int) (10 * Math.random() + 1);
    if (bgSelector > 5) {
      ImageIcon bg = new ImageIcon("BattleBG1.jpg");
      background = bg.getImage();
      battleBG = 1;
      player.battleBegin(235, 380);
      int placed = 0;
      for (int enemyNum = 0; enemyNum < enemies.size(); enemyNum++) {
        Enemy enemy = enemies.get(enemyNum);
        if (enemy.getActivity()) {
          enemy.battleBegin(440 - 20 * placed, 125);
          placed++;
          totalExperience += enemy.getEXP();
        }
      }
    } else {
      ImageIcon bg = new ImageIcon("BattleBG2.png");
      background = bg.getImage();
      battleBG = 2;
      player.battleBegin(650, 365);
      int placed = 0;
      for (int loop = 0; loop < enemies.size(); loop++) {
        if (enemies.get(loop).getActivity()) {
          enemies.get(loop).battleBegin(340 - 20 * placed, 145);
          placed++;
          totalExperience += enemies.get(loop).getEXP();
        }
      }
    }
    menuScreen.setVisible(false);
    staminaTimer.start();
  }
Exemplo n.º 23
0
  public HotSMain() {
    // General
    setPreferredSize(new Dimension(800, 600));
    canvas.add(this);
    setBackground(Color.GRAY);
    frame.setResizable(false);
    frame.setTitle("Heroes of the Forest");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Overworld
    menuScreen.setPreferredSize(new Dimension(800, 150));
    menuScreen.setBackground(Color.DARK_GRAY);
    menuScreen.setVisible(false);

    menuButtons.add(itemsButton);
    menuButtons.add(equipButton);
    menuButtons.add(skillsButton);
    menuButtons.add(statusButton);
    menuButtons.add(settingsButton);
    menuButtons.add(dataButton);

    for (JButton button : menuButtons) {
      menuScreen.add(button);
      button.addActionListener(this);
    }

    canvas.add(menuScreen, BorderLayout.SOUTH);
    ImageIcon bg = new ImageIcon("OverworldBG.jpg");
    background = bg.getImage();

    frame.pack();
    frame.setVisible(true);
    player = new Player();
    enemies.add(new Stalker(375, 200));
    player.defaultPlayer();
    frame.addKeyListener(this);
    frame.addMouseListener(this);
    frame.addMouseMotionListener(this);
    moveTimer.start();
  }
 public CreateResourceBundleDialogComponent(
     Project project, PsiDirectory directory, ResourceBundle resourceBundle) {
   myProject = project;
   myDirectory = directory;
   myResourceBundle = resourceBundle;
   if (resourceBundle != null) {
     myResourceBundleNamePanel.setVisible(false);
     myUseXMLBasedPropertiesCheckBox.setVisible(false);
   } else {
     final String checkBoxSelectedStateKey = getClass() + ".useXmlPropertiesFiles";
     myUseXMLBasedPropertiesCheckBox.setSelected(
         PropertiesComponent.getInstance().getBoolean(checkBoxSelectedStateKey));
     myUseXMLBasedPropertiesCheckBox.addContainerListener(
         new ContainerAdapter() {
           @Override
           public void componentRemoved(ContainerEvent e) {
             PropertiesComponent.getInstance()
                 .setValue(checkBoxSelectedStateKey, myUseXMLBasedPropertiesCheckBox.isSelected());
           }
         });
   }
 }
 /**
  * Event Handler. Handles login & menu events.
  *
  * @param e ActionEvent event
  */
 public void actionPerformed(ActionEvent e) {
   Object source = e.getSource();
   if (source == registerButton) {
     Register r = new Register(dataBase);
   }
   if (source == loginButton) { // CHANGE
     loggedIn = true;
     loginPanel.setVisible(false);
     if (isTeacher.isSelected()) {
       logInTeacher(uNameField.getText(), pWordField.getText());
     } else {
       logInStudent(uNameField.getText(), pWordField.getText());
     }
   }
   if (source == playBallButton) {
     PlayBall pB = new PlayBall();
   }
   if (source == manageTeamButton) {
     ManageTeam manageTeam = new ManageTeam();
   }
   if (source == viewStatsButton) {
     ViewScore viewScore = new ViewScore();
   }
 }
Exemplo n.º 26
0
 public void toggleDetailVisibility(String key, boolean visible) {
   JPanel p = keyDetailComponentMap.get(key);
   p.setVisible(visible);
 }
  public JMovieControlAqua() {
    // Set the background color to the border color of the buttons.
    // This way the toolbar won't look too ugly when the buttons
    // are displayed before they have been loaded completely.
    // setBackground(new Color(118, 118, 118));
    setBackground(Color.WHITE);

    Dimension buttonSize = new Dimension(16, 16);
    GridBagLayout gridbag = new GridBagLayout();
    Insets margin = new Insets(0, 0, 0, 0);
    setLayout(gridbag);
    GridBagConstraints c;

    ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels");
    colorCyclingButton = new JToggleButton();
    colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText"));
    colorCyclingButton.addActionListener(this);
    colorCyclingButton.setPreferredSize(buttonSize);
    colorCyclingButton.setMinimumSize(buttonSize);
    colorCyclingButton.setVisible(false);
    colorCyclingButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(colorCyclingButton, c);
    add(colorCyclingButton);

    audioButton = new JToggleButton();
    audioButton.setToolTipText(labels.getString("audio.toolTipText"));
    audioButton.addActionListener(this);
    audioButton.setPreferredSize(buttonSize);
    audioButton.setMinimumSize(buttonSize);
    audioButton.setVisible(false);
    audioButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 0;
    // c.gridy = 0;
    gridbag.setConstraints(audioButton, c);
    add(audioButton);

    startButton = new JToggleButton();
    startButton.setToolTipText(labels.getString("play.toolTipText"));
    startButton.addActionListener(this);
    startButton.setPreferredSize(buttonSize);
    startButton.setMinimumSize(buttonSize);
    startButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 1;
    // c.gridy = 0;
    gridbag.setConstraints(startButton, c);
    add(startButton);

    slider = new JMovieSliderAqua();
    c = new GridBagConstraints();
    // c.gridx = 2;
    // c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(slider, c);
    add(slider);

    rewindButton = new JButton();
    rewindButton.setToolTipText(labels.getString("previous.toolTipText"));
    rewindButton.setPreferredSize(buttonSize);
    rewindButton.setMinimumSize(buttonSize);
    rewindButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 3;
    // c.gridy = 0;

    gridbag.setConstraints(rewindButton, c);
    add(rewindButton);
    rewindButton.addActionListener(this);

    forwardButton = new JButton();
    forwardButton.setToolTipText(labels.getString("next.toolTipText"));
    buttonSize = new Dimension(17, 16);
    forwardButton.setPreferredSize(buttonSize);
    forwardButton.setMinimumSize(buttonSize);
    forwardButton.setMargin(margin);
    c = new GridBagConstraints();
    // c.gridx = 4;
    // c.gridy = 0;
    gridbag.setConstraints(forwardButton, c);
    add(forwardButton);
    forwardButton.addActionListener(this);

    // The spacer is used when the play controls are hidden
    spacer = new JPanel(new BorderLayout());
    spacer.setVisible(false);
    spacer.setPreferredSize(new Dimension(16, 16));
    spacer.setMinimumSize(new Dimension(16, 16));
    spacer.setOpaque(false);
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    gridbag.setConstraints(spacer, c);
    add(spacer);

    Border border =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.border.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderP.png"),
                    new Insets(1, 1, 1, 1),
                    new Insets(0, 4, 1, 4))));

    Border westBorder =
        new BackdropBorder(
            new ButtonStateBorder(
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWest.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4)),
                new ImageBevelBorder(
                    Images.createImage(getClass(), "images/Player.borderWestP.png"),
                    new Insets(1, 1, 1, 0),
                    new Insets(0, 4, 1, 4))));

    startButton.setBorder(westBorder);
    colorCyclingButton.setBorder(westBorder);
    audioButton.setBorder(westBorder);
    rewindButton.setBorder(westBorder);
    forwardButton.setBorder(border);
    startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton));
    colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton));
    rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton));
    forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton));

    colorCyclingButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png")));
    colorCyclingButton.setDisabledIcon(
        new ImageIcon(
            Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png")));
    audioButton.setIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png")));
    audioButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png")));
    audioButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png")));
    startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png")));
    startButton.setSelectedIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png")));
    startButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png")));
    rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png")));
    rewindButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png")));
    forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png")));
    forwardButton.setDisabledIcon(
        new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png")));

    // Automatic scrolling
    scrollHandler = new ScrollHandler();
    scrollTimer = new Timer(60, scrollHandler);
    scrollTimer.setInitialDelay(300); // default InitialDelay?
    forwardButton.addMouseListener(scrollHandler);
    rewindButton.addMouseListener(scrollHandler);
  }
Exemplo n.º 28
0
  /**
   * Shows/hides the security panel.
   *
   * @param isVisible <tt>true</tt> to show the security panel, <tt>false</tt> to hide it
   */
  public void setSecurityPanelVisible(final boolean isVisible) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setSecurityPanelVisible(isVisible);
            }
          });
      return;
    }

    final JFrame callFrame = callRenderer.getCallContainer().getCallWindow().getFrame();

    final JPanel glassPane = (JPanel) callFrame.getGlassPane();

    if (!isVisible) {
      // Need to hide the security panel explicitly in order to keep the
      // fade effect.
      securityPanel.setVisible(false);
      glassPane.setVisible(false);
      glassPane.removeAll();
    } else {
      glassPane.setLayout(null);
      glassPane.addMouseListener(
          new MouseListener() {
            public void mouseClicked(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseEntered(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseExited(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mousePressed(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseReleased(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }
          });

      Point securityLabelPoint = securityStatusLabel.getLocation();

      Point newPoint =
          SwingUtilities.convertPoint(
              securityStatusLabel.getParent(),
              securityLabelPoint.x,
              securityLabelPoint.y,
              callFrame);

      securityPanel.setBeginPoint(new Point((int) newPoint.getX() + 15, 0));
      securityPanel.setBounds(0, (int) newPoint.getY() - 5, this.getWidth(), 130);

      glassPane.add(securityPanel);
      // Need to show the security panel explicitly in order to keep the
      // fade effect.
      securityPanel.setVisible(true);
      glassPane.setVisible(true);

      glassPane.addComponentListener(
          new ComponentAdapter() {
            /** Invoked when the component's size changes. */
            @Override
            public void componentResized(ComponentEvent e) {
              if (glassPane.isVisible()) {
                glassPane.setVisible(false);
                callFrame.removeComponentListener(this);
              }
            }
          });
    }
  }
Exemplo n.º 29
0
  private void setupTypeInfo(Type.Continuous t) {
    UPBDetailPanel.setVisible(false);
    LWBDetailPanel.setVisible(false);

    yesUPB.setEnabled(false);
    noUPB.setEnabled(false);
    unspecifiedUPB.setEnabled(false);
    if (t.UPB < Double.MAX_VALUE) {
      yesUPB.setSelected(true);
      specifyUPB.setVisible(true);
      UPBDetailPanel.setVisible(true);
      if (t.UPB < Double.MAX_VALUE - Double.MIN_VALUE) {
        specifyUPB.setEnabled(false);
        specifyUPB.setSelected(true);
        UPBLabel.setVisible(true);
        UPBLabel.setEnabled(false);
        UPBLabel.setText("" + t.UPB);
      } else {
        specifyUPB.setEnabled(true);
        specifyUPB.setSelected(false);
        UPBLabel.setVisible(false);
        UPBLabel.setEnabled(true);
      }
    } else {
      unspecifiedUPB.setEnabled(true);
      specifyUPB.setVisible(false);
      UPBLabel.setVisible(false);
    }

    yesLWB.setEnabled(false);
    noLWB.setEnabled(false);
    unspecifiedLWB.setEnabled(false);
    if (t.LWB > -Double.MAX_VALUE) {
      yesLWB.setSelected(true);
      specifyLWB.setVisible(true);
      LWBDetailPanel.setVisible(true);
      if (t.LWB > -Double.MAX_VALUE + Double.MIN_VALUE) {
        specifyLWB.setEnabled(false);
        specifyLWB.setSelected(true);
        LWBLabel.setVisible(true);
        LWBLabel.setEnabled(false);
        LWBLabel.setText("" + t.LWB);
      } else {
        specifyLWB.setEnabled(true);
        specifyLWB.setSelected(false);
        LWBLabel.setVisible(false);
        LWBLabel.setEnabled(true);
      }
    } else {
      unspecifiedLWB.setEnabled(true);
      specifyLWB.setVisible(false);
      LWBLabel.setVisible(false);
    }

    if (t.ckIsCyclic) {
      yesCyclic.setEnabled(false);
      noCyclic.setEnabled(false);
      unspecifiedCyclic.setEnabled(false);
      if (t.isCyclic) {
        yesCyclic.setSelected(true);
      } else {
        noCyclic.setSelected(true);
      }
    } else {
      unspecifiedCyclic.setSelected(true);
      yesCyclic.setEnabled(true);
      noCyclic.setEnabled(true);
      unspecifiedCyclic.setEnabled(true);
    }

    excUPBButton.setEnabled(true);
    incUPBButton.setEnabled(true);
    incUPBButton.setSelected(true);

    excLWBButton.setEnabled(true);
    incLWBButton.setEnabled(true);
    incLWBButton.setSelected(true);
  }
Exemplo n.º 30
0
 public JComponent extractFilterPanel() {
   myHeaderPanel.setVisible(false);
   return myFilterPanel;
 }