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

📄 myframe1.java

📁 简易的具有GPS导航功能的程序。仅有四个点
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class myframe1 extends JFrame implements ActionListener {

	int width = 400;
	int len =330;
	JLabel jiashu = new JLabel("请输入您要添加节点:             ");
	JLabel jiashu1= new JLabel();
	JLabel jiashu2= new JLabel();
	JLabel jiashu3= new JLabel();
	JLabel jiashu4= new JLabel();
	JTextField into = new JTextField(15);
	JTextField into1 = new JTextField(15);
	JTextField into2 = new JTextField(15);
	JTextField into3 = new JTextField(15);
	JTextField into4 = new JTextField(15);
	JPanel jia =  new JPanel();
	JPanel jia1 =  new JPanel();
	JPanel jia2 =  new JPanel();
	JButton button3 = new JButton("确定");
	JButton button4 =new JButton("继续添加");
	public myframe1()
	{
		JFrame myframe =new JFrame("添加节点对话框");
		Container content1 = getContentPane();
		myframe.setLayout(new BorderLayout());
		WindowDestroyer myListener1 = new WindowDestroyer();
		addWindowListener(myListener1);
		myframe.setSize(width,len-100);
		content1.setBackground(Color.RED);
		into.setBackground(Color.YELLOW);
		jia.add(jiashu);
		jia.add(into);
		jia.setBackground(Color.magenta);
		myframe.add(jia,BorderLayout.NORTH);//该对话框的上部已做完
		//int a= Integer.parseInt(into.getText());
		jiashu1.setText("请输入您添加节点的前驱:");
		into1.setBackground(Color.YELLOW);
		into3.setBackground(Color.YELLOW);
		into4.setBackground(Color.YELLOW);
		jia1.add(jiashu1);
		jia1.add(into1);
		jia1.setBackground(Color.magenta);
		jiashu3.setText("加入节点与前驱节点的权值");
		jia1.add(jiashu3);
		jia1.add(into3);
		jiashu2.setText("请输入您添加节点的后继:");
		into2.setBackground(Color.YELLOW);
		jia1.add(jiashu2);
		jia1.add(into2);
		jiashu4.setText("加入节点与后继节点的权值");
		jia1.add(jiashu4);
		jia1.add(into4);
		myframe.add(jia1,BorderLayout.CENTER);//该对话框的中部已做完
		button3.setBackground(Color.green);
		button4.setBackground(Color.green);
		jia2.add(button3);
	    button3.addActionListener(this);
	    button4.addActionListener(this);
		jia2.add(button4);
		myframe.add(jia2,BorderLayout.SOUTH);//该对话框的中部已做完
		myframe.setVisible(true);
	}
	AWD Path1=new AWD (10,100000000);
	String place[] = new String[10];
	public void actionPerformed(ActionEvent e)
	{
		if(e.getActionCommand().equals("确定"))
		{
			for(int i=1;i<=5;i++)
	    	  { 
	    		  place[i]=new String();
	    	  }
	          place[1]="a";
	          place[2]="b";
	          place[3]="c";
	          place[4]="d";
	          place[5]="e";
	          
	          Path1.Add(1, 2, 1);
	          Path1.Add(2, 3, 1);
	          Path1.Add(1, 3, 4);
	          int m= Integer.parseInt(into1.getText()) ;
	          int M= Integer.parseInt(into3.getText()) ;
	          Path1.Add(5, m, M);
	          int n= Integer.parseInt(into2.getText()) ;
	          int N= Integer.parseInt(into4.getText()) ;
	          Path1.Add(5, n, N);
	          GUI gui = new GUI();
		}
		if(e.getActionCommand().equals("继续添加"))
		{
			myframe1 frame1 = new myframe1();
		}
	}

}

⌨️ 快捷键说明

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