Minor Changes to ChatController adding a TODO and created a LobbyListItem class to represent members of the lobby list view, or at least the data therein.
This commit is contained in:
parent
5fbee579a9
commit
b769991c36
@ -32,6 +32,7 @@ import javafx.scene.layout.GridPane;
|
|||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.text.Text;
|
||||||
import javafx.scene.text.TextFlow;
|
import javafx.scene.text.TextFlow;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -163,16 +164,20 @@ public class ChatController implements Initializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO figure out if to use Text or Label & how to make wrapping work finally @Sebastian
|
||||||
private void sendChatMsg() {
|
private void sendChatMsg() {
|
||||||
String msg = chatMsgField.getText();//.split("\\R")[0]; //cut off extra lines, if present.
|
String msg = chatMsgField.getText();//.split("\\R")[0]; //cut off extra lines, if present.
|
||||||
if (!msg.isEmpty()) {
|
if (!msg.isEmpty()) {
|
||||||
client.getClient().sendMsgToServer(cmd.toString() + msg);
|
client.getClient().sendMsgToServer(cmd.toString() + msg);
|
||||||
LOGGER.info("Message trying to send is: " + cmd.toString() + msg);
|
LOGGER.info("Message trying to send is: " + cmd.toString() + msg);
|
||||||
|
Text t;
|
||||||
Label l;
|
Label l;
|
||||||
if (cmd.startsWith(whisper)) {
|
if (cmd.startsWith(whisper)) {
|
||||||
|
t = new Text("You whispered to " + whisperTargetSelectField.getText() + ": " + msg);
|
||||||
l = new Label("You whispered to " + whisperTargetSelectField.getText() + ": " + msg);
|
l = new Label("You whispered to " + whisperTargetSelectField.getText() + ": " + msg);
|
||||||
l.setBackground(Background.fill(Color.LAVENDERBLUSH));
|
l.setBackground(Background.fill(Color.LAVENDERBLUSH));
|
||||||
} else {
|
} else {
|
||||||
|
t = new Text(client.getUsername() + " (you): " + msg);
|
||||||
l = new Label(client.getUsername() + " (you): " + msg);
|
l = new Label(client.getUsername() + " (you): " + msg);
|
||||||
l.setBackground(Background.fill(Color.LAVENDER));
|
l.setBackground(Background.fill(Color.LAVENDER));
|
||||||
l.setWrapText(true);
|
l.setWrapText(true);
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package ch.unibas.dmi.dbis.cs108.multiplayer.client.gui.lounge;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.ToggleButton;
|
||||||
|
|
||||||
|
public class LobbyListItem {
|
||||||
|
|
||||||
|
private Label lobbyID;
|
||||||
|
private Label adminName;
|
||||||
|
private List<String> clientInLobby;
|
||||||
|
private ToggleButton button;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user