I'm developing an application that has methods of this kind:attackIfIsFar();protectIfIsNear();helpAfterDeadOf();helpBeforeAttackOf();etc.The initialization of my application for n players is something likeplayer1.attackIfIsFar(player2);player2.protectIfIsNear(player4);player3.helpAfterDeadOf(player1);player4.helpBeforeAttackOf(player3);etc.I don't know how to configure a jtable that that can allow me to set the equivalent of this code-blockIn others words I need simply a way to create a jtable with 3 column and n row, were I can set in the column 1 and 3, the player, and in the central column one of the available methods that each player on the column 1 must invoke on each player of column 3 
How to configure simple game AI setting with jtable
java
First you need an class to represent the expression.public class Expression {  private Person lhs;  private Person rhs;  private Action action;}Then you need to make a TableModel that is backed by a list of Expressions. Column count will be 3 and row count will be the size of the list. The rest of the methods are fairly straight forward to implement by mapping the row and/or column to the respective Expression and/or field.Then you need a JTable that sets the TableCellEditor for each column. Each of which would be a combo box with the available options for the respective field. If you need more help with tables, read this tutorial.Once all the values are configured, you will need to create some logic that will evaluate the expressions and calls the correct methods.EditHere is a very basic cell editor example. You could take steps to not populate the combo boxes with a value that will allow the user to select an invalid value.@Overridepublic TableCellEditor getCellEditor(int row, int col){  switch (col) {  case 0:  case 2:    return new DefaultCellEditor(new JComboBox(LIST_OF_PEOPLE));  case 1:    return new DefaultCellEditor(new JComboBox(LIST_OF_ACTIONS));  default:    return super.getCellEditor(row, col);  }}