Esempio n. 1
0
  public MediaPlayer(String projectPath) {
    ac = new AudioConverter(projectPath);

    setTitle("Vidivox");
    setSize(1024, 735);
    setLocation(200, 200);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getRootPane().setBorder(BorderFactory.createMatteBorder(0, 3, 0, 3, Color.WHITE));

    mainFrame = this;
    mainFrame.setResizable(false);
    progress = new ProgressSlider(this);
    menuBar = new Menu(this, ac);
    this.projectPath = projectPath;
    playButton = new JButton("Play");

    mainFrame.addWindowStateListener(
        new WindowStateListener() {
          @Override
          public void windowStateChanged(WindowEvent e) {
            mainFrameWindowStateChanged(e);
          }
        });

    mainSetUp();
    vidOption = new VideoOptions(video);

    // Timer to update progress bar
    int delay = 50;
    ActionListener updateSlider =
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (vidSelected) {
              if (!isHidden) {
                audioTabPane.setVisible(true);
                projectPane.setVisible(true);
              }
              progress.setLength();
              progress.updateSlider(video.getTime());
              if (video.getTime() <= 250) {
                video.mute(false);
              }
              timeLbl1.setText(vidOption.timeOfVid(video.getTime()));
              timeLbl2.setText(vidOption.timeOfVid(video.getLength()));
              vidOptionsEnableDisable(true);
            } else {
              audioTabPane.setVisible(false);
              projectPane.setVisible(false);
              vidOptionsEnableDisable(false);
            }
          }
        };

    Timer timer = new Timer(delay, updateSlider);
    timer.start();
  }
Esempio n. 2
0
  public void attachMainPanel() {

    // MAIN PANEL
    mainPanel = new JPanel(new BorderLayout(3, 0));
    mainFrame.setContentPane(mainPanel);
  }