The following picture shows the above GUI under the MotifLookAndFeelof the JFC Project Swing technology without using a layout manager: Unfortunately, the programmer who wrote this application used absolute positioning and sizing, so the components in the dialog do not expand:Īfter reporting this behavior, the developer realizes the error that has been committed and changes the GUI to resize properly:Ĭomponents Designed for a Specific Look-And-Feel or Font SizeĪnother common problem is expecting all platforms or LookAndFeel libraries (when using Java Foundation Classes (JFC) Project Swing technology) to have the same sizing characteristics. In the hopes of seeing the entire name at once, you could expand the dialog horizontally. For example, in the initial display of a screen, the name entered is rather long, so it doesn’t quite fit in the text field such that all is visible at once: Non-resizable GUIs can be extremely frustrating. However, some users have much more screen real estate and want to take advantage of it. The most common display size is probably still 640x480, so it’s a good idea to make sure your application fits on that size screen. The first layout sin is to ignore a user-resize. These describe several_GUI sins_that are all too common: To describe why layout managers are necessary, all you need to do is examine a few of the problems they solve. This module will explore in great detail how the standard Abstract Window Toolkit (AWT) layout managers perform their jobs and how they can be effectively nested to create useful graphical user interfaces (GUIs). I used the Wayback Machine to retrieve it and post it here) (I wrote this article for the Sun Java Developer Connection website around 1998 and is no longer available. Let’s get familiar with Java Layout Managers!
0 Comments
Leave a Reply. |