Exploring the Java Class Libraries of The Leola Programming Language Framework
import leola.net.*;
import leola.lang.*;
import leola.io.*;
class ServerHandler implements ConnectionHandler {
public void handleConnection(Connection connection) {
}
}
public class Server {
public static void main(String[] args) {
try {
ServerSocket serverSocket = new ServerSocket(8080);
while (true) {
Connection connection = serverSocket.accept();
ConnectionThread connectionThread = new ConnectionThread(connection, new ServerHandler());
connectionThread.start();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
import leola.gui.*;
import leola.lang.*;
import leola.io.*;
public class MyApp extends Application {
public void start(Stage primaryStage) {
primaryStage.setTitle("My Application");
Button button = new Button("Click Me!");
button.setOnClick(new EventHandler() {
public void handle(Event event) {
System.out.println("Button clicked!");
}
});
primaryStage.setScene(new Scene(button, 200, 200));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
import leola.db.*;
import leola.lang.*;
public class DatabaseExample {
public static void main(String[] args) {
try {
DatabaseConnection connection = Database.getConnection("jdbc:mysql://localhost:3306/mydb", "user", "password");
QueryResult result = connection.query("SELECT * FROM customers");
while (result.next()) {
System.out.println(result.getString("name"));
}
connection.execute("INSERT INTO customers (name, email) VALUES ('John Doe', 'johndoe@example.com')");
connection.execute("UPDATE customers SET email = 'newemail@example.com' WHERE id = 1");
connection.close();
} catch (DatabaseException e) {
e.printStackTrace();
}
}
}