Java 如何在其他窗格中显示我的面板?
嗨,这是我的问题,我无法将面板显示到根面板中,我正在进行类似的聊天,有点像skype,但当我向用户发送消息时,我需要显示的部分(消息)没有显示。 这是我发送信息的代码:Java 如何在其他窗格中显示我的面板?,java,javafx,Java,Javafx,嗨,这是我的问题,我无法将面板显示到根面板中,我正在进行类似的聊天,有点像skype,但当我向用户发送消息时,我需要显示的部分(消息)没有显示。 这是我发送信息的代码: btnSend.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { String empt
btnSend.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
String empty = "";
String sendMessage = txtMensajes.getText();
String[] talkTo_array = lstDisplayBuddys.getSelectionModel().getSelectedItem().toString().split("-");
String talkTo = talkTo_array[talkTo_array.length - 1]+"@mpns.mcm.net.mx";
try{
// CONDITION IF ARE EMPTY THE MESSAGES
if (sendMessage.equals(empty)) {
JOptionPane.showMessageDialog(null, "Add some message");
}
else{
if (talkTo != sendMessage) {
while (true) {
try {
sendMessage(XMPPChatHelper.encodeBase64(sendMessage), talkTo);
System.out.println("send message");
//SHOW MY MESSAGES WHEN I SEND IT
Platform.runLater(()->{
pnContArea.getChildren().addAll(drawSendMessage(sendMessage));
txtMensajes.setText("");
});
} catch (XMPPException e) {
e.printStackTrace();
}
break;
}
ConnectionDBHistorialHelper ConnectionDBHistorialHelper=new ConnectionDBHistorialHelper();
ConnectionDBHistorialHelper.saveMessageSend(sendMessage);
}
}
}catch(Exception e){
}
}
});
thnks advanced.很容易做到,您只需初始化whatever变量,在本例中,所有窗格都带有
@FXML private variablePane variable;
他说,这很容易做到,你只需要初始化变量,在这种情况下,所有窗格
@FXML private variablePane variable;