text content starts to the left of the (Web hosting script)

text content starts to the left of the component. To fix this, select the component jLabel in the Java Beans View. (You may want to rename this component using the context function Rename Field.) In the Properties View, find the property named horizontalAlignment. This property currently has the value LEADING. Select this entry with the mouse. An arrow button appears beside LEADING. Now click this button and select CENTER, and the text is centered. VE supports almost any of the properties of the Swing components with a few exceptions. For example, you cannot specify client properties (putClientProperty()) in the Properties view, and for JLabel components you cannot specify target components for mnemonic codes (setLabelFor()). Such properties must be set manually in the source code. Layouts Now select the component jContentPane in the Java Beans View. Like all Swing containers, this container, too, has a layout. You will find the property layout in the Properties View. As you can see, this container is already equipped with a BorderLayout. Clicking the arrow button gives you a list of the available layout options. At the left of the layout entry is a plus sign. Clicking this sign expands the entry and allows you to make further specifications for this layout manager, such as horizontal gap and vertical gap. Finally, there is an option to work without a layout manager. To do so, select the null option in the list of layout managers. Then you can position the JLabel component freely within the content pane. Normally, you should change layout settings only after you have filled a container with components. This is because with some layouts, empty containers have a size of zero, and it can become quite tricky to place a component into a container of zero size. However, if something like this should happen, there is always a way out: instead of placing a component into a container within the design area, apply the same operation to the Java Beans View. If you later want to move components to a different position or even to a different container, this is easy: both the design area and the Java Beans View support moving components by drag and drop. However, the VE does not support cut-and-paste operations for components. If you need detailed information about Swing and Swing layout managers, please refer to the resources listed in Appendix D, for example to the book Swing by Robinson and Vorobiev. Event Processing Finally, let s see how event processing can be programmed with the help of the VE. Let s first create one more component, a JButton, in the content pane of the JFrame container. You can select the position freely, for example, the South area (if you are still using the BorderLayout manager). If you are working without a layout manager, reduce the size of the JLabel component somewhat to make room for the new JButton component. Then, find the entry text in the Properties View and enter OK as the button text. Alternatively, you can just click the button in the design area and enter OK in the text input area. 49 The Art of (Visual) Composition
Are you a Mac user in a search of Mac web hosting provider? We are. once upon a time, we were just like you, trying to find somebody who knows. Unfortunately, we had no luck, so we decided to help many others like you, and us. our team developed Mac friendly web hosting plans, feature packed, constantly monitored, and more than affordable. With us, you are home. Sign up.

Leave a Reply