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

📄 newredirectdialog.java

📁 java实现的代理程序 socket 编程实现的http 和socket 代理程序
💻 JAVA
字号:
/* * Created on 01-mar-2004 *  * To change the template for this generated file go to Window - Preferences - * Java - Code Generation - Code and Comments */package javatunnel.gui;import javatunnel.Configuration;import javax.swing.*;import java.awt.*;import java.awt.event.*;/** * @author utopio *  * To change the template for this generated type comment go to Window - * Preferences - Java - Code Generation - Code and Comments */public class NewRedirectDialog extends NewConnectionDialog {	JDialog dialog;	JTextField sourcePort;	JTextField destinationPort;	JTextField destinationIP;	JCheckBox manageHosts;	public NewRedirectDialog(JFrame parent) {				dialog = new JDialog(parent, "Creating new redirect connection", true);		dialog.setSize(300, 200);		Container contentPane = dialog.getContentPane();		contentPane.setLayout(new GridLayout(5,2));			JPanel p1=new JPanel();		FlowLayout flow1=new FlowLayout();		flow1.setAlignment(FlowLayout.LEFT);		p1.setLayout(flow1);		p1.add(new JLabel("Source port"));		contentPane.add(p1);				sourcePort = new JTextField(6);		JPanel p2=new JPanel();		FlowLayout flow2=new FlowLayout();		flow2.setAlignment(FlowLayout.LEFT);		p2.setLayout(flow2);		p2.add(sourcePort);		contentPane.add(p2);			JPanel p3=new JPanel();		FlowLayout flow3=new FlowLayout();		flow3.setAlignment(FlowLayout.LEFT);		p3.setLayout(flow3);		p3.add(new JLabel("Destination port"));		contentPane.add(p3);						destinationPort = new JTextField(6);		JPanel p4=new JPanel();		FlowLayout flow4=new FlowLayout();		flow4.setAlignment(FlowLayout.LEFT);		p4.setLayout(flow4);		p4.add(destinationPort);		contentPane.add(p4);					JPanel p5=new JPanel();		FlowLayout flow5=new FlowLayout();		flow5.setAlignment(FlowLayout.LEFT);		p5.setLayout(flow5);		p5.add(new JLabel("Destination address"));		contentPane.add(p5);				destinationIP = new JTextField(16);		JPanel p6=new JPanel();		FlowLayout flow6=new FlowLayout();		flow6.setAlignment(FlowLayout.LEFT);		p6.setLayout(flow6);		p6.add(destinationIP);		contentPane.add(p6);				JPanel p7=new JPanel();		FlowLayout flow7=new FlowLayout();		flow7.setAlignment(FlowLayout.LEFT);		p7.setLayout(flow7);		manageHosts=new JCheckBox("Manage hosts file");		manageHosts.setSelected(false);		p7.add(manageHosts);		contentPane.add(p7);				contentPane.add(new JLabel());			JButton accept = new JButton("Accept");		accept.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent action) {				getConfiguration();			}		});		JPanel p8=new JPanel();		p8.add(accept);		contentPane.add(p8);		JButton cancel = new JButton("Cancel");		cancel.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent action) {				dialog.hide();							dialog.dispose();			}		});		JPanel p9=new JPanel();		p9.add(cancel);		contentPane.add(p9);				dialog.show();	}	private void getConfiguration() {		String sourcePortText = sourcePort.getText();		String destinationPortText = destinationPort.getText();		String destinationIPText = destinationIP.getText();		int sourcePortInt;		int destinationPortInt;		try {			sourcePortInt = Integer.parseInt(sourcePortText);		} catch (NumberFormatException nfe) {			JOptionPane.showMessageDialog(				dialog,				"Source port value must be a number",				"Format Error",				JOptionPane.WARNING_MESSAGE);			return;		}		try {			 destinationPortInt = Integer.parseInt(destinationPortText);		} catch (NumberFormatException nfe) {			JOptionPane.showMessageDialog(				dialog,				"Destiantion port value must be a number",				"Format Error",				JOptionPane.WARNING_MESSAGE);			return;		}	 if(destinationIPText.length()==0){	 	JOptionPane.showMessageDialog(	 			dialog,				"Destination address is mandatory",				"Format Error",				JOptionPane.WARNING_MESSAGE);	 	return;	 }		configuration = new Configuration();		configuration.setMode(Configuration.MODE_REDIRECT);		configuration.setLocalPort(sourcePortInt);		configuration.setDestinationPort(destinationPortInt);		configuration.setDestinationAddress(destinationIPText);		configuration.setManageHostsFile(manageHosts.isSelected());		create();		dialog.hide();					dialog.dispose();	}}

⌨️ 快捷键说明

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