Working on My Profile UI.

This commit is contained in:
Asal Lotfi
2025-08-13 11:03:35 +03:30
parent 1839dccd83
commit bb1317f7dd
10 changed files with 98 additions and 5 deletions
@@ -1,6 +1,5 @@
package org.to.telegramfinalproject.UI;
import javafx.animation.TranslateTransition;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
@@ -10,12 +9,10 @@ import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.util.Duration;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.io.IOException;
@@ -125,7 +122,7 @@ public class IntroController {
@FXML
private void handleStartMessaging(ActionEvent event) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/org/to/telegramfinalproject/login_view.fxml"));
FXMLLoader loader = new FXMLLoader(getClass().getResource("/org/to/telegramfinalproject/Fxml/login_view.fxml"));
Scene loginScene = new Scene(loader.load());
// Get the current stage and its dimensions
@@ -0,0 +1,30 @@
package org.to.telegramfinalproject.UI;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import org.to.telegramfinalproject.Models.User;
public class MyProfileController {
@FXML private ImageView profileImage;
@FXML private Label displayName;
@FXML private Label status;
@FXML private Label bio;
@FXML private Label userId;
// public void initialize() {
// // Load data from your logged-in user object
// // Example:
// displayName.setText(CurrentUser.getName());
// status.setText(CurrentUser.isOnline() ? "online" : "offline");
// bio.setText(CurrentUser.getBio());
// userId.setText(CurrentUser.getUserId());
//
// if (CurrentUser.getProfileImagePath() != null) {
// profileImage.setImage(new Image(CurrentUser.getProfileImagePath()));
// }
// }
}
@@ -11,7 +11,7 @@ import java.io.IOException;
public class TelegramApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(TelegramApplication.class.getResource("/org/to/telegramfinalproject/sidebar_menu.fxml"));
FXMLLoader fxmlLoader = new FXMLLoader(TelegramApplication.class.getResource("/org/to/telegramfinalproject/Fxml/sidebar_menu.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 1480, 820);
scene.getStylesheets().add(getClass().getResource("/org/to/telegramfinalproject/CSS/light_theme.css").toExternalForm());
@@ -0,0 +1,26 @@
.my-profile-root {
-fx-background-color: white;
}
.profile-image {
-fx-clip-radius: 40; /* Rounded image */
}
.profile-name {
-fx-font-size: 18px;
-fx-font-weight: bold;
}
.profile-status {
-fx-text-fill: green;
-fx-font-size: 14px;
}
.field-label {
-fx-font-weight: bold;
-fx-text-fill: #333;
}
.field-value {
-fx-text-fill: #555;
}
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.text.Text?>
<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="org.to.telegramfinalproject.UI.MyProfileController"
prefWidth="400" prefHeight="600"
styleClass="my-profile-root">
<VBox spacing="15" padding="20">
<!-- Top Bar -->
<HBox alignment="CENTER_LEFT" spacing="10">
<ImageView fx:id="profileImage" fitHeight="80" fitWidth="80"
styleClass="profile-image"/>
<VBox>
<Label fx:id="displayName" text="Display Name" styleClass="profile-name"/>
<Label fx:id="status" text="online" styleClass="profile-status"/>
</VBox>
</HBox>
<Separator/>
<!-- Bio -->
<HBox spacing="10" alignment="CENTER_LEFT">
<Label text="Bio:" styleClass="field-label"/>
<Label fx:id="bio" text="This is the bio..." wrapText="true" styleClass="field-value"/>
</HBox>
<!-- User ID -->
<HBox spacing="10" alignment="CENTER_LEFT">
<Label text="User ID:" styleClass="field-label"/>
<Label fx:id="userId" text="@user_id" styleClass="field-value"/>
</HBox>
</VBox>
</AnchorPane>