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

📄 propertiesframe.java

📁 运用java3D模拟刚体间的碰撞,爆炸及在万有引力作用下的运动轨迹,设置适当的参数可以模拟天体运动等多种物理现象.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/***************************************************

Copyright 2003 Ben Childs


This file is part of Physics 3D.

    Physics 3D is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Physics 3D is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Physics 3D; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA




***************************************************/


package com.bchilds.Physics3D;

import java.awt.*;
import java.awt.event.*;
import	javax.swing.*;

import javax.vecmath.*;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.image.TextureLoader;
import com.sun.j3d.utils.behaviors.vp.OrbitBehavior;
import com.sun.j3d.utils.picking.*;


public class PropertiesFrame extends JFrame implements WindowStateListener {

//
public static Physics3DFrame mainFrame;
Particle3D currentObject = null;

// IMPORTANT: Source code between BEGIN/END comment pair will be regenerated
// every time the form is saved. All manual changes will be overwritten.
// BEGIN GENERATED CODE
	// member declarations
	JLabel jLabel1 = new JLabel();
	JTextField mass = new JTextField();
	JButton updateButton = new JButton();
	JButton resetButton = new JButton();
	JLabel jLabel10 = new JLabel();
	JTextField radius = new JTextField();
	JPanel jPanel1 = new JPanel();
	JTextField xPosition = new JTextField();
	JTextField yPosition = new JTextField();
	JTextField zPosition = new JTextField();
	JLabel jLabel2 = new JLabel();
	JLabel jLabel3 = new JLabel();
	JLabel jLabel4 = new JLabel();
	JPanel jPanel2 = new JPanel();
	JTextField xSpeed = new JTextField();
	JTextField ySpeed = new JTextField();
	JTextField zSpeed = new JTextField();
	JLabel jLabel7 = new JLabel();
	JLabel jLabel8 = new JLabel();
	JLabel jLabel9 = new JLabel();
	
	JPanel orientationPanel = new JPanel();
	JTextField pitch = new JTextField();
	JTextField yaw = new JTextField();
	JTextField roll = new JTextField();
	JLabel pitchLabel = new JLabel();
	JLabel yawLabel = new JLabel();
	JLabel rollLabel = new JLabel();
	
	JPanel angularVelPanel = new JPanel();
	JTextField pitchVel = new JTextField();
	JTextField yawVel = new JTextField();
	JTextField rollVel = new JTextField();
	JLabel pitchVelLabel = new JLabel();
	JLabel yawVelLabel = new JLabel();
	JLabel rollVelLabel = new JLabel();
	
	JTextField name = new JTextField();
	JTextField elasticity = new JTextField();
	JLabel jLabel5 = new JLabel();
	JLabel jLabel6 = new JLabel();
	JButton prevButton = new JButton();
	JButton nextButton = new JButton();
// END GENERATED CODE

	public PropertiesFrame() {
	}

	public void initComponents() throws Exception {

	
		Image img0 = getToolkit().getImage(ClassLoader.getSystemResource("physics3d.gif"));
	
		jLabel1.setLocation(new Point(16, 487));
		jLabel1.setSize(new Dimension(64, 20));
		jLabel1.setText("Mass (kg)");
		jLabel1.setVisible(true);
		mass.setLocation(new Point(144, 487));
		mass.setSize(new Dimension(50, 20));
		mass.setText("100");
		mass.setVisible(true);
		updateButton.setLocation(new Point(13, 560));
		updateButton.setSize(new Dimension(80, 30));
		updateButton.setText("Update");
		updateButton.setVisible(true);
		resetButton.setLocation(new Point(123, 560));
		resetButton.setSize(new Dimension(70, 30));
		resetButton.setText("Reset");
		resetButton.setVisible(true);
		jLabel10.setLocation(new Point(16, 456));
		jLabel10.setSize(new Dimension(64, 20));
		jLabel10.setText("Radius (m)");
		jLabel10.setVisible(true);
		radius.setLocation(new Point(144, 456));
		radius.setSize(new Dimension(50, 20));
		radius.setText(".1");
		radius.setVisible(true);
		
		jPanel1.setBorder(new javax.swing.plaf.BorderUIResource.TitledBorderUIResource(new javax.swing.border.LineBorder(new Color(153, 153, 153), 1, false), "Position (m)", 4, 2, new Font("Dialog", 1, 12), Color.black));
		jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS));
		jPanel1.setLocation(new Point(9, 49));
		jPanel1.setSize(new Dimension(184, 94));
		jPanel1.setVisible(true);
		
		JPanel p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		jLabel2.setText("X: ");
		xPosition.setText("0.0");
		
		p.add(jLabel2);
		p.add(xPosition);
		
		jPanel1.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
		
		
		jLabel3.setText("Y: ");		
		yPosition.setText("0.0");
		
		p.add(jLabel3);
		p.add(yPosition);
		
		jPanel1.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		jLabel4.setText("Z: ");
		zPosition.setText("0.0");
		
		p.add(jLabel4);
		p.add(zPosition);
		
		jPanel1.add(p);
				

		jPanel2.setBorder(new javax.swing.plaf.BorderUIResource.TitledBorderUIResource(new javax.swing.border.LineBorder(new Color(153, 153, 153), 1, false), "Velocity (m/s)", 4, 2, new Font("Dialog", 1, 12), Color.black));
		jPanel2.setLayout(new BoxLayout(jPanel2, BoxLayout.Y_AXIS));
		jPanel2.setLocation(new Point(9, 150));
		jPanel2.setSize(new Dimension(184, 94));
		jPanel2.setVisible(true);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		jLabel7.setText("X: ");
		xSpeed.setText("0.0");
		
		p.add(jLabel7);
		p.add(xSpeed);
		
		jPanel2.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
		
		
		jLabel8.setText("Y: ");		
		ySpeed.setText("0.0");
		
		p.add(jLabel8);
		p.add(ySpeed);
		
		jPanel2.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		jLabel9.setText("Z: ");
		zSpeed.setText("0.0");
		
		p.add(jLabel9);
		p.add(zSpeed);
		
		jPanel2.add(p);
		

		orientationPanel.setBorder(new javax.swing.plaf.BorderUIResource.TitledBorderUIResource(new javax.swing.border.LineBorder(new Color(153, 153, 153), 1, false), "Orientation (r)", 4, 2, new Font("Dialog", 1, 12), Color.black));
		orientationPanel.setLayout(new BoxLayout(orientationPanel, BoxLayout.Y_AXIS));
		orientationPanel.setLocation(new Point(9, 251));
		orientationPanel.setSize(new Dimension(184, 94));
		orientationPanel.setVisible(true);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		pitchLabel.setText("P: ");
		pitch.setText("0.0");
		
		p.add(pitchLabel);
		p.add(pitch);
		
		orientationPanel.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
		
		
		yawLabel.setText("Y: ");		
		yaw.setText("0.0");
		
		p.add(yawLabel);
		p.add(yaw);
		
		orientationPanel.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		rollLabel.setText("R: ");
		roll.setText("0.0");
		
		p.add(rollLabel);
		p.add(roll);
		
		orientationPanel.add(p);
		
		angularVelPanel.setBorder(new javax.swing.plaf.BorderUIResource.TitledBorderUIResource(new javax.swing.border.LineBorder(new Color(153, 153, 153), 1, false), "Angluar Velocity (r/s)", 4, 2, new Font("Dialog", 1, 12), Color.black));
		angularVelPanel.setLayout(new BoxLayout(angularVelPanel, BoxLayout.Y_AXIS));
		angularVelPanel.setLocation(new Point(9, 352));
		angularVelPanel.setSize(new Dimension(184, 94));
		angularVelPanel.setVisible(true);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		pitchVelLabel.setText("P: ");
		pitchVel.setText("0.0");
		
		p.add(pitchVelLabel);
		p.add(pitchVel);
		
		angularVelPanel.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
		
		
		yawVelLabel.setText("Y: ");		
		yawVel.setText("0.0");
		
		p.add(yawVelLabel);
		p.add(yawVel);
		
		angularVelPanel.add(p);
		
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

		rollVelLabel.setText("R: ");
		rollVel.setText("0.0");
		
		p.add(rollVelLabel);
		p.add(rollVel);
		
		angularVelPanel.add(p);
		
		
		name.setLocation(new Point(58, 14));
		name.setSize(new Dimension(133, 19));
		name.setText("Particle1");
		name.setVisible(true);
		elasticity.setLocation(new Point(144, 518));
		elasticity.setSize(new Dimension(50, 20));
		elasticity.setText("1.0");
		elasticity.setVisible(true);
		jLabel5.setLocation(new Point(16, 518));
		jLabel5.setSize(new Dimension(98, 20));
		jLabel5.setText("Elasticity (0 to 1)");
		jLabel5.setVisible(true);
		jLabel6.setLocation(new Point(13, 13));
		jLabel6.setSize(new Dimension(36, 20));
		jLabel6.setText("Name");

⌨️ 快捷键说明

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