Переход с inline style на css привязанном к Anchorpane
This commit is contained in:
parent
64d698b9ed
commit
ea9980c65a
2
pom.xml
2
pom.xml
@ -75,7 +75,7 @@
|
||||
<!-- Default configuration for running with: mvn clean javafx:run -->
|
||||
<id>default-cli</id>
|
||||
<configuration>
|
||||
<mainClass>kvr.missilecruiser_hard/kvr.missilecruiser_hard.ApplicationMissileCruiser</mainClass>
|
||||
<mainClass>kvr.missilecruiser_hard/kvr.missilecruiser_hard.Main</mainClass>
|
||||
<launcher>app</launcher>
|
||||
<jlinkZipName>app</jlinkZipName>
|
||||
<jlinkImageName>app</jlinkImageName>
|
||||
|
@ -3,20 +3,25 @@ package kvr.missilecruiser_hard;
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.SceneAntialiasing;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ApplicationMissileCruiser extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(ApplicationMissileCruiser.class.getResource("images/ViewMissileCruiser.fxml"));
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ViewMissileCruiser.fxml"));
|
||||
|
||||
Scene scene = new Scene(fxmlLoader.load(), 900, 500);
|
||||
|
||||
//String stylesheet = Objects.requireNonNull(getClass().getResource("StylesMissileCruiser.css")).toExternalForm();
|
||||
//scene.getStylesheets().add(stylesheet);
|
||||
|
||||
stage.setResizable(false);
|
||||
stage.setTitle("Ракетный крейсер");
|
||||
stage.setScene(scene);
|
||||
stage.setResizable(false);
|
||||
|
||||
stage.show();
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package kvr.missilecruiser_hard;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ControllerMissileCruiser
|
||||
{
|
||||
@FXML
|
||||
@ -11,6 +13,6 @@ public class ControllerMissileCruiser
|
||||
|
||||
@FXML
|
||||
protected void buttonsMove_Click() {
|
||||
|
||||
System.out.println(System.getProperty("java.class.path"));
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
if (args.length > 0 && args[0].equals("-disable_hidpi")) {
|
||||
System.setProperty("prism.allowhidpi", "false");
|
||||
//System.setProperty("prism.allowhidpi", "false");
|
||||
}
|
||||
|
||||
ApplicationMissileCruiser.run(args);
|
||||
|
@ -0,0 +1,31 @@
|
||||
#buttonLeft
|
||||
{
|
||||
-fx-background-image: url("images/arrowLeft.png");
|
||||
-fx-background-size: 85%;
|
||||
-fx-background-position: center;
|
||||
-fx-background-repeat: space;
|
||||
}
|
||||
|
||||
#buttonUp
|
||||
{
|
||||
-fx-background-image: url("images/arrowUp.png");
|
||||
-fx-background-size: 85%;
|
||||
-fx-background-position: center;
|
||||
-fx-background-repeat: space;
|
||||
}
|
||||
|
||||
#buttonDown
|
||||
{
|
||||
-fx-background-image: url("images/arrowDown.png");
|
||||
-fx-background-size: 85%;
|
||||
-fx-background-position: center;
|
||||
-fx-background-repeat: space;
|
||||
}
|
||||
|
||||
#buttonRight
|
||||
{
|
||||
-fx-background-image: url("images/arrowRight.png");
|
||||
-fx-background-size: 85%;
|
||||
-fx-background-position: center;
|
||||
-fx-background-repeat: space;
|
||||
}
|
@ -4,11 +4,14 @@
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/null" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kvr.missilecruiser_hard.ControllerMissileCruiser">
|
||||
<Button layoutX="14.0" layoutY="457.0" mnemonicParsing="false" onAction="#buttonCreate_Click" prefHeight="30.0" prefWidth="98.0" text="Создать">
|
||||
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="500.0" minWidth="900.0" stylesheets="@StylesMissileCruiser.css" xmlns="http://javafx.com/javafx/null" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kvr.missilecruiser_hard.ControllerMissileCruiser">
|
||||
<Button id="buttonCreate" layoutX="14.0" layoutY="455.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="30.0" minWidth="100.0" mnemonicParsing="false" onAction="#buttonCreate_Click" text="Создать" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0">
|
||||
<font>
|
||||
<Font size="14.0" />
|
||||
</font>
|
||||
</Button>
|
||||
<Button layoutX="846.0" layoutY="446.0" mnemonicParsing="false" onAction="#buttonsMove_Click" prefHeight="40.0" prefWidth="40.0" style="-fx-background-image: url("kvr.missilecruiser_hard/arrowRight.png"); -fx-background-size: 85%; -fx-background-position: center; -fx-background-repeat: space;" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
|
||||
<Button id="buttonRight" layoutX="846.0" layoutY="446.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
|
||||
<Button id="buttonDown" layoutX="800.0" layoutY="446.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="60.0" />
|
||||
<Button id="buttonLeft" layoutX="754.0" layoutY="446.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="106.0" />
|
||||
<Button id="buttonUp" layoutX="800.0" layoutY="399.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="40.0" minWidth="40.0" mnemonicParsing="false" onAction="#buttonsMove_Click" AnchorPane.bottomAnchor="60.0" AnchorPane.rightAnchor="60.0" />
|
||||
</AnchorPane>
|
||||
|
Loading…
x
Reference in New Issue
Block a user