The short answer is: you cannot do that with JavaParser alone but you can very easily do that by using JavaSymbolSolver, which is a library built to complement JavaParser and mantained by the same team who mantains JavaParser.
In practice JavaParser gives you just an AST. In the AST the superclass of a class is just a name. JavaSymbolSolver finds for you the type declaration attached to that name. That declaration has all the information you need to find all the ancestors and answer this question and many more (like, what interfaces are implemented, directly and indirectly, which fields the class has inherited, which methods, etc.)
Disclaimer: I am the original author of JavaSymbolSolver