# Button einfügen



## Gast (9. Sep 2008)

Hallo ich habe eine Tabelle und brauche unterhalb der Tabelle 3 Button

1. Bearbeiten                    2. Speichern                3.Schließen

Kann jemand es für mich machen.


Hier die Code von der Tabelle



```
import java.awt.BorderLayout;
import java.awt.MenuBar;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.Date;
import java.util.EventObject;
import java.awt.event.*;  

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class TableFeature extends JFrame {

	String titles[] = new String[] { "DATUM", "NAME", "BEMERKUNG"};

public TableFeature() {
  super("Simple JTable Test");
  setSize(300, 200);
  setDefaultCloseOperation(EXIT_ON_CLOSE);

  File pwd = new File(".");
  Object[][] stats = getFileStats(pwd);

  JTable jt = new JTable(stats, titles);
  jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  jt.setColumnSelectionAllowed(true);

  JScrollPane jsp = new JScrollPane(jt);
  getContentPane().add(jsp, BorderLayout.CENTER);
}

public Object[][] getFileStats(File dir) {
  String files[] = dir.list();
  Object[][] results = new Object[files.length][titles.length];

  for (int i = 0; i < files.length; i++) {
    File tmp = new File(files[i]);
    results[i][0] = new Boolean(tmp.isDirectory());
    results[i][1] = tmp.getName();
    results[i][2] = new Boolean(tmp.canRead());
    results[i][3] = new Boolean(tmp.canWrite());
    results[i][4] = new Long(tmp.length());
    results[i][5] = new Date(tmp.lastModified());
  }
  return results;
}

public static void main(String args[]) {
  TableFeature tf = new TableFeature();
  tf.setVisible(true);
}
}
```


----------



## Tobias (9. Sep 2008)

```
public TableFeature() {
  super("Simple JTable Test");
  setSize(300, 200);
  setDefaultCloseOperation(EXIT_ON_CLOSE);

  File pwd = new File(".");
  Object[][] stats = getFileStats(pwd);

  JTable jt = new JTable(stats, titles);
  jt.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  jt.setColumnSelectionAllowed(true);

  JScrollPane jsp = new JScrollPane(jt);
  getContentPane().add(jsp, BorderLayout.CENTER);

  JPanel p = new JPanel();
  p.add(new JButton("Add"));
  p.add(new JButton("Edit"));
  p.add(new JButton("Delete"));

  getContentPane().add(p, BorderLayout.SOUTH);
}
```


----------



## Gast (9. Sep 2008)

Tobias vielen Dank

Das ist ganz toll 

Danke Danke


----------

