104 lines
2.8 KiB
Java
104 lines
2.8 KiB
Java
import java.awt.BorderLayout;
|
|
import java.awt.Dimension;
|
|
import java.awt.FlowLayout;
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.ActionListener;
|
|
|
|
import javax.swing.BoxLayout;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JScrollPane;
|
|
import javax.swing.JTable;
|
|
import javax.swing.UIManager;
|
|
import javax.swing.UnsupportedLookAndFeelException;
|
|
import javax.swing.table.DefaultTableModel;
|
|
|
|
|
|
public class Gui extends JFrame
|
|
{
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID=1L;
|
|
JTable images;
|
|
JButton execute;
|
|
JButton close;
|
|
|
|
public Gui()
|
|
{
|
|
super();
|
|
this.setTitle("DepthMapExtractor");
|
|
this.setVisible(true);
|
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
|
this.setSize(new Dimension(600,400));
|
|
try {
|
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {}
|
|
JPanel content = new JPanel(new BorderLayout());
|
|
this.add(content);
|
|
DefaultTableModel model = new DefaultTableModel();
|
|
model.addColumn("filename");
|
|
this.images = new JTable(model);
|
|
JButton addBtn = new JButton("+");
|
|
addBtn.addActionListener(new ActionListener(){
|
|
@Override
|
|
public void actionPerformed(ActionEvent arg0)
|
|
{
|
|
//TODO: AddFilesDialog
|
|
}
|
|
});
|
|
JButton remBtn = new JButton("-");
|
|
remBtn.addActionListener(new ActionListener(){
|
|
@Override
|
|
public void actionPerformed(ActionEvent arg0)
|
|
{
|
|
//TODO: Remove selected files from table
|
|
}
|
|
});
|
|
JPanel tablePanel = new JPanel(new FlowLayout());
|
|
tablePanel.add(new JScrollPane(images));
|
|
JPanel tableButtons = new JPanel();
|
|
tableButtons.setLayout(new BoxLayout(tableButtons,BoxLayout.Y_AXIS));
|
|
tableButtons.add(addBtn);
|
|
tableButtons.add(remBtn);
|
|
tablePanel.add(tableButtons);
|
|
content.add(tablePanel, BorderLayout.NORTH);
|
|
|
|
execute = new JButton("Execute");
|
|
execute.addActionListener(new ActionListener(){
|
|
@Override
|
|
public void actionPerformed(ActionEvent arg0)
|
|
{
|
|
//TODO: Actions
|
|
}
|
|
});
|
|
close = new JButton("Close");
|
|
close.addActionListener(new ActionListener(){
|
|
@Override
|
|
public void actionPerformed(ActionEvent arg0)
|
|
{
|
|
dispose();
|
|
}
|
|
});
|
|
|
|
JPanel buttons = new JPanel(new FlowLayout());
|
|
buttons.add(close); buttons.add(execute);
|
|
content.add(buttons,BorderLayout.SOUTH);
|
|
this.pack();
|
|
}
|
|
|
|
public void executeExtraction()
|
|
{
|
|
DefaultTableModel model = (DefaultTableModel) images.getModel();
|
|
for(int i=0; i<model.getRowCount(); i++)
|
|
{
|
|
@SuppressWarnings("unused")
|
|
String filepath = (String) model.getValueAt(i, 0);
|
|
//DepthMapExtractor dme = new DepthMapExtractor(filepath);
|
|
//dme.extractDepthMap();
|
|
//TODO: check checkboxes etc.
|
|
}
|
|
}
|
|
}
|