Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
/**
*
*/
package de.tutorials;
import java.awt.event.MouseEvent;
import java.util.EventObject;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
/**
* @author Tom
*/
public class JTableNotifyOnEditExample extends JFrame {
JTable table;
String[] header = { "A", "B", "C", "D" };
String[][] rowData = { { "1", "1", "1", "1" }, { "2", "2", "2", "2" },
{ "3", "3", "3", "3" }, { "4", "4", "4", "4" } };
public JTableNotifyOnEditExample() {
super("JTableNotifyOnEditExample");
setDefaultCloseOperation(EXIT_ON_CLOSE);
table = new JTable(rowData, header) {
public boolean editCellAt(int row, int column, EventObject e) {
if (e == null) {
System.out.println("edit!");
}
if (e instanceof MouseEvent) {
MouseEvent mouseEvent = (MouseEvent) e;
if (mouseEvent.getClickCount() > 1) {
System.out.println("edit!");
}
}
return super.editCellAt(row, column, e);
}
};
add(new JScrollPane(table));
pack();
setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
new JTableNotifyOnEditExample();
}
}
table = new JTable(rowData, header) {
public boolean isEditing() {
System.out.println("isEditing...");
return super.isEditing();
}
};