Переход с 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 -->
|
<!-- Default configuration for running with: mvn clean javafx:run -->
|
||||||
<id>default-cli</id>
|
<id>default-cli</id>
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>kvr.missilecruiser_hard/kvr.missilecruiser_hard.ApplicationMissileCruiser</mainClass>
|
<mainClass>kvr.missilecruiser_hard/kvr.missilecruiser_hard.Main</mainClass>
|
||||||
<launcher>app</launcher>
|
<launcher>app</launcher>
|
||||||
<jlinkZipName>app</jlinkZipName>
|
<jlinkZipName>app</jlinkZipName>
|
||||||
<jlinkImageName>app</jlinkImageName>
|
<jlinkImageName>app</jlinkImageName>
|
||||||
|
@ -3,20 +3,25 @@ package kvr.missilecruiser_hard;
|
|||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.SceneAntialiasing;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ApplicationMissileCruiser extends Application {
|
public class ApplicationMissileCruiser extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws IOException {
|
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);
|
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.setTitle("Ракетный крейсер");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(false);
|
|
||||||
|
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package kvr.missilecruiser_hard;
|
|||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class ControllerMissileCruiser
|
public class ControllerMissileCruiser
|
||||||
{
|
{
|
||||||
@FXML
|
@FXML
|
||||||
@ -11,6 +13,6 @@ public class ControllerMissileCruiser
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
protected void buttonsMove_Click() {
|
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) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
if (args.length > 0 && args[0].equals("-disable_hidpi")) {
|
if (args.length > 0 && args[0].equals("-disable_hidpi")) {
|
||||||
System.setProperty("prism.allowhidpi", "false");
|
//System.setProperty("prism.allowhidpi", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationMissileCruiser.run(args);
|
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.layout.AnchorPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?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">
|
<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 layoutX="14.0" layoutY="457.0" mnemonicParsing="false" onAction="#buttonCreate_Click" prefHeight="30.0" prefWidth="98.0" text="Создать">
|
<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>
|
||||||
<Font size="14.0" />
|
<Font size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</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>
|
</AnchorPane>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user