java 状态栏_World Wind Java开发之三 显示状态栏信息(转)

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; // 主窗体

private WorldWindowGLCanvas worldWindowGLCanvas; // 声明WWJ画布

private JPanel WorldWindPanel;  //三维视图面板

private JPanel Layerpanel;      //图层管理面板

private JPanel StatusBarpanel;  //状态栏面板

private StatusBar statusBar;    //状态栏

//  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子系统");

WorldWind.setOfflineMode(true); // 设置离线运行模式

}

catch (Exception e)

{

e.printStackTrace();

}

}

});

}

/**

* Create the application.

*/

public GFScope()

{

initialize();

InitializeEarth(WorldWindPanel,StatusBarpanel);

}

/**

* Initialize the contents of the frame.

*/

/**

*

*/

private void initialize()

{

// 主窗体

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);

/**

* 菜单项

*/

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);

/**

* 工具条

*/

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);

/**

* 面板(图层面板、三维视图面板)

*

* @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)

{

// 按指定尺寸创建画布

Dimension canvasSize = new Dimension(790, 688);

this.worldWindowGLCanvas = new WorldWindowGLCanvas();

this.worldWindowGLCanvas.setPreferredSize(canvasSize);

// 创建Earth模型,并与画布绑定

Model model = (Model) WorldWind

.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);

this.worldWindowGLCanvas.setModel(model);

panel1.add(worldWindowGLCanvas);

/**

*初始化状态栏信息

* */

this.statusBar=new StatusBar();

this.statusBar.setEventSource(worldWindowGLCanvas);

panel2.add(statusBar);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值