This guide demonstrates how to display a text field, embedded within the window frame container. Resizing the window frame also resizes the slider proportionately; hovering the mouse over the text field 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>Text Field</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 textFieldControl; // Declare text field 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);
}
// Text field initialized callback handler.
function onTextFieldInitialized(event)
{
textFieldControl.setSizeFactor(1.5); // Increase initial size.
textFieldControl.setText("Sample Text"); // Set initial text.
textFieldControl.setPlaceholder("Enter Text"); // Set placeholder.
textFieldControl.setEvent('mouseover', onMouseOver); // Bind mouseover event.
console.log('[Web Interface] Text field initialized callback:', event);
}
// Mouse over callback handler.
function onMouseOver(event)
{
const text = textFieldControl.getText();
const placeholder = textFieldControl.getPlaceholder();
console.log('[Web Interface] Mouse over callback:', event);
console.log('[Web Interface] The text is:', text);
console.log('[Web Interface] The placeholder is:', placeholder);
}
// Initialized callback handler.
function onInitialized(event)
{
// Define the controls for the interface.
let windowFrame = new jwi.WindowFrame();
textFieldControl = new jwi.TextField();
// Add initial styles for the text field.
textFieldControl.addStyle('left', '25%');
textFieldControl.addStyle('top', '45%');
// Add text field component to the window frame.
windowFrame.addTextFieldElement(textFieldControl);
// 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 text field initialized.
document.addEventListener
(
'javaika.webInterface.textFieldInitialized', onTextFieldInitialized
);
// Callback event after window frame resize.
document.addEventListener
(
'javaika.webInterface.windowFrameResized', onWindowFrameResized
);
</script>
</body>
</html>
/* Standard class styles */
.javaika-text-field
{
background-color: #FFF;
box-sizing: border-box;
border: 1px solid;
border-color: #AAA;
position: absolute;
overflow: hidden;
height: 30px;
width: 200px;
display: none;
}
.javaika-text-field-content
{
box-sizing: border-box;
align-items: center;
white-space: nowrap;
font-size: 16px;
padding: 5px;
height: 100%;
width: 100%;
}
/* Adjoined class styles */
.javaika-text-field.disabled
{
pointer-events: none;
cursor: not-allowed;
opacity: 0.5;
}
/* Pseudo class styles */
.javaika-text-field:focus
{
outline: none;
}
.javaika-text-field:focus-visible
{
outline: 2px solid #809DFF;
outline-offset: 3px;
}
.javaika-text-field-content:focus
{
outline: none;
}
Next capability: Demonstrate how to incorporate a Dropdown Box.