4

I use XMonad+gnome as window Manager. I have the problem that, when I run a Java Web Start applicacion, It olways show an empty window, like the screen:

screen

Is there something I can do to fix it?

UPDATE:

I tried simple programs from JWS Examples and it works, right. So it should be a problem of the application.

The failed aaplication is Blast2Go.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Zhen
  • 4,171
  • 5
  • 38
  • 57
  • All JWS applications or just one? – trashgod Jan 23 '13 at 18:11
  • @trashgod, I tested another long time ago, and also have the problem. This appplication with Ubuntu+Unity works right. – Zhen Jan 24 '13 at 08:04
  • 1
    It may be a problem with [tag:xmonad]. Find a short, publicly available, JWS [example](http://docs.oracle.com/javase/tutorial/uiswing/index.html) that fails with xmonad and works with other window managers. Update your question to cite the example. – trashgod Jan 24 '13 at 10:03
  • 1
    @trashgod Good idea. ..Do you have problems with any of [these demos](http://pscode.org/jws/api.html)? They are all small & from my site. One of them requires trust, ignore it and try the others which are sand-boxed. – Andrew Thompson Jan 25 '13 at 08:49
  • @AndrewThompson, no I haven't problems with your demos. – Zhen Jan 25 '13 at 11:26
  • OK. Thanks for that info. Try some of the ones in the Java tutorial. I suspect this is a problem with the app. itself. Most likely (of a vast range of possibilities) would be adding everything to the content pane, calling set size, but forgetting to invoke `pack()` at any point. I think @trashgod also has some JWS based apps., but if mine worked for you, I'd bet those will as well. – Andrew Thompson Jan 25 '13 at 11:46
  • 1
    As @AndrewThompson suggests, I often cite this [example](https://sites.google.com/site/drjohnbmatthews/subway); see also this [answer](http://stackoverflow.com/a/12552541/230513) about calling `setVisible()` _last_. – trashgod Jan 25 '13 at 11:51

2 Answers2

5

Change the name of the window manager to a known one like LG3D:

startupHook = setWMName "LG3D"
puckipedia
  • 811
  • 6
  • 12
  • I used this method. But it is also possible to downgrade to Java 1.6. For Fedora you can use these instructions http://superuser.com/questions/441757/how-install-older-openjdk-1-6-in-fedora-17. – erik Sep 18 '13 at 06:04
1

I had the exact same problem with my own Java code and using the other suggested solutions (setWMName, MToolkit, etc.) did not solve the problem with Xmonad. I must note that in other window managers (e.g. fluxbox), the app works as expected. In my case, however, I figured out the problem. If you have access to the source of the Java app, I suggest you consider the following:

If you have any JFrame or JPanel or other containers, you should explicitly define their layouts. If you set the layout to null, then the dimensions of the container must be set explicitly. Otherwise, the container won't be rendered at all. For instance, I have a JPanel that contains all my widgets. I'd rather have full control over the layout, so I set the layout to null, and then explicitly set the dimensions for the JPanel:

jContentPane.setLayout(null);
jContentPane.setPreferredSize(new Dimension(appletWidth,appletHeight+100)); 

Hope this helps.

navidoo
  • 309
  • 2
  • 11