Tuesday, 3 March 2009

Java™ How to Program, Sixth Edition - Part22

Few weeks back i started reading Java™ How to Program, Sixth Edition By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc.

Nice book written By H. M. Deitel - Deitel & Associates, Inc., P. J. Deitel - Deitel & Associates, Inc.

I wanted to share few quotations found the book from the 22nd chapter.

1) JSliders enable the user to select from a range of integer values. JSliders can display major tick marks, minor tick marks and labels for the tick marks. They also support snap-to ticks, where positioning the thumb between two tick marks causes the thumb to snap to the closest tick mark.

2) If a JSlider has the focus, the left and right arrow keys cause the thumb of the JSlider to decrease or increase by 1. The down and up arrow keys also cause the thumb of the JSlider to decrease or increase by 1, respectively. The PgDn (page down) key and PgUp (page up) key cause the thumb of the JSlider to decrease or increase by block increments of one-tenth of the range of values, respectively. The Home key moves the thumb to the minimum value of the JSlider, and the End key moves it to the maximum value.

3) JSliders have either horizontal or vertical orientation. For a horizontal JSlider, the minimum value is at the extreme left and the maximum value is at the extreme right. For a vertical JSlider, the minimum value is at the extreme bottom and the maximum value is at the extreme top. The position of the thumb indicates the current value of the JSlider. Method getValue of class JSlider returns the current thumb position.

4) Method setMajorTickSpacing of class JSlider sets the spacing for tick marks on a JSlider. Method setPaintTicks with a TRue argument indicates that the tick marks should be displayed.

5) JSliders generate ChangeEvents when the user interacts with a JSlider. A ChangeListener declares method stateChanged that can respond to ChangeEvents.

6) Every window generates window events when the user manipulates it. Interface WindowListener provides seven window-event-handling methodswindowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified and windowOpened.

7) Menus are an integral part of GUIs. Menus allow the user to perform actions without unnecessarily cluttering a graphical user interface with extra GUI components. In Swing GUIs, menus can be attached only to objects of classes with method setJMenuBar (e.g., JFrame and JApplet).

8) The classes used to declare menus are JMenuBar, JMenuItem, JMenu, JCheckBoxMenuItem and JRadioButtonMenuItem.

9) A JMenuBar is a container for menus. A JMenuItem is a GUI component inside a menu that, when selected, causes an action to be performed. A JMenu contains menu items and can be added to a JMenuBar or to other JMenus as submenus.

10) When a menu is clicked, it expands to show its list of menu items. JMenu method addSeparator adds a separator line to a menu.

11) When a JCheckBoxMenuItem is selected, a check appears to the left of the menu item. When the JCheckBoxMenuItem is selected again, the check is removed.

12) When multiple JRadioButtonMenuItems are maintained as part of a ButtonGroup, only one item in the group can be selected at a given time. When an item is selected, a filled circle appears to its left. When another JRadioButtonMenuItem is selected, the filled circle to the left of the previously selected item is removed.

13) AbstractButton method setMnemonic specifies the mnemonic for an AbstractButton. Mnemonic characters are normally displayed with an underline.

14) A modal dialog box does not allow access to any other window in the application until the dialog is dismissed. The dialogs displayed with class JOptionPane are modal dialogs. Class JDialog can be used to create your own modal or nonmodal dialogs.

15) Context-sensitive pop-up menus are created with class JPopupMenu. On most systems, the popup trigger event occurs when the user presses and releases the right mouse button. MouseEvent method isPopupTrigger returns TRue if the pop-up trigger event occurred.

16) JPopupMenu method show displays a JPopupMenu. The first argument specifies the origin component, which helps determine where the JPopupMenu will appear. The last two arguments are the coordinates from the origin component's upper-left corner, at which the JPopupMenu appears.

17) Class UIManager contains nested class LookAndFeelInfo that maintains information about a look-and-feel.

18) UIManager static method getInstalledLookAndFeels gets an array of UIManager.LookAndFeelInfo objects that describe the available look-and-feels.

19) UIManager static method setLookAndFeel changes the look-and-feel. SwingUtilities static method updateComponentTreeUI changes the look-and-feel of every component attached to its Component argument to the new look-and-feel.

20) Many of today's applications use a multiple-document interface (MDI) to manage several open documents that are being processed in parallel. Swing's JDesktopPane and JInternalFrame classes provide support for creating multiple-document interfaces.

21) A JTabbedPane arranges GUI components into layers in which only one layer is visible at a time. Users access each layer via a tab similar to those on folders in a file cabinet. When the user clicks a tab, the appropriate layer is displayed.

22) BoxLayout is a layout manager that allows GUI components to be arranged left-to-right or top-to-bottom in a container.

23) Class Box declares a container with BoxLayout as its default layout manager and provides static methods to create a Box with a horizontal or vertical BoxLayout.

24) GridBagLayout is a layout manager similar to GridLayout. It differs in that each component size can vary, and components can be added in any order.

25) A GridBagConstraints object specifies how a component is placed in a GridBagLayout. Method setConstraints of class GridBagLayout takes a Component argument and a GridBagConstraints argument and sets the constraints of the Component.

About the Authors

Dr. Harvey M. Deitel, Chairman and Chief Strategy Officer of Deitel & Associates, Inc., has 43 years experience in the computing field, including extensive industry and academic experience. Dr. Deitel earned B.S. and M.S. degrees from the Massachusetts Institute of Technology and a Ph.D. from Boston University. He worked on the pioneering virtual-memory operating-systems projects at IBM and MIT that developed techniques now widely implemented in systems such as UNIX, Linux and Windows XP. He has 20 years of college teaching experience, including earning tenure and serving as the Chairman of the Computer Science Department at Boston College before founding Deitel & Associates, Inc., with his son, Paul J. Deitel. He and Paul are the co-authors of several dozen books and multimedia packages and they are writing many more. With translations published in Japanese, German, Russian, Spanish, Traditional Chinese, Simplified Chinese, Korean, French, Polish, Italian, Portuguese, Greek, Urdu and Turkish, the Deitels' texts have earned international recognition. Dr. Deitel has delivered hundreds of professional seminars to major corporations, academic institutions, government organizations and the military.

Paul J. Deitel, CEO and Chief Technical Officer of Deitel & Associates, Inc., is a graduate of the MIT's Sloan School of Management, where he studied Information Technology. Through Deitel & Associates, Inc., he has delivered Java, C, C++, Internet and World Wide Web courses to industry clients, including IBM, Sun Microsystems, Dell, Lucent Technologies, Fidelity, NASA at the Kennedy Space Center, the National Severe Storm Laboratory, Compaq, White Sands Missile Range, Rogue Wave Software, Boeing, Stratus, Cambridge Technology Partners, Open Environment Corporation, One Wave, Hyperion Software, Adra Systems, Entergy, CableData Systems and many other organizations. Paul is one of the most experienced Java corporate trainers having taught about 100 professional Java training courses. He has also lectured on C++ and Java for the Boston Chapter of the Association for Computing Machinery. He and his father, Dr. Harvey M. Deitel, are the world's best-selling Computer Science textbook authors.

No comments: