Pure Java Development

Write your entire web application in Java—UI, logic, and events. No JavaScript required.

Java All the Way

Use your existing Java skills to build complete web applications without context switching.

HTML as Objects

Every HTML element is a Java object. Use inheritance to create reusable components and polymorphism for flexible designs.

CSS as Methods

Apply styles with setBackgroundColor(), setPadding(), setDisplay(). Full IDE support.

Events as Listeners

Handle clicks, keypresses, and form submits with familiar listener patterns.

Browser APIs

Access Geolocation, Clipboard, Notifications, Storage, and 15 more browser APIs from Java.

Full Debugging

Set breakpoints anywhere. Step through UI logic. Inspect state with your IDE.

Refactor Freely

Rename, extract, inline—your IDE's refactoring tools work perfectly.

HTML Elements as Java Objects

Every HTML5 element has a corresponding Java class. Create, configure, and compose them programmatically.

java
// Create a navigation bar
Nav navbar = new Nav();
navbar.setBackgroundColor("#1e40af");
navbar.setPadding("16px 24px");
navbar.setDisplay(Display.FLEX);
navbar.setAlignItems(AlignItems.CENTER);

// Add logo
Anchor logo = new Anchor("/");
logo.setText("MyApp");
logo.setColor("#ffffff");
logo.setFontWeight("700");
logo.setFontSize("20px");
navbar.addElement(logo);

// Add navigation links
Ul navLinks = new Ul();
navLinks.setDisplay(Display.FLEX);
navLinks.setMarginLeft("auto");
navLinks.addStyleAttribute("list-style", "none");
navLinks.addStyleAttribute("gap", "24px");

for (String page : new String[] {"Features", "Pricing", "Docs"})
{
    Li li = new Li();
    Anchor link = new Anchor("/" + page.toLowerCase());
    link.setText(page);
    link.setColor("#ffffff");
    li.addElement(link);
    navLinks.addElement(li);
}
navbar.addElement(navLinks);

body.addElement(navbar);

Browser APIs in Java

Access browser JavaScript APIs directly from Java. Geolocation, Clipboard, Notifications, Web Storage, and more—all with type-safe Java wrappers that handle the underlying JavaScript automatically.

GeolocationApi

User location

ClipboardApi

Copy & paste

NotificationApi

System alerts

StorageApi

Local storage

FullscreenApi

Fullscreen mode

ScreenApi

Screen info

WindowApi

Window control

NavigationApi

Page navigation

NetworkApi

Online status

MediaDevicesApi

Camera & mic

PermissionsApi

Permission checks

ShareApi

Native sharing

SpeechApi

Voice input

SelectionApi

Text selection

TimerApi

Delayed execution

VibrationApi

Haptic feedback

VisibilityApi

Tab visibility

WakeLockApi

Prevent sleep

Geolocation Example

Get the user's current location with a simple Java API. The framework handles all JavaScript communication and delivers the result to your event handler.

java
@Page("/location-demo")
public class LocationPage extends HtmlPage implements GeolocationListener
{
    private P statusLabel;
    private P coordinatesLabel;

    @Override
    protected void createBody(Body body)
    {
        Div container = new Div();
        container.setPadding("40px");

        statusLabel = new P();
        statusLabel.setText("Click the button to get your location.");
        container.addElement(statusLabel);

        coordinatesLabel = new P();
        coordinatesLabel.setFontFamily("monospace");
        container.addElement(coordinatesLabel);

        Button locationBtn = new Button("Get My Location");
        locationBtn.registerListener(this, MouseClickedEvent.class);
        container.addElement(locationBtn);

        body.addElement(container);
    }

    @Override
    public void onEvent(MouseClickedEvent event)
    {
        statusLabel.setText("Requesting location...");

        // Request location - result delivered to onGeolocation()
        GeolocationApi.getCurrentPosition(this);
    }

    @Override
    public void onGeolocation(GeolocationEvent event)
    {
        if (event.isSuccess())
        {
            GeolocationPosition pos = event.getPosition();
            statusLabel.setText("Location received!");
            coordinatesLabel.setText(String.format(
                "Latitude: %.6f, Longitude: %.6f (accuracy: %.0fm)",
                pos.getLatitude(),
                pos.getLongitude(),
                pos.getAccuracy()
            ));
        }
        else
        {
            statusLabel.setText("Error: " + event.getErrorMessage());
        }
    }
}

How It Works

  1. Your Java code calls GeolocationApi.getCurrentPosition()
  2. Oorian sends a command to the browser to invoke navigator.geolocation
  3. The browser prompts the user for permission and retrieves location
  4. The result is sent back to the server and delivered to your listener

Object-Oriented Components

Use inheritance and polymorphism to build reusable, maintainable UI components.

java
// Base card component
public class Card extends Div
{
    protected Div header;
    protected Div body;

    public Card()
    {
        setBackgroundColor("#ffffff");
        setBorderRadius("12px");
        setBorder("1px solid #e5e7eb");
        addStyleAttribute("box-shadow", "0 2px 4px rgba(0,0,0,0.05)");

        header = new Div();
        header.setPadding("16px 20px");
        header.setBorderBottom("1px solid #e5e7eb");
        addElement(header);

        body = new Div();
        body.setPadding("20px");
        addElement(body);
    }

    public Card setTitle(String title)
    {
        H3 h3 = new H3();
        h3.setText(title);
        h3.setMargin("0");
        header.addElement(h3);
        return this;
    }

    public Card addContent(Element content)
    {
        body.addElement(content);
        return this;
    }
}

// Specialized alert card
public class AlertCard extends Card
{
    public AlertCard(String message, AlertType type)
    {
        super();
        setBackgroundColor(type.getBackgroundColor());
        setBorder("1px solid " + type.getBorderColor());

        FaIcon icon = new FaIcon(FaIcon.SOLID, type.getIcon());
        icon.setColor(type.getIconColor());
        header.addElement(icon);

        P text = new P();
        text.setText(message);
        body.addElement(text);
    }
}

// Usage
Card userCard = new Card()
    .setTitle("User Profile")
    .addContent(new P("John Doe"))
    .addContent(new P("john@example.com"));

AlertCard success = new AlertCard("Changes saved!", AlertType.SUCCESS);

Type Safety Benefits

Catch errors at compile time, not runtime. Your IDE knows everything about your UI.

With Templates

  • Typos in attribute names go unnoticed
  • Wrong property types fail at runtime
  • No autocomplete for element properties
  • Refactoring breaks string references

With Oorian

  • Misspelled methods won't compile
  • Type mismatches caught by compiler
  • Full autocomplete in every IDE
  • Refactoring updates all references

Developer Benefits

No Context Switching

Stay in Java for everything. No jumping between Java, HTML templates, CSS files, and JavaScript.

Leverage Existing Skills

If you know Java, you can build Oorian applications. No new templating syntax or framework conventions to learn.

Full IDE Power

Autocomplete, go-to-definition, find usages, refactoring—everything works because it's all Java.

Compile-Time Safety

Catch UI errors before deployment. No runtime surprises from typos in template expressions.

Easy Testing

Unit test your UI components with standard Java testing tools. Mock dependencies, verify behavior.