java开发工具包_java多线程实例

java开发工具包_java多线程实例【发包工具】http多线程发包工具使用方法:输入地址,发送的内容,线程数,等待时间,每个线程发送的次数,GET/POST请求。源代码packagecom.xmxkkk.httptest;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.border.TitledBorder;publ…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

【发包工具】http多线程发包工具

使用方法:输入地址,发送的内容,线程数,等待时间,每个线程发送的次数,GET/POST请求。

源代码

package com.xmxkkk.httptest;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.border.TitledBorder;

public class MainWindow extends JFrame {

// HttpClient httpclient;

private JPanel contentPane;

private BorderLayout borderLayout1;

private JPanel panURL;

private JPanel jPanel1;

private JPanel jPanel2;

private GridLayout gridLayout1;

private JTextField URLTxt;

private JSplitPane jSplitPane1;

private JScrollPane jScrollPane1;

private JScrollPane jScrollPane2;

private JTextArea jTextArea1;

private JTextArea jTextArea2;

private JScrollPane jScrollPane3;

private JTextArea jTextArea3;

private JButton jButton1;

private JButton jButton2;

private JPanel jPanel3;

private JRadioButton jRadioGet;

private JRadioButton jRadioPost;

public String method;

private JPanel jPanel4;

private ButtonGroup buttonGroup1;

private JButton jButton3;

private JCheckBox jCheckWrap;

private BorderLayout borderLayout2;

private TitledBorder titledBorder1;

private JTextField thread;

private JTextField num;

private JTextField time;

public MainWindow() {

// httpclient = null;

thread=new JTextField(5);

num=new JTextField(5);

time=new JTextField(5);

borderLayout1 = new BorderLayout();

panURL = new JPanel();

jPanel1 = new JPanel();

jPanel2 = new JPanel();

gridLayout1 = new GridLayout();

URLTxt = new JTextField();

jSplitPane1 = new JSplitPane();

jScrollPane1 = new JScrollPane();

jScrollPane2 = new JScrollPane();

jTextArea1 = new JTextArea();

jTextArea2 = new JTextArea();

jScrollPane3 = new JScrollPane();

jTextArea3 = new JTextArea();

jButton1 = new JButton();

jButton2 = new JButton();

jPanel3 = new JPanel();

jRadioGet = new JRadioButton();

jRadioPost = new JRadioButton();

method = “POST”;

jPanel4 = new JPanel();

buttonGroup1 = new ButtonGroup();

jButton3 = new JButton();

jCheckWrap = new JCheckBox();

borderLayout2 = new BorderLayout();

enableEvents(64L);

try {

jbInit();

} catch (Exception e) {

e.printStackTrace();

}

}

private void jbInit() throws Exception {

// httpclient = new HttpClient(this,jTextArea1);

contentPane = (JPanel) getContentPane();

titledBorder1 = new TitledBorder(“”);

contentPane.setLayout(borderLayout1);

setSize(new Dimension(652, 460));

setTitle(“Http testing tool”);

jPanel1.setLayout(gridLayout1);

gridLayout1.setColumns(1);

URLTxt.setBackground(SystemColor.desktop);

URLTxt.setForeground(Color.yellow);

URLTxt.setBorder(BorderFactory.createEtchedBorder());

URLTxt.setNextFocusableComponent(jButton1);

// URLTxt.setToolTipText(“Input the connection URL”);

URLTxt.setMargin(new Insets(5, 5, 5, 5));

URLTxt.setText(“http://”);

URLTxt.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

URLTxt_actionPerformed(e);

}

});

jSplitPane1.setOrientation(0);

jSplitPane1.setDividerSize(8);

// jTextArea1.setToolTipText(“Edit the request xml”);

jTextArea1.setText(“”);

jTextArea2.setText(“”);

jTextArea3.setForeground(Color.blue);

// jTextArea3.setToolTipText(“Recived message”);

jTextArea3.setText(“”);

jTextArea3.setLineWrap(true);

jTextArea3.setWrapStyleWord(true);

jButton1.setText(“Send”);

jButton1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jButton1_actionPerformed(e);

}

});

jButton2.setText(“Exit”);

jButton2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jButton2_actionPerformed(e);

}

});

jRadioGet.setForeground(new Color(0, 0, 230));

jRadioGet.setText(“GET”);

jRadioGet.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jRadioGet_actionPerformed(e);

}

});

jRadioPost.setForeground(new Color(0, 0, 230));

jRadioPost.setText(“POST”);

jRadioPost.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jRadioPost_actionPerformed(e);

}

});

panURL.setLayout(borderLayout2);

jButton3.setText(“Clear”);

jButton3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jButton3_actionPerformed(e);

}

});

jCheckWrap.setSelected(true);

jCheckWrap.setText(“LineWrap”);

jCheckWrap.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

jCheckWrap_actionPerformed(e);

}

});

contentPane.add(jPanel1, “Center”);

contentPane.add(panURL, “North”);

contentPane.add(jPanel2, “South”);

panURL.add(URLTxt, “Center”);

jPanel2.add(new JLabel(“线程”));

jPanel2.add(thread,null);

jPanel2.add(new JLabel(“次数”));

jPanel2.add(num,null);

jPanel2.add(new JLabel(“延时”));

jPanel2.add(time,null);

jPanel2.add(jCheckWrap, null);

jPanel2.add(jPanel4, null);

jPanel2.add(jPanel3, null);

jPanel3.add(jRadioGet, null);

jPanel3.add(jRadioPost, null);

jRadioPost.setSelected(true);

buttonGroup1.add(jRadioGet);

buttonGroup1.add(jRadioPost);

jPanel2.add(jButton1, null);

jPanel2.add(jButton3, null);

jPanel2.add(jButton2, null);

jPanel1.add(jSplitPane1, null);

jSplitPane1.add(jScrollPane1, “top”);

jSplitPane1.add(jScrollPane3, “bottom”);

jScrollPane3.getViewport().add(jTextArea3, null);

jScrollPane1.getViewport().add(jTextArea1, null);

jScrollPane2.getViewport().add(jTextArea2, null);

jSplitPane1.setDividerLocation(100);

}

protected void processWindowEvent(WindowEvent e) {

super.processWindowEvent(e);

if (e.getID() == 201)

System.exit(0);

}

void jButton1_actionPerformed(ActionEvent e) {

// String soMethod = String.valueOf(String.valueOf((new StringBuffer(“Method: “)).append(method).append(“:\n”)));

String url = URLTxt.getText();

String xml = jTextArea1.getText();

String str=thread.getText();

int cnt=1;

if(str==null||str.equals(“”)){

cnt=1;

thread.setText(cnt+””);

}else{

cnt=Integer.parseInt(str);

thread.setText(cnt+””);

}

String abc=num.getText();

int every=1;

if(abc==null||abc.equals(“”)){

every=1;

num.setText(every+””);

}else{

every=Integer.parseInt(abc);

num.setText(every+””);

}

String div=time.getText();

int divI=0;

if(div==null||div.equals(“”)){

divI=0;

time.setText(divI+””);

}else{

divI=Integer.parseInt(div);

time.setText(divI+””);

}

for(int i=0;i -1)

sb.append((char) ch);

rec_string = sb.toString();

rd.close();

urlconn.disconnect();

} catch (Exception e) {

log = String.valueOf(String.valueOf((new StringBuffer(“请求错误:”))

.append(e.getMessage()).append(e.toString())));

writeLog(log);

}

return rec_string;

}

private String getMethod() {

if (mwindow == null)

return “GET”;

else

return mwindow.method;

}

private void writeLog(String s) {

if (mwindow == null)

System.out.println(s);

else

mwindow.showMsg(String.valueOf(String.valueOf(s)).concat(“\n”));

}

public static void main(String args[]) {

}

public void run() {

for(int i=0;i screenSize.height)

frameSize.height = screenSize.height;

if (frameSize.width > screenSize.width)

frameSize.width = screenSize.width;

frame.setLocation((screenSize.width – frameSize.width) / 2,

(screenSize.height – frameSize.height) / 2);

frame.setVisible(true);

}

public static void main(String args[]) {

try {

//

UIManager.setLookAndFeel(UIManager

.getCrossPlatformLookAndFeelClassName());

UIManager

.setLookAndFeel(“com.sun.java.swing.plaf.windows.WindowsLookAndFeel”);

// SwingUtilities.updateComponentTreeUI(this);

} catch (Exception e) {

e.printStackTrace();

}

new HttpTest();

}

}

原文:http://www.cnblogs.com/firecode/p/4161453.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/196657.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 草根程序员转型做项目管理走过的点点滴滴之_华为裁员感想

    草根程序员转型做项目管理走过的点点滴滴之_华为裁员感想自己一直假想还停留在29岁那个黄金年龄,仿佛明天就要30岁(老话里而立的年纪),因此总感觉要拼命的工作,拼命的学习好让明天立的更稳固一些。缘起百度了一把华为裁员的相关报道,又看了几篇别人写的华为裁员的理解已经对中国it行业的痛批文章,把我一下子拉回了现实,85年出生在农村的自己到现在恰好也是三十二几岁的阶段,发现也没啥立不立的,还是那个拼命三郎的状态,顿时有些迷惑与感伤。

    2022年7月17日
    16
  • python stacking_详解 Stacking 的 python 实现[通俗易懂]

    1.什么是stackingstacking就是当用初始训练数据学习出若干个基学习器后,将这几个学习器的预测结果作为新的训练集,来学习一个新的学习器。2.代码:例如我们用RandomForestClassifier,ExtraTreesClassifier,GradientBoostingClassifier作为第一层学习器:#Ourlevel0classifiersclfs…

    2022年4月8日
    114
  • x201换风扇_笔记本怎么换风扇 ThinkPad X201i换风扇图文教程

    x201换风扇_笔记本怎么换风扇 ThinkPad X201i换风扇图文教程ThinkPadX201i换电扇图文教程:拆机之前,我们需求先对X201i的散热电扇在停止了开端的理解,得知价钱从10元左右的单电扇,到上百的散热全体都有,而且还分东芝产和松下产等不同产地的,小编选择了松下产的整套散热(包括散热片和电扇),价钱为150,电扇固定办法为小螺丝。假定拿到电脑修理店去换的话,小编猜测我们所需求的费用至少在200-300元之间。一:拆机前的准备螺丝刀,小毛刷和安排螺丝的…

    2022年6月27日
    44
  • 51单片机ds18b20温度检测(51单片机lcd1602电子时钟)

    基于51单片机LCD1602温度显示(DS18B20测温)要在1602上显示温度先要了解1602是如何显示的。详情可以参考我之前的文章基于51单片机1602显示DS18B20是美国DALLAS半导体公司推出的第一片支持“一线总线”接口的温度传感器,具有微型化、低功耗、高性能、抗干扰能力强、易配微处理器等优点,可直接将温度转化成串行数字信号供处理器处理。我们首先来了解“单总线”的概念。目前,常用的单片机与外设之间进行数据传输的串行总线主要有I2、SPI和SCI总线。其中I2总线以同步串行二线方式进行通信

    2022年4月15日
    38
  • idea2019.3激活码(注册激活)

    (idea2019.3激活码)本文适用于JetBrains家族所有ide,包括IntelliJidea,phpstorm,webstorm,pycharm,datagrip等。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/ide…

    2022年3月29日
    2.1K
  • 黄页网址大全推荐_常用的网站

    黄页网址大全推荐_常用的网站可以试试这个,https://tongcheng360.com页面干净整洁,页面使用缓存技术,打开速度非常快,包括公司简介,发布公司产品,发布公司新闻,公司如有特殊需求,可进行定制化开发,大大节省了公司的运维和开发成本并且具有同城分类信息的功能b站操作视频https://www.bilibili.com/video/BV1jy4y1L7Z1…

    2022年5月3日
    257

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号