追加 JTextArea &稍后调用()
我需要一些关于这个的帮助,
我基本上有menuVIP.java和vipKeyword.java。
这是 menuVIP.java
if (source == enter2) {
Thread blah = new Thread() {
String keyword = keyfield.getText();
public void run() {
final String result;
vipKeyword vipK = new vipKeyword();
result = vipK.keyword(keyword);
}
};
blah.start();
这是 vipKeyword.java
public class vipKeyword {
public String keyword(String keyword) {
menuVIP vip = new menuVIP();
String password;
String tbl;
String Final = null;
int dot;
try {
databaseConnection dbC = new databaseConnection();
dbC.connection();
PreparedStatement prep2 = dbC.conn.prepareStatement("SELECT * "
+ "FROM Vip_tbl");
ResultSet rs = prep2.executeQuery();
while(rs.next()) {
cellnumber = rs.getString(1);
try {
final String cell;
cell = cellnumber;
SwingUtilities.invokeLater(new Runnable() {
menuVIP vip = new menuVIP();
public void run() {
vip.ta.append(cell + "\n");
vip.ta.repaint();
}
});
return keyword;
}
我需要知道的是如何在 SwingUtilities.invokelater() 中“附加”我的 vipKeyword 中的 Jtextarea?
注:ta = JTextArea
I need some help on this one please,
i basically have menuVIP.java, and vipKeyword.java.
This is menuVIP.java
if (source == enter2) {
Thread blah = new Thread() {
String keyword = keyfield.getText();
public void run() {
final String result;
vipKeyword vipK = new vipKeyword();
result = vipK.keyword(keyword);
}
};
blah.start();
And this is vipKeyword.java
public class vipKeyword {
public String keyword(String keyword) {
menuVIP vip = new menuVIP();
String password;
String tbl;
String Final = null;
int dot;
try {
databaseConnection dbC = new databaseConnection();
dbC.connection();
PreparedStatement prep2 = dbC.conn.prepareStatement("SELECT * "
+ "FROM Vip_tbl");
ResultSet rs = prep2.executeQuery();
while(rs.next()) {
cellnumber = rs.getString(1);
try {
final String cell;
cell = cellnumber;
SwingUtilities.invokeLater(new Runnable() {
menuVIP vip = new menuVIP();
public void run() {
vip.ta.append(cell + "\n");
vip.ta.repaint();
}
});
return keyword;
}
What i need to know is how to "append" the Jtextarea from my vipKeyword in the SwingUtilities.invokelater()?
Note: ta = JTextArea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
...
...