/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* VideoDeviceInfo.java
*
* Created on 2009-10-13, 15:28:25
*/
package webcamstudio.components;
import webcamstudio.exporter.vloopback.VideoDevice;
/**
*
* @author pballeux
*/
public class VideoDeviceInfo extends javax.swing.JDialog {
/** Creates new form VideoDeviceInfo
* @param parent
* @param modal */
public VideoDeviceInfo(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
VideoDevice[] devices = VideoDevice.getDevices();
javax.swing.table.DefaultTableModel model = new javax.swing.table.DefaultTableModel();
model.addColumn("Device");
model.addColumn("Name");
model.addColumn("Version");
model.addColumn("Type");
String[] line = new String[4];
for (VideoDevice d : devices){
line[0] = d.getFile().getAbsolutePath();
line[1] = d.getName();
line[2] = d.getVersion().name();
line[3] = d.getType().name();
model.addRow(line);
}
tableInfo.setModel(model);
tableInfo.getColumnModel().getColumn(1).setMinWidth(200);
}
/** 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">//GEN-BEGIN:initComponents
private void initComponents() {
scroller = new javax.swing.JScrollPane();
tableInfo = new javax.swing.JTable();
btnClose = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("webcamstudio/Languages"); // NOI18N
setTitle(bundle.getString("VIDEODEVICEINFO")); // NOI18N
scroller.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
scroller.setName("scroller"); // NOI18N
tableInfo.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Device", "Name", "Type"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.Object.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tableInfo.setName("tableInfo"); // NOI18N
scroller.setViewportView(tableInfo);
btnClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/webcamstudio/resources/tango/process-stop.png"))); // NOI18N
btnClose.setText(bundle.getString("CLOSE")); // NOI18N
btnClose.setName("btnClose"); // NOI18N
btnClose.setPreferredSize(new java.awt.Dimension(75, 20));
btnClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCloseActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scroller, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(scroller, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed
dispose();
}//GEN-LAST:event_btnCloseActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
VideoDeviceInfo dialog = new VideoDeviceInfo(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnClose;
private javax.swing.JScrollPane scroller;
private javax.swing.JTable tableInfo;
// End of variables declaration//GEN-END:variables
}