This guide demonstrates how to display a titled border, embedded within the window frame container. Resizing the window frame also resizes the titled border proportionately; clicking the titled border 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>Titled Border</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 titledBorderControl; // Declare titled border control.
let textLabelControl; // Declare text label 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);
}
// Titled border initialized callback handler.
function onTitledBorderInitialized(event)
{
titledBorderControl.setElementStyle
(
'height', '170px', ['javaika-titled-border-content']
);
titledBorderControl.setSizeFactor(1.5); // Increase initial size.
titledBorderControl.setEvent('click', onClick); // Bind click event.
console.log('[Web Interface] Titled border initialized callback:', event);
}
// Text label initialized callback handler.
function onTextLabelInitialized(event)
{
textLabelControl.setSizeFactor(1.5); // Increase initial size.
}
// Click callback handler.
function onClick(event)
{
// Change the text of the titled border.
titledBorderControl.setText("Clicked Border Text");
const text = titledBorderControl.getText();
console.log('[Web Interface] Click callback:', event);
console.log('[Web Interface] The text is:', text);
}
// Initialized callback handler.
function onInitialized(event)
{
// Define the controls for the interface.
let windowFrame = new jwi.WindowFrame();
titledBorderControl = new jwi.TitledBorder();
textLabelControl = new jwi.TextLabel
(
"Text label inside titled border container"
);
// Set titled border text via a function call.
titledBorderControl.setValue("Initial Border Text");
// Add initial styles for the titled border.
titledBorderControl.addStyle('width', '300px');
titledBorderControl.addStyle('left', '12%');
titledBorderControl.addStyle('top', '22%');
// Add initial styles for the text label.
textLabelControl.addStyle('left', '12%');
textLabelControl.addStyle('top', '50%');
// Add text label component to the titled border.
titledBorderControl.addTextLabelElement(textLabelControl);
// Add titled border component to the window frame.
windowFrame.addTitledBorderElement(titledBorderControl);
// 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 titled border initialized.
document.addEventListener
(
'javaika.webInterface.titledBorderInitialized', onTitledBorderInitialized
);
// Callback event after text label initialized.
document.addEventListener
(
'javaika.webInterface.textLabelInitialized', onTextLabelInitialized
);
// Callback event after window frame resize.
document.addEventListener
(
'javaika.webInterface.windowFrameResized', onWindowFrameResized
);
</script>
</body>
</html>
/* Standard class styles */
.javaika-titled-border
{
position: absolute;
user-select: none;
padding-top: 1px;
width: 200px;
display: none;
}
.javaika-titled-border-title
{
background-color: #FAFAFA;
position: absolute;
font-weight: bold;
padding-right: 5px;
padding-left: 5px;
margin-left: 10px;
font-size: 20px;
}
.javaika-titled-border-content
{
background-color: #FAFAFA;
box-sizing: border-box;
border: 1px solid;
border-color: #AAA;
margin-top: 12px;
display: flex;
height: 100px;
}
/* Adjoined class styles */
.javaika-titled-border.disabled
{
pointer-events: none;
cursor: not-allowed;
opacity: 0.5;
}
/* Pseudo class styles */
.javaika-titled-border:focus
{
outline: none;
}
.javaika-titled-border:focus-visible
{
outline: 2px solid #809DFF;
outline-offset: 3px;
}
Next capability: Demonstrate how to incorporate a Scroll Box.