Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
添加捐赠按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
Civitasv committed Mar 17, 2022
1 parent 9112482 commit 59da674
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/main/java/com/civitasv/spider/controller/DonateController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.civitasv.spider.controller;

import com.civitasv.spider.MainApplication;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;

import java.io.IOException;

public class DonateController {
public ImageView about;

public void show() throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("donate.fxml"));
Parent root = fxmlLoader.load();
DonateController controller = fxmlLoader.getController();
controller.init();
Stage stage = new Stage();
stage.setResizable(false);
stage.setTitle("捐赠");
Scene scene = new Scene(root);
scene.getStylesheets().add(MainApplication.class.getResource("styles.css").toString());
stage.setScene(scene);
stage.getIcons().add(new Image(MainApplication.class.getResourceAsStream("icon/icon.png")));
stage.show();
}

private void init() {
Image image = new Image(MainApplication.class.getResourceAsStream("icon/zhifubao.jpg"));
about.setImage(image);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ public void openAbout(boolean isQQ) throws IOException {
controller.show(isQQ);
}

public void openDonate() throws IOException {
DonateController controller = new DonateController();
controller.show();
}

public void starsMe() throws URISyntaxException, IOException {
Desktop.getDesktop().browse(new URI("https://github.com/Civitasv/AMapPoi"));
}
Expand Down
17 changes: 17 additions & 0 deletions src/main/resources/com/civitasv/spider/donate.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>

<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" styleClass="main"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.civitasv.spider.controller.DonateController">

<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
</padding>


<ImageView fx:id="about" fitHeight="300" fitWidth="300.0" pickOnBounds="true" preserveRatio="true"/>
</VBox>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/resources/com/civitasv/spider/poi.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<MenuItem fx:id="joinQQ" mnemonicParsing="false" text="加入用户群" />
<MenuItem fx:id="wechat" mnemonicParsing="false" text="关注公众号" />
<MenuItem mnemonicParsing="false" onAction="#starsMe" text="star支持" />
<MenuItem mnemonicParsing="false" onAction="#openDonate" text="捐赠" />
</Menu>
</MenuBar>
<ScrollPane styleClass="main">
Expand Down

0 comments on commit 59da674

Please sign in to comment.