I already tried "invalidate()" before validate(), no good result
Code:
package applet;
import java.awt.*;
import java.util.Vector;
import java.lang.String;
import javax.swing.*;
import applet.Language;
public class LUIweb extends JApplet implements Runnable {
Vector Soft;
Vector Version;
public JPanel middlePanel = new JPanel();
public JTextArea textArea = new JTextArea();
public JScrollPane textScrollPane = new JScrollPane(textArea,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
public Container container;
public LUIweb(){
container = getContentPane();
textArea = new JTextArea(30,40);
textArea.setEditable(false);
middlePanel = new JPanel();
//textArea.setPreferredSize(new Dimension(400,450));
textScrollPane = new JScrollPane(textArea,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
middlePanel.add(textScrollPane, BorderLayout.CENTER);
container.add(middlePanel, BorderLayout.CENTER);
}
public void init(){
container = getContentPane();
textArea = new JTextArea(30,40);
textArea.setEditable(false);
middlePanel = new JPanel();
//textArea.setPreferredSize(new Dimension(400,450));
textScrollPane = new JScrollPane(textArea,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
middlePanel.add(textScrollPane, BorderLayout.CENTER);
container.add(middlePanel, BorderLayout.CENTER);
}
public void start() {
(new Thread(this)).start();
}
// Arr?t de l'applet
public void stop() {
while(true);
}
// Un nouveau thread pour la r?actualisation de l'applet
public void run() {
DisplayMessage(Language.CONNECT_DB);
Data_net Donnee_net=new Data_net();
DisplayMessage("Connecting to "+Donnee_net.GetHost()+" with user "+Donnee_net.GetUser()+"...\n");
Donnee_net.Test();
}
public void ShowWish(Vector Softs, Vector Versions,char Action){
DisplayMessage(Language.WISH+"\n");
for (int i=0;i<Softs.size();i++){
String message=(String) Softs.get(i); message=message.concat((String) Versions.get(i));
String[] t = message.split("\n");
message = t[0];
for (int j=1; j < t.length; j++)
message = message.concat("_".concat(t[j])+"\n");
DisplayMessage("\t"+message);
}
}
public void DisplayMessage(String message){
this.textArea.append(message);
this.middlePanel.removeAll();
this.middlePanel.add(textScrollPane, BorderLayout.CENTER);
// repaint
this.middlePanel.validate();
this.middlePanel.repaint();
}
public void main(String[] arguments) throws NullPointerException {
}
}
Code:
package applet;
import com.maverick.ssh.*;
import com.maverick.ssh1.Ssh1Client;
import com.maverick.ssh2.*;
import com.sshtools.net.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Vector;
import javax.swing.*;
public class Data_net extends LUIweb{
public Data_net(){
DisplayMessage("TEST");
AskHost();
AskUser();
}
public void AskHost(){
String inputValue = JOptionPane.showInputDialog(Language.ASKHOST);
hostname=inputValue;
int idx = hostname.indexOf(':');
if(idx > -1) {
port = Integer.parseInt(hostname.substring(idx+1));
hostname = hostname.substring(0, idx);
}
}
public void AskPass(){
Frame frame = new Frame();
while (frame.password==null);
password=new String(frame.password);
}
public String GetPass(){
return password;
}
public String GetHost(){
return hostname;
}
public String GetUser(){
return username;
}
public void AskUser(){
String inputValue = JOptionPane.showInputDialog(Language.ASKUSER);
username = inputValue;
if(username==null || username.trim().equals(""))
username = System.getProperty("user.name");
}
public void Test(){
DisplayMessage("NON");
}
}
So here are two of my classes. Every thing is working but the call of DisplayMessage in Data_net...
I hope it'll help you to find a solution
Bookmarks