0

I programmed a game in Java Swing using null layout. Except for a few glitches that I'm working on, it is perfectly functional and looks pretty nice. My plan: fix the few bugs, add a few extra features, then use SwingWeb or AjaxSwing to allow my game to run in a web browser using HTML/CSS/JavaScript. But after talking to some people here, I feel concerned that my game will not be displayed properly since I didn't use a layout manager. Exact placement of components works just perfect for the nature of the game, since I need to have my JLabels moving around constantly, and attempting to this with a layout manager would be very problematic - so I would like to avoid changing from my null layout if I possibly can. So before I make a decision about this, can someone explain to me the problems that I could face regarding the null layout if I proceed with my plan as described above? Note that clearly I do not intend the window of the game to be resizable, as it will be running in a browser.

4

2 回答 2

2

转换为 HTML 的AFAIUnull布局只能生成position:absolute;样式。

这在 HTML 中的效果甚至不如在 Swing 中。HTML 应该是流动的,一旦用户开始增加或减少浏览器中文本的大小,它就会分崩离析。

于 2014-01-19T07:59:29.393 回答
0

当您不调整窗口大小或不使用 changeListeners 时,使用 NULL布局编程是可以接受的,因此请避免使用 null 布局。读这个

于 2014-01-19T08:00:23.950 回答