简体   繁体   中英

JTextArea default value?

I have been taught only to manage the GUI through the event dispatcher thread. Currently I am using a textArea.append("something"); outside of the event dispatcher thread, but I want this to always happen at the start of running the program. How can I set a listener to act upon the start up for the program or is what I have done acceptable?

在创建它时使用构造函数JTextArea(String text)

One solution is to create a method in the Class containing the JTextArea called localInitialization() or something like it, which is called in the class's constructor directly after initComponents(). This allows you to put your own custom start-up conditions especially if you are using a GUI Builder such as the one in NetBeans where you cannot edit initComponents().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM