package prolog; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.JTextField; import jpl.Atom; import jpl.JPL; import jpl.Query; import jpl.Term; import jpl.Variable; @SuppressWarnings({ "unchecked", "deprecation", "serial" }) public class JavaProlog extends JFrame { JButton startButton = new JButton("Start"); JTextArea textArea = new JTextArea("This program diagnoses why a car won''t start.\n" + "Answer all questions with Y for yes or N for no."); /** * Konstruktor - towrzy okienko z przyciskiem ktory wywoluje prologa */ JavaProlog(){ Container cp=getContentPane(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocation (200,200); setSize (300,200); setLayout (new FlowLayout()); startButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ startDiagnose(); } }); cp.add(textArea2); cp.add(textArea); cp.add(startButton); setVisible(true); } private void startDiagnose(){ Query queryConsult = new Query("consult", new Atom("pl/carJPL.pl")); queryConsult.query(); Query start = new Query("start"); start.query(); } public static void main( String argv[] ){ JPL.init(); JavaProlog jpTest = new JavaProlog(); }/***** main *****/ }/**=== JavaProlog ===*/