Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ClassCastException on JOptionPaneFixture.title()

Open
#220 1 comment 0 reactions 1 assignee View on GitHub

@croesch is already working on this.

Since Oct 1, 2018.

Assessment

This issue has not been assessed yet.

Description

bug invalid

Hi!
I get ClassCastException when calling JOptionPaneFixture.title().

My code:
final JOptionPaneFixture optionPane = JOptionPaneFinder.findOptionPane().withTimeout(3000).using(robot);
final String title = optionPane.title();

Error i get:
java.lang.ClassCastException: javax.swing.JInternalFrame cannot be cast to java.awt.Dialog

Im using java 8 javax.swing.JOptionPane in my gui.
Ofc it works if i cast it to JInternalFrame.
final String title = ((JInternalFrame) optionPane.target().getRootPane().getParent()).getTitle();

Dominant language
Java
Stars
121
Forks
52
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from assertj/assertj-swing

All issues in assertj/assertj-swing

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.