当前位置: 首页>>代码示例>>Java>>正文


Java JmeCanvasContext.getCanvas方法代码示例

本文整理汇总了Java中com.jme3.system.JmeCanvasContext.getCanvas方法的典型用法代码示例。如果您正苦于以下问题:Java JmeCanvasContext.getCanvas方法的具体用法?Java JmeCanvasContext.getCanvas怎么用?Java JmeCanvasContext.getCanvas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.system.JmeCanvasContext的用法示例。


在下文中一共展示了JmeCanvasContext.getCanvas方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCanvas

import com.jme3.system.JmeCanvasContext; //导入方法依赖的package包/类
public Canvas createCanvas() {
    String appClass = TestEditor.class.getName();
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    settings.setFrameRate(30);

    try {
        Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
        app = clazz.newInstance();
        app.setPauseOnLostFocus(false);
        app.setSettings(settings);
        app.createCanvas();
        app.startCanvas();

        JmeCanvasContext context = (JmeCanvasContext) app.getContext();
        Canvas canvas = context.getCanvas();
        canvas.setSize(settings.getWidth(), settings.getHeight());

        return canvas;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        ex.printStackTrace();
    }
    return null;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:26,代码来源:TestSwing2.java

示例2: createCanvas

import com.jme3.system.JmeCanvasContext; //导入方法依赖的package包/类
public static Canvas createCanvas() {
    String appClass = TestEditor.class.getName();
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    settings.setFrameRate(60);

    try {
        Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
        LegacyApplication app = clazz.newInstance();
        app.setPauseOnLostFocus(false);
        app.setSettings(settings);
        app.createCanvas();
        app.startCanvas();

        JmeCanvasContext context = (JmeCanvasContext) app.getContext();
        Canvas canvas = context.getCanvas();
        canvas.setSize(settings.getWidth(), settings.getHeight());

        return canvas;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        ex.printStackTrace();
    }
    
    return null;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:27,代码来源:SwingUtils.java

示例3: getPanel

import com.jme3.system.JmeCanvasContext; //导入方法依赖的package包/类
private Container getPanel() {
   	Dimension d3Dim = new Dimension (800, 600);
	
	AppSettings settings = new AppSettings(true);
	
	settings.setWidth(d3Dim.width);
	settings.setHeight(d3Dim.height);
	settings.setSamples(4);
	settings.setVSync(true);
	settings.setFrameRate(60);
	
	setSettings(settings);
	createCanvas();
	JmeCanvasContext ctx = (JmeCanvasContext) getContext();
	ctx.setSystemListener(this);
	
	Canvas canvas = ctx.getCanvas();
	canvas.setPreferredSize(d3Dim);
	
	JPanel panel = new JPanel(new BorderLayout());
	panel.add( canvas, BorderLayout.CENTER );
	
	return panel;
}
 
开发者ID:twak,项目名称:siteplan,代码行数:25,代码来源:Preview.java

示例4: createCanvas

import com.jme3.system.JmeCanvasContext; //导入方法依赖的package包/类
private void createCanvas() {
	AppSettings settings = new AppSettings(true);
	settings.setWidth(640);
	settings.setHeight(480);
	settings.setFrameRate(60);

	config = Util.getConfig();

	viewer = new Viewer();
	viewer.setPauseOnLostFocus(false);
	viewer.setSettings(settings);
	viewer.createCanvas();
	viewer.startCanvas();

	context = (JmeCanvasContext) viewer.getContext();
	canvas = context.getCanvas();
	canvas.setSize(settings.getWidth(), settings.getHeight());
}
 
开发者ID:morris,项目名称:vstools-java,代码行数:19,代码来源:GUI.java

示例5: main

import com.jme3.system.JmeCanvasContext; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException{
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);

    final TestSafeCanvas app = new TestSafeCanvas();
    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();
    app.startCanvas(true);

    JmeCanvasContext context = (JmeCanvasContext) app.getContext();
    Canvas canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());

    

    Thread.sleep(3000);

    JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            app.stop();
        }
    });
    frame.getContentPane().add(canvas);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    Thread.sleep(3000);

    frame.getContentPane().remove(canvas);

    Thread.sleep(3000);

    frame.getContentPane().add(canvas);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:41,代码来源:TestSafeCanvas.java

示例6: TweedFrame

import com.jme3.system.JmeCanvasContext; //导入方法依赖的package包/类
public TweedFrame() {

		instance = this;

		frame = new JFrame();

		WindowManager.register( frame );

		Dimension d3Dim = new Dimension( 1024, 640 );

		AppSettings settings = new AppSettings( true );

		settings.setWidth( d3Dim.width );
		settings.setHeight( d3Dim.height );
		settings.setSamples( 4 );
		settings.setVSync( true );
		settings.setFrameRate( 60 );

		tweed = new Tweed( this );
		tweed.setSettings( settings );
		tweed.createCanvas();
		JmeCanvasContext ctx = (JmeCanvasContext) tweed.getContext();
		ctx.setSystemListener( tweed );

		canvas = ctx.getCanvas();
		canvas.setPreferredSize( d3Dim );

		frame.setLayout( new BorderLayout() );
		frame.add( buildUI(), BorderLayout.EAST );
		frame.add( canvas, BorderLayout.CENTER );
		frame.setExtendedState( frame.getExtendedState() | JFrame.MAXIMIZED_BOTH );

		frame.addWindowListener( new WindowAdapter() {
			public void windowClosing( WindowEvent e ) {
				TweedSettings.save(true);
				Tweed.deleteScratch();
			};
		} );

		scheduler.scheduleAtFixedRate( new Runnable() {
			@Override
			public void run() {
				TweedSettings.save(true);
			}
		}, 30, 30, TimeUnit.SECONDS );

		scheduler.scheduleAtFixedRate( new Runnable() {
			@Override
			public void run() {
				Vector3d pt = tweed.cursorPosition;
				if ( coordLabel != null && TweedSettings.settings.trans != null) {
					worldLabel.setText( pt == null ? "..." : String.format( "%.4f, %.4f ", 
							pt.x, 
							pt.z) );
					coordLabel.setText( pt == null ? "..." : String.format( "%.4f, %.4f ", 
							pt.x + TweedSettings.settings.trans[0], 
							pt.z + TweedSettings.settings.trans[1]) );
					crsLabel.setText(TweedSettings.settings.gmlCoordSystem);
				}

				JFrame.setDefaultLookAndFeelDecorated( true );

			}
		}, 100, 100, TimeUnit.MILLISECONDS );

		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		frame.pack();
		frame.setVisible( !HEADLESS );

		tweed.startCanvas();
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:72,代码来源:TweedFrame.java

示例7: SandboxFrame

import com.jme3.system.JmeCanvasContext; //导入方法依赖的package包/类
/**
 * Creates new form SandboxFrame
 */
public SandboxFrame() {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    kfm.addKeyEventDispatcher(new DAEKeyboardManager());
    initComponents();
    cboTranslateSpace.setModel(new DefaultComboBoxModel(TranslateGizmoSpace.values()));
    cboRotateSpace.setModel(new DefaultComboBoxModel(RotateGizmoSpace.values()));

    cboTranslateSpace.setSelectedItem(TranslateGizmoSpace.LOCAL);
    cboRotateSpace.setSelectedItem(RotateGizmoSpace.LOCAL);

    cboTranslateSpace.setRenderer(new TransformSpaceRenderer());
    cboRotateSpace.setRenderer(new TransformSpaceRenderer());

    SwingUtilities.updateComponentTreeUI(this);
    GlobalObjects.getInstance().registerListener(this);

    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    settings.setVSync(true);

    //settings.set
    viewport = new SandboxViewport();
    viewport.setSettings(settings);

    viewport.createCanvas(); // create canvas!
    JmeCanvasContext ctx = (JmeCanvasContext) viewport.getContext();
    ctx.setSystemListener(viewport);
    Dimension dim = new Dimension(640, 480);
    ctx.getCanvas().setPreferredSize(dim);
    ctx.getCanvas().setMinimumSize(new Dimension(320, 240));
    DropTarget dropTarget = new DropTarget(ctx.getCanvas(), this);
    viewport.startCanvas();

    pnlViewPort.setLeftComponent(ctx.getCanvas());
    propertiesPanel1.validate();

    createProjectDialog = new CreateProjectDialog(this, true);
    createObjectDialog = new CreateKlatchDialog(this, true);
    createObjectDialog.setExtension("rig");
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:46,代码来源:SandboxFrame.java


注:本文中的com.jme3.system.JmeCanvasContext.getCanvas方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。