⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 localstreetenvironment.java

📁 Java 3D Desktop Environment旨在使用Java 3D来创建一个3D桌面环境。功能包括:分布式的应用程序
💻 JAVA
字号:
package org.j3de.environment.street;   

import java.rmi.RemoteException; 
import java.util.List;

import javax.vecmath.Vector3f;
   
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.Document;     
import org.w3c.dom.Element;

import org.j3de.behavior.MovementBehavior;
import org.j3de.behavior.DominantHandBehavior;
import org.j3de.exception.ExceptionHandler;  
import org.j3de.interfaces.Environment;     
import org.j3de.interfaces.LocalEnvironment;    
import org.j3de.ui.LocalUIFactory;  
import org.j3de.util.AbstractComponent;   
import org.j3de.util.ConfigurationException; 
import org.j3de.util.ConfigHelper; 
import org.j3de.util.EntryFactory;  
import org.j3de.util.InitializationException; 
import org.j3de.util.StringParser;

public class LocalStreetEnvironment extends AbstractComponent implements LocalEnvironment {             
  
  private LocalUIFactory localUIFactory;
  private List startupURLs;      
  
  private MovementBehavior     movementBehavior;  
  private DominantHandBehavior dominantHandBehavior;  

  private Vector3f             position;
    
  public Environment getEnvironment() {
    return new StreetEnvironment(localUIFactory.getUIFactory(), 
                                 startupURLs,
                                 movementBehavior,
                                 dominantHandBehavior,
                                 position);
  }
   
  public void configure(Node node, Document nodeFactory)  throws ConfigurationException {  
    super.configure(node, nodeFactory);    
   
    position = StringParser.parseVector3f(helper.getPropertyValue("position", "0.0 0.0 0.0", true));
                                   
    try {
      localUIFactory = (LocalUIFactory)helper.getComponent("UIFactory", 
                                                           null, null, null, 
                                                           this.getClass().getClassLoader());  
    } catch (Exception e) {                                                                      
      ExceptionHandler.handleException(e);
      throw new ConfigurationException("Exception while creating UIFactory : " + e.getMessage());
    }                         
    
    try {
      movementBehavior = (MovementBehavior)helper.getComponent("MovementBehavior", 
                                                               null, null, null, 
                                                               this.getClass().getClassLoader());  
      
      dominantHandBehavior = (DominantHandBehavior)helper.getComponent("DominantHandBehavior", 
                                                                       null, null, null, 
                                                                       this.getClass().getClassLoader());  
      
    } catch (Exception e) {
      ExceptionHandler.handleException(e);
      throw new ConfigurationException("Exception while creating Behaviors : " + e.getMessage());
    }                                                         
                                                                                           
    startupURLs = helper.getList("startupApplications", 
      new EntryFactory() { 
        public Object createEntry(Node node) {      
          try {
            NamedNodeMap attributes = node.getAttributes();  
            Node attrib = attributes.getNamedItem("url");    
            return attrib.getNodeValue();  
          } catch (NullPointerException e) {
            return null;
          }
        }
      });
             
  }  

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -