
Javaru
Kotlin Coroutine Confidence: Placeholder message does not appear (pg 41)
Pg 41 states “Run the code, and you’ll see the placeholder message in a small window, just like last time.” for the code astronomy/v4/src/main/kotlin/com/example/astronomy/AstronomyApplication.kt
. However when I run this, I get the a blank JFrame
. The “Loading your image…” JLabel
does not show.
This is in the B3 version of the book with the example code downloaded on 2025-04-19 at 14:42 EDT.
Marked As Solved

sam-cooper
You’re absolutely right, the message is missing here for me too. It must have been working when I originally wrote and tested the code, so I’ll have to go back and see where the problem crept in.
To fix this one, we can add a call to window.revalidate()
after adding the JLabel
:
class ImageViewer : WindowAdapter() {
override fun windowOpened(e: WindowEvent) {
val window = e.window as JFrame
window.add(JLabel("Loading your image…", JLabel.CENTER))
window.revalidate()
// TODO: download and display an image
}
}
Let me know if this fixes the code for you. I’ll do a little more digging to make sure I understand how I missed the problem. Thank you so much for spotting the issue and letting me know about it!
Popular Pragmatic Bookshelf topics










Modern Front-End Development for Rails - application does not start after run bin/setup (page xviii)
Other popular topics










Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /textmate
- /react-native
- /sublime-text
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /spring
- /django
- /manjaro
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /neovim