Atitit. Summary of Aticonsole Scheme processing for product console log

Source: Internet
Author: User

Atitit. Product Console of the log Aticonsole Program Processing Summary

1. Main principle Flow 1

2. Calling code 1

3. Internal main Realization 1

3.1. Put message 1

3.2. Reading messages 2

The console can log by default .

But some need a multiline text box to do log

1. Main principle Flow

Linkedblockingqueue put the message into a.

A UI thread reads the message: Use blocking mode:

2. Calling code

PRJ. atimail/atiskinswing

Ax =  New acctester (threadcount);

Ax . Msgboxc = New Consolebox (textArea);

injected MsgBox to implement the put message, construct the textarea to implement the write message.

Author:: Old Wow's paw attilax Ayron, email:[email protected]

Reprint please indicate source: Http://blog.csdn.net/attilax

3. Internal main realization 3.1. Put messages

Msgboxc . Put (em + "," + pwd + "success \ r \ n");

Public linkedblockingqueue<string> Rztqueue  =  New linkedblockingqueue<string> ();

Public void put(string string) {

Try  {

Rztqueue . Put (string);

} catch (interruptedexception e) {

//  TODO auto-generated Catch block

e . Printstacktrace ();

}

}

3.2. Reading messages

private void ini () {

//msg Collect process

es_single. Execute (new Runnable () {

@Override

public void Run () {

while (true) {

//msgstopflag=true;

if(msgstopflag)

 {

jTextArea1. Append ("\ r \ n Get information timer stop");

break;

 }

Try {

//final int n = i;

core. Sleep (a);

String v = null;

Try {

v = rztqueue. Take ();

} catch (interruptedexception e) {

e. Printstacktrace ();

 }

jTextArea1. Append ("\ r \ n" + v + "!) ");

//jtextarea1.paintimmediately (Jtextarea1.getbounds ());

jTextArea1setcaretposition (jTextArea1. GetText ()

. Length ()); //Scroll to the end

} catch (Exception e) {

e. Printstacktrace ();

 }

 }

 }

 });

}

Atitit. Summary of Aticonsole Scheme processing for product console log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.