您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Extend Index

Extend Page # 12

Additional Exercises

Exercise 4 - Creating a complex menu

Menus usually contain text, but it is also common to use a 'separator' (a horizontal line) to divide groups of menu items to make them easier to read. In Java, we define a separator by creating a new MenuItem object whose text is '-' (a single dash). Java recognises the dash and turns it into a separator.

With this in mind, write the Java statements that create a menu with the following structure.

File

        New

        ------

        Open

        Save

        Save as?/p>

        -----

        Exit

Edit

        Cut

        Copy

        Paste

Help

        Contents

        Search?/p>

        -----

        About?/p>

Discussion/Solution to Exercise 4

Back to top

basicline.gif (170 bytes)