Project Java OOP (IT59118)
Computer Engineering , Panyapiwat Institute Of Management
Table : DATA
Column | Type | Schema |
---|---|---|
ID | INTEGER | PK , AUTOINCREMENT |
vocab | TEXT | NOT NULL , UNIQUE |
meaning | TEXT | NOT NULL |
SQlite JAR File : https://bitbucket.org/xerial/sqlite-jdbc/downloads/
public static void main(String[] args) {
Database db = new Database("jdbc:sqlite:data.db");
db.connect();
db.insert.insertData("Dream", "ความฝัน");
db.close();
}
}
public static void main(String[] args) {
Database db = new Database("jdbc:sqlite:data.db");
db.connect();
ArrayList <Object> data = db.select.getTable(); //retrun ArrayList type Object
db.close();
}
}
public static void main(String[] args) {
Database db = new Database("jdbc:sqlite:data.db");
db.connect();
ArrayList <Object> data = db.select.getColumn("vocab"); //retrun ArrayList type Object
db.close();
}
}
public static void main(String[] args) {
Database db = new Database("jdbc:sqlite:data.db");
db.connect();
ArrayList <Object> data = db.select.getRow("vocab","Dream"); //retrun ArrayList type Object
db.close();
}
}
public static void main(String[] args) {
Database db = new Database("jdbc:sqlite:data.db");
db.connect();
ArrayList <Object> data = db.select.query("SQL Command"); //retrun ArrayList type Object
db.close();
}
}
public static void main(String[] args) {
Database db = new Database("jdbc:sqlite:data.db");
db.connect();
db.delete.delete("text"); //delete WHERE vocab
db.close();
}
}
Translate by Google API
- https://github.com/google/gson
- https://search.maven.org/artifact/com.google.code.gson/gson/2.8.6/jar
public static void main(String[] args) {
Translate translator = new Translate("API KEY");
String text = translator.translate("My name is Dream", "en", "th");
System.out.println(text);
}
}
text to speech by free tts
public static void main(String[] args) {
TextToSpeech tts = new TextToSpeech();
tts.speak("My name is Dream");
}
}