This guide demonstrates how to display a button, embedded within the window frame container. Resizing the window frame also resizes the button proportionately; clicking the button logs the event to the console.
<!DOCTYPE html> <!-- Copyright (c) 2026 by Javaika Technologies -->
<html lang = "en-AU"> <!-- Set the primary language to en-AU -->
<head>
<title>Button</title> <!-- Set the page title -->
<meta name = "robots" content = "noindex, follow">
</head>
<body>
<!-- Include the framework script tag -->
<script type = "module" src = "https://www.javaika.com/frame/web-interface@main/api.js"></script>
<!-- Run the demo as an ES Module -->
<script type = "module">
// Initialize a shorter prefix for referencing.
const jwi = window.javaika.webInterface;
let buttonControl; // Declare button control.
// Initialize the developer token endpoint.
jwi.init({
tokenEndpoint: "https://www.javaika.com/pscript/jwt-access.php"
});
// Authenticate before using the framework.
jwi.requestToken({
framework: "web_interface" // Specify the framework for token issuance.
});
// Authenticate callback handler.
function onAuthenticate(event)
{
jwi.refreshToken(); // Refresh the authentication token.
console.log('[Web Interface] Authentication received callback:', event);
}
// Window frame resized callback handler.
function onWindowFrameResized(event)
{
jwi.scaleInterfaceControls(event.detail.scaleFactor);
}
// Button initialized callback handler.
function onButtonInitialized(event)
{
buttonControl.setEvent('click', onClick); // Bind click event.
console.log('[Web Interface] Button initialized callback:', event);
}
// Click callback handler.
function onClick(event)
{
console.log('[Web Interface] Click callback:', event);
}
// Initialized callback handler.
function onInitialized(event)
{
// Define the controls for the interface.
let windowFrame = new jwi.WindowFrame();
buttonControl = new jwi.Button("Click Me");
// Add initial styles for the button.
buttonControl.addStyle('font-size', '25px');
buttonControl.addStyle('height', '50px');
buttonControl.addStyle('width', '200px');
buttonControl.addStyle('left', '32%');
buttonControl.addStyle('top', '42%');
// Add button component to the window frame.
windowFrame.addButtonElement(buttonControl);
// Enable manual resizing of the container window.
jwi.setContainerManuallyResizable(true);
jwi.setMaintainAspectRatio(true);
// Set handle offsets from the container window.
jwi.setContainerOffsetHeight(50);
jwi.setContainerOffsetWidth(50);
// Render interface to the browser window.
jwi.renderInterface(windowFrame);
console.log('[Web Interface] Framework initialized callback:', event);
}
// Callback event after authenticate.
document.addEventListener
(
'javaika.webInterface.authenticate', onAuthenticate
);
// Callback event after initialized.
document.addEventListener
(
'javaika.webInterface.initialized', onInitialized
);
// Callback event after button initialized.
document.addEventListener
(
'javaika.webInterface.buttonInitialized', onButtonInitialized
);
// Callback event after window frame resize.
document.addEventListener
(
'javaika.webInterface.windowFrameResized', onWindowFrameResized
);
</script>
</body>
</html>
/* Standard class styles */
.javaika-button
{
background: linear-gradient(to bottom, #F0F0F0, #D0D0D0);
box-sizing: border-box;
border: 1px solid;
border-color: #AAA;
justify-content: center;
align-items: center;
text-align: center;
position: absolute;
user-select: none;
cursor: pointer;
font-size: 14px;
padding: 8px;
height: 30px;
width: 160px;
display: none;
}
/* Adjoined class styles */
.javaika-button.disabled
{
pointer-events: none;
cursor: not-allowed;
opacity: 0.5;
}
/* Pseudo class styles */
.javaika-button:focus
{
outline: none;
}
.javaika-button:focus-visible
{
outline: 2px solid #809DFF;
outline-offset: 3px;
}
.javaika-button:hover
{
background: linear-gradient(to bottom, #FAFAFA, #E0E0E0);
}
.javaika-button:active
{
background: linear-gradient(to bottom, #D0D0D0, #F0F0F0);
}
Next capability: Demonstrate how to incorporate a Radio Button.