Java AWT/SWT/Swing: How to plan a GUI?

前端 未结 10 2179
广开言路
广开言路 2020-12-02 04:46

I\'ve already realized some applications with a small graphical user interface. Nothing complex, but I\'ve encountered several problems that components aren\'t displayed or

10条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 05:41

    There has been a temporarily-dead (but now apparently at least half-alive) plugin for Eclipse for visual GUI design and Netbeans still has support for it. The resulting code was less than stellar, though. At least for people having to work with that codebase afterwards it's quite a pain.

    As for me I tend to plan on paper beforehand and try to get all nestings of panels with their layouts right on the first try. Java GUI code is inherently write-only in my experience.

    Last time I did such a thing I first created every control I needed and then pieced it together in multiple panels and layouts, etc. That way was at least manageable and worked without too much pain when changes had to be made.

    I tend not to think too much about the particular layout in Winforms and WPF due to the, as you noted also, strong designer support. Also WPF is very easy to handle even in XAML. Ans partial classes make working with partly designer-generated and partly handwritten code very pleasant. Alas, no such thing in the Java world.

提交回复
热议问题