Java Reference
In-Depth Information
Listing11-10 islargelyconcernedwithcreating SkyView 'suserinterface.( Chapter
7 explains theclasses andmethods that areusedinitsconstruction.) Expressions such
as new JPanel () {{ add (lblImage); }} areaconvenientshorthandfor
subclassing javax.swing.JPanel via an anonymous class (see Chapter 3 ) , creat-
inganinstanceofthesubclasspanel,(forthisexample)addingthespecifiedcomponent
to the panel via its object initializer, and returning the panel instance.
Assumingthatthecurrentdirectory contains SkyView.java andthe org subdir-
ectory,invoke javac SkyView.java tocompilethisapplication'ssourcecode.Fol-
lowingcompilation,invoke java SkyView toruntheapplication. Figure11-7 shows
what you will see when you specify the values that are shown in the figure's text fields.
Search WWH ::




Custom Search