Browse Source

new constructor for UIROMDataType

pull/7/head
Jannik 3 years ago
parent
commit
3f69169a6a
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 47
      src/main/java/com/cemu_UI/application/MainWindowController.java
  2. 12
      src/main/java/com/cemu_UI/datatypes/UIROMDataType.java

47
src/main/java/com/cemu_UI/application/MainWindowController.java

@ -1023,14 +1023,8 @@ public class MainWindowController {
* @param titleID : game ID
*/
public void addGame(String title, String coverPath, String romPath, String titleID){
Image coverImage = new Image(new File(coverPath).toURI().toString());
UIROMDataType uiROMElement = new UIROMDataType();
UIROMDataType uiROMElement = new UIROMDataType(title, coverPath, gameContextMenu);
generatePosition();
uiROMElement.getLabel().setText(title);
uiROMElement.getImageView().setImage(coverImage);
uiROMElement.getButton().setContextMenu(gameContextMenu);
uiROMElement.getButton().addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
@ -1131,25 +1125,25 @@ public class MainWindowController {
thread.start();
}
//remove all games from gamesAnchorPane and add them afterwards
public void refreshUIData() {
//remove all games form gamesAnchorPane
gamesAnchorPane.getChildren().clear();
//reset position
xPos = -200;
yPos = 17;
xNextElement = 0;
//add all games to gamesAnchorPane (UI)
for(UIROMDataType game : games) {
generatePosition();
game.setLayoutX(xPos);
game.setLayoutY(yPos);
// remove all games from gamesAnchorPane and add them afterwards
public void refreshUIData() {
// remove all games form gamesAnchorPane
gamesAnchorPane.getChildren().clear();
// reset position
xPos = -200;
yPos = 17;
xNextElement = 0;
// add all games to gamesAnchorPane (UI)
for (UIROMDataType game : games) {
generatePosition();
game.setLayoutX(xPos);
game.setLayoutY(yPos);
gamesAnchorPane.getChildren().add(game);
}
}
}
}
// set the selected local strings to all needed elements
void setUILanguage(){
@ -1353,8 +1347,7 @@ public class MainWindowController {
*/
private void generatePosition() {
int xMaxElements = (int) Math.floor((mainAnchorPane.getWidth() - 36) / 217);
System.out.println(xMaxElements);
if(xNextElement >= xMaxElements){
oldXNextElement = xNextElement;
xPos = 17;

12
src/main/java/com/cemu_UI/datatypes/UIROMDataType.java

@ -20,10 +20,14 @@
*/
package com.cemu_UI.datatypes;
import java.io.File;
import com.jfoenix.controls.JFXButton;
import javafx.geometry.Insets;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
@ -37,6 +41,14 @@ public class UIROMDataType extends VBox {
private JFXButton button = new JFXButton();
private ImageView imageView = new ImageView();
public UIROMDataType(String text, String coverPath, ContextMenu contextMenu) {
this();
label.setText(text);
imageView.setImage(new Image(new File(coverPath).toURI().toString()));
button.setContextMenu(contextMenu);
}
public UIROMDataType() {
super.getChildren().addAll(label, button);

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close