First look at the results of this blog to achieve:
Find the Gov.nasa.worldwind.util under the source code under the Statusbar.java file, you can see the status bar display information mainly includes the height of the viewpoint and the corresponding spatial point three-dimensional coordinates and whether to use the network and other information. Offline mode is used in subsequent development, so there is no need for networking or displaying network status information. The code is shown in the following image:
After modifying the source code, export the source code file as a jar package, which can be referenced under our project. If you need to modify the source code in the following way, the operation is as follows:
It is necessary to note that the export can be checked only the SRC folder can also be the default. After exporting, copy the Worldwind2.0.jar file to our project directory and add the app. Here are all the source code:
Package Cn.whu.vge;import Gov.nasa.worldwind.model;import Gov.nasa.worldwind.worldwind;import Gov.nasa.worldwind.worldwindow;import Gov.nasa.worldwind.avlist.avkey;import Gov.nasa.worldwind.awt.worldwindowglcanvas;import Gov.nasa.worldwind.util.statusbar;import java.awt.Dimension; Import Java.awt.eventqueue;import java.awt.toolkit;import Javax.swing.imageicon;import Javax.swing.JButton;import Javax.swing.jframe;import Javax.swing.jmenu;import Javax.swing.jmenubar;import Javax.swing.JPanel;import javax.swing.jtoolbar;/** * @author Administrator * */public class gfscope{private JFrame gfscopemainframe;//main form private W Orldwindowglcanvas Worldwindowglcanvas; Declaration WWJ Canvas Private JPanel worldwindpanel; Three-dimensional view panel private JPanel Layerpanel; Layer Management panel private JPanel StatusBarPanel; Status bar panel private StatusBar StatusBar; Status bar//private Worldwindow wwd;/** * Launch the application. */public static void Main (string[] args) {Eventqueue.invokelater (new Runnable () {public void run () {try{gfscope window= new Gfscope (); window. Gfscopemainframe.setvisible (True); window. Gfscopemainframe.settitle ("xxxxx subsystem"); Worldwind.setofflinemode (TRUE); Set the offline run mode}catch (Exception e) {e.printstacktrace ();}});} /** * Create the application. */public Gfscope () {initialize (); Initializeearth (Worldwindpanel,statusbarpanel);} /** * Initialize The contents of the frame. *//** * */private void Initialize () {//main form gfscopemainframe = new JFrame (); Gfscopemainframe.seticonimage (Toolkit.getdefaulttoolkit (). GetImage (GFScope.class.getResource ("/images/ 32x32-icon-earth.png "))); Gfscopemainframe.setbounds (100, 100, 1000, 800); Gfscopemainframe.setdefaultcloseoperation (Jframe.exit_on_close); Gfscopemainframe.getcontentpane (). setlayout (null);/** * menu item */jmenubar menuBar = new JMenuBar (); menubar.setbounds (0, 0 , 984, 30); Gfscopemainframe.getcontentpane (). Add (MenuBar); JMenu MNF = new JMenu ("\u6587\u4ef6 (F)"); Menubar.add (MNF); JMenu MNV = new JMenu ("\u89c6\u56fe (V)"); Menubar.add (MNV); JMenu mnnewmenu = new JMenu ("\u5de5\u5177 (T)"); mEnubar.add (Mnnewmenu); JMenu mnnewmenu_1 = new JMenu ("\u5206\u6790 (A)"); Menubar.add (mnnewmenu_1); JMenu MNH = new JMenu ("\u5e2e\u52a9 (H)"); Menubar.add (MNH);/** * Toolbar */jtoolbar toolBar = new JToolBar (); toolbar.setbounds (0, 28, 984, 30); Gfscopemainframe.getcontentpane (). Add (ToolBar); JButton Btnnewbutton = new JButton (""); Btnnewbutton.seticon (New ImageIcon (GFScope.class.getResource ("/newt/data/ Cross-grey-alpha-16x16.png ")); Toolbar.add (Btnnewbutton);/** * Panel (layers panel, three-dimensional view panel) * * @author */layerpanel = new JPanel (); Layerpanel.setbounds (0, 60, 194, 702); Gfscopemainframe.getcontentpane (). Add (Layerpanel); Worldwindpanel = new JPanel (); Worldwindpanel.setbounds (194, 60, 790, 673); Gfscopemainframe.getcontentpane (). Add (Worldwindpanel); StatusBarPanel = new JPanel (); Statusbarpanel.setbounds (194, 732, 790, 30); Gfscopemainframe.getcontentpane (). Add (StatusBarPanel);} private void Initializeearth (JPanel panel1,jpanel panel2) {//create canvas by specified size Dimension canvassize = new Dimension (790, 688); This.worldwindowglcanvas = new Worldwindowglcanvas (); this.worldWindowGLCanvas.setPreferredSize (canvassize);//Create Earth model and bind the model to the canvas Model = (model) worldwind.createconfigurationcomponent (avkey.model_class_name); This.worldWindowGLCanvas.setModel ( Model);p Anel1.add (Worldwindowglcanvas);/** * Initialize status bar information * */this.statusbar=new StatusBar (); This.statusBar.setEventSource (Worldwindowglcanvas);p anel2.add (StatusBar);}}
Welcome to Message Exchange!
World Wind Java Development III display status bar information