Ho costruito con NetBeans con JFrameForm una finestra con 3 campi testo, due per mettere l'indirizzo dei file d'origine e uno per specificare la destinazione del file d'uscita, e un bottone concatena; ciò che vorrei fare è eseguire il codice Concat.java (prelevato dal sito Sun) che funziona a riga di comando con la seguente sintassi: java Concat -o file:/c:/temp/foo.mov file:/c:/movies/amovie.avi file:/c:/movies/bmovie.mov
dove ovviamente foo.mov è il video finale ottenuto dalla concatenazione di amovie e bmovie.
Nel codice del JFrameFrom devo fare in modo che alla pressione del bottone Concatena, venga eseguito il Concat.java usando come percorsi quelli prelevati dai 3 campi testo. Il codice JFrameForm è il seguente e non so cosa mettere dentro
private void concatButtonActionPerformed(java.awt.event.ActionE vent evt) {
}
codice:
import javax.media.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
public class Video extends javax.swing.JFrame {
/** Creates new form Video */
public Video() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
video1Text = new javax.swing.JTextField();
video1Label = new javax.swing.JLabel();
video2Label = new javax.swing.JLabel();
video2Text = new javax.swing.JTextField();
videoFinaleText = new javax.swing.JTextField();
videoFinaleLabel = new javax.swing.JLabel();
concatButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
video1Label.setText("Video 1");
video2Label.setText("Video 2");
videoFinaleLabel.setText("Video Finale");
concatButton.setText("Concatena");
concatButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
concatButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(41, 41, 41)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(videoFinaleLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(videoFinaleText, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(video2Text, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(video2Label, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(video1Label, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(video1Text, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addGap(97, 97, 97)
.addComponent(concatButton)))
.addContainerGap(167, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(video1Label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(video1Text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(video2Label)
.addGap(18, 18, 18)
.addComponent(video2Text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(videoFinaleLabel)
.addGap(18, 18, 18)
.addComponent(videoFinaleText, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
.addComponent(concatButton)
.addContainerGap())
);
pack();
}// </editor-fold>
private void concatButtonActionPerformed(java.awt.event.ActionEvent evt) {
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Video().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton concatButton;
private javax.swing.JLabel video1Label;
private javax.swing.JTextField video1Text;
private javax.swing.JLabel video2Label;
private javax.swing.JTextField video2Text;
private javax.swing.JLabel videoFinaleLabel;
private javax.swing.JTextField videoFinaleText;
// End of variables declaration
}
[COLOR=red]