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

📄 collisonsettingsframe.java

📁 运用java3D模拟刚体间的碰撞,爆炸及在万有引力作用下的运动轨迹,设置适当的参数可以模拟天体运动等多种物理现象.
💻 JAVA
字号:
/** 
 * CollisonSettingsFrame.java
 *
 * Description:	
 * @author			Ben Childs
 * @version			
 */

package Physics3D;

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

public class CollisonSettingsFrame extends javax.swing.JFrame {

// 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
	javax.swing.JTabbedPane jTabbedPane1 = new javax.swing.JTabbedPane();
	javax.swing.JPanel Explosion = new javax.swing.JPanel();
	javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
	javax.swing.JTextField blastRadius = new javax.swing.JTextField();
	javax.swing.JPanel Bounce = new javax.swing.JPanel();
	javax.swing.JRadioButton explosion = new javax.swing.JRadioButton();
	javax.swing.JRadioButton bounc = new javax.swing.JRadioButton();
	javax.swing.JButton okButton = new javax.swing.JButton();
	javax.swing.JButton cancelButton = new javax.swing.JButton();
// END GENERATED CODE

	public CollisonSettingsFrame() {
	}

	public void initComponents() throws Exception {
// 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
		// the following code sets the frame's initial state
		java.awt.Image img0 = getToolkit().getImage(ClassLoader.getSystemResource("physics3d.gif"));
		// Note: for non-URL based images, relative paths are generated;
		// If not generating a JAR file, create valid relative location for deployment;

		jTabbedPane1.setLocation(new java.awt.Point(30, 40));
		jTabbedPane1.setSize(new java.awt.Dimension(290, 220));
		jTabbedPane1.setVisible(true);
		Explosion.setLayout(null);
		Explosion.setVisible(true);
		jLabel1.setLocation(new java.awt.Point(8, 14));
		jLabel1.setSize(new java.awt.Dimension(150, 20));
		jLabel1.setText("Blast Radius Multiplier");
		jLabel1.setToolTipText("How much splash damage happens from explosion (Default 3)");
		jLabel1.setVisible(true);
		blastRadius.setLocation(new java.awt.Point(168, 14));
		blastRadius.setSize(new java.awt.Dimension(30, 20));
		blastRadius.setText("3");
		blastRadius.setToolTipText("* radius");
		blastRadius.setVisible(true);
		Bounce.setEnabled(false);
		Bounce.setLayout(null);
		Bounce.setVisible(true);
		explosion.setLocation(new java.awt.Point(40, 10));
		explosion.setSize(new java.awt.Dimension(130, 20));
		explosion.setText("Explode");
		explosion.setVisible(true);
		bounc.setLocation(new java.awt.Point(170, 10));
		bounc.setSize(new java.awt.Dimension(130, 20));
		bounc.setText("Bounce");
		bounc.setVisible(true);
		okButton.setLocation(new java.awt.Point(80, 270));
		okButton.setSize(new java.awt.Dimension(80, 30));
		okButton.setText("OK");
		okButton.setVisible(true);
		cancelButton.setLocation(new java.awt.Point(190, 270));
		cancelButton.setSize(new java.awt.Dimension(80, 30));
		cancelButton.setText("Cancel");
		cancelButton.setVisible(true);
		setIconImage(img0);
		getContentPane().setLayout(null);
		setLocation(new java.awt.Point(0, 0));
		setTitle("Physics3D.CollisonSettingsFrame");

		jTabbedPane1.add(Explosion);
		jTabbedPane1.setTitleAt(jTabbedPane1.getTabCount() - 1, "Explosion");
		jTabbedPane1.add(Bounce);
		jTabbedPane1.setTitleAt(jTabbedPane1.getTabCount() - 1, "Bounce");
		Explosion.add(jLabel1);
		Explosion.add(blastRadius);
		getContentPane().add(jTabbedPane1);
		getContentPane().add(explosion);
		getContentPane().add(bounc);
		getContentPane().add(okButton);
		getContentPane().add(cancelButton);

		jTabbedPane1.setSelectedIndex(0);
		explosion.setSelected(true);
		setSize(new java.awt.Dimension(358, 344));

		// event handling
		addWindowListener(new java.awt.event.WindowAdapter() {
			public void windowClosing(java.awt.event.WindowEvent e) {
				thisWindowClosing(e);
			}
		});

// END GENERATED CODE
	}
  
  	private boolean mShown = false;
  	
	public void addNotify() {
		super.addNotify();
		
		if (mShown)
			return;
			
		// resize frame to account for menubar
		JMenuBar jMenuBar = getJMenuBar();
		if (jMenuBar != null) {
			int jMenuBarHeight = jMenuBar.getPreferredSize().height;
			Dimension dimension = getSize();
			dimension.height += jMenuBarHeight;
			setSize(dimension);
			
			// move down components in layered pane
			Component[] components = getLayeredPane().getComponentsInLayer(JLayeredPane.DEFAULT_LAYER.intValue());
			for (int i = 0; i < components.length; i++) {
				Point location = components[i].getLocation();
				location.move(location.x, location.y + jMenuBarHeight);
				components[i].setLocation(location);
			}
		}

		mShown = true;
	}

	// Close the window when the close box is clicked
	void thisWindowClosing(java.awt.event.WindowEvent e) {
		setVisible(false);
		dispose();
		System.exit(0);
	}
	
}

⌨️ 快捷键说明

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