Skip to content

Commit 3b59fa4

Browse files
authored
Update README.md
1 parent 22cbf29 commit 3b59fa4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,14 @@ Source code for the example is located in /src/main/java/com/openfin/desktop/dem
148148

149149
1. create a canvas and place it where the HTML5 application should be embedded.
150150

151+
```java
151152
embedCanvas = new java.awt.Canvas();
152153
panel.add(embedCanvas, BorderLayout.CENTER);
154+
```
153155

154156
2. listen to the canvas resize event, and resize embedded HTML5 application accordingly.
155157

158+
```java
156159
embedCanvas.addComponentListener(new ComponentAdapter() {
157160
@Override
158161
public void componentResized(ComponentEvent event) {
@@ -167,29 +170,35 @@ Source code for the example is located in /src/main/java/com/openfin/desktop/dem
167170
}
168171
}
169172
});
173+
```
170174

171175
3. launch and connect to OpenFin runtime
172176

177+
```java
173178
this.desktopConnection = new DesktopConnection(appUuid);
174179
DesktopStateListener listener = new DesktopStateListener() {...};
175180
RuntimeConfiguration configuration = new RuntimeConfiguration();
176181
configuration.setRuntimeVersion(desktopVersion);
177182
desktopConnection.connect(configuration, listener, 60);
183+
```
178184

179185
4. create HTML5 application
180186

187+
```java
181188
ApplicationOptions options = new ApplicationOptions(startupUuid, startupUuid, openfin_app_url);
182189
WindowOptions mainWindowOptions = new WindowOptions();
183190
options.setMainWindowOptions(mainWindowOptions);
184191
DemoUtils.runApplication(options, this.desktopConnection, new AckListener() {...});
192+
```
185193

186194
5. embed HTML5 application into the canvas
187195

196+
```java
188197
startupHtml5app = Application.wrap(this.startupUuid, this.desktopConnection);
189198
Window html5Wnd = startupHtml5app.getWindow();
190199
long parentHWndId = Native.getComponentID(this.embedCanvas);
191200
html5Wnd.embedInto(parentHWndId, this.embedCanvas.getWidth(), this.embedCanvas.getHeight(), new AckListener() {...});
192-
201+
```
193202

194203
## More Info
195204

0 commit comments

Comments
 (0)