首页 > 其他分享 >其他

其他

时间:2024-04-16 22:35:16浏览次数:26  
标签:String javafx FXML 其他 new import public

    <dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!-- 入口main方法所在的类 改成方法的类名 -->
<mainClass>Apps</mainClass>
</manifest>
</archive>
<descriptorRefs>
<!-- 全依赖jar包的后缀名 -->
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<!-- 添加此项后,可直接使用mvn package | mvn install -->
<executions>
<execution>
<id>make-assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>


package model;

import java.time.LocalDateTime;

public class Match {

/**
* 比赛时间
*/
private String matchDateTime;

/**
* 比赛时间
*/
private String matchName;

/**
* 主队
*/
private String homeTeam;

/**
* 客队
*/
private String awayTeam;

/**
* 让球
*/
private String handicap;

/**
* 大小球
*/
private String goals;

/**
* 角球
*/
private String corner;

/**
* 半场比分
*/
private String halfScore;

/**
* 全场比分
*/
private String fullScore;

/**
* 半场角球
*/
private String halfCorner;

/**
* 全场角球
*/
private String fullCorner;

public Match() {

}

public Match(String matchDateTime, String matchName, String homeTeam, String awayTeam, String handicap, String goals, String corner,
String halfScore, String fullScore, String halfCorner, String fullCorner) {
this.matchDateTime = matchDateTime;
this.matchName = matchName;
this.homeTeam = homeTeam;
this.awayTeam = awayTeam;
this.handicap = handicap;
this.goals = goals;
this.corner = corner;
this.halfScore = halfScore;
this.fullScore = fullScore;
this.halfCorner = halfCorner;
this.fullCorner = fullCorner;
}

public String getMatchDateTime() {
return matchDateTime;
}

public void setMatchDateTime(String matchDateTime) {
this.matchDateTime = matchDateTime;
}

public String getMatchName() {
return matchName;
}

public void setMatchName(String matchName) {
this.matchName = matchName;
}

public String getHomeTeam() {
return homeTeam;
}

public void setHomeTeam(String homeTeam) {
this.homeTeam = homeTeam;
}

public String getAwayTeam() {
return awayTeam;
}

public void setAwayTeam(String awayTeam) {
this.awayTeam = awayTeam;
}

public String getHandicap() {
return handicap;
}

public void setHandicap(String handicap) {
this.handicap = handicap;
}

public String getGoals() {
return goals;
}

public void setGoals(String goals) {
this.goals = goals;
}

public String getCorner() {
return corner;
}

public void setCorner(String corner) {
this.corner = corner;
}

public String getHalfScore() {
return halfScore;
}

public void setHalfScore(String halfScore) {
this.halfScore = halfScore;
}

public String getFullScore() {
return fullScore;
}

public void setFullScore(String fullScore) {
this.fullScore = fullScore;
}

public String getHalfCorner() {
return halfCorner;
}

public void setHalfCorner(String halfCorner) {
this.halfCorner = halfCorner;
}

public String getFullCorner() {
return fullCorner;
}

public void setFullCorner(String fullCorner) {
this.fullCorner = fullCorner;
}
}



import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.fxml.FXMLLoader;

/**
* javafx程序有三层,最外面的是Stage层,一个Stage就是一个独立的窗口。
* 在往里是Scene层,一个Scene就是一个窗口内部的一个状态。
* 在往里就是一个一个的node节点,节点可以是按钮、标签、文本等组件、
*/
public class IndexApp extends Application {

@Override
public void start(Stage primaryStage) throws Exception {
// 设置窗口最大化
//primaryStage.setMaximized(true);
// 加载视图文件
FXMLLoader loader = new FXMLLoader(getClass().getResource("index.fxml"));
Scene scene = new Scene(loader.load());
primaryStage.setTitle("fxml窗体");
primaryStage.setScene(scene);
primaryStage.show();
}
}





package indexForm;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.event.ActionEvent;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import model.Match;
import services.IndexServices;

import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;

public class IndexController implements Initializable {

private IndexServices services = new IndexServices();

@FXML
public HBox topHBox;

@FXML
public HBox bottomHBox;

@FXML
public VBox vBox;

@FXML
public Label label;

@FXML
public TextField txField;

@FXML
public Button searchButton;

@FXML
public Button exportButton;

@FXML
public TableView tableView;

@FXML
public TableColumn matchDateTime;

@FXML
public TableColumn matchName;

@FXML
public TableColumn homeTeam;

@FXML
public TableColumn awayTeam;

@FXML
public TableColumn handicap;

@FXML
public TableColumn goals;

@FXML
public TableColumn corner;

@FXML
public TableColumn halfScore;

@FXML
public TableColumn fullScore;

@FXML
public TableColumn halfCorner;

@FXML
public TableColumn fullCorner;


@FXML
public void searchHandle(ActionEvent e) throws IOException {

/* Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("警告");
alert.setHeaderText(null);
alert.setContentText(txField.getText());
alert.showAndWait();*/
/**初始化tableview数据*/
tableView.getItems().setAll(services.readerExcel());
}

@FXML
public void exportHandle(ActionEvent e) throws IOException {
List<Match> list = services.getMatchInfo(txField.getText());
/**导出Excel*/
services.exportExcel(list);
}

@Override
public void initialize(URL location, ResourceBundle resources) {
/**初始化button样式*/
searchButton.setFont(Font.font("Microsoft YaHei", 18));

/**初始化TableColumn, 绑定对象属性*/
matchDateTime.setCellValueFactory(new PropertyValueFactory<Match, String>("matchDateTime"));
matchName.setCellValueFactory(new PropertyValueFactory<Match, String>("matchName"));
homeTeam.setCellValueFactory(new PropertyValueFactory<Match, String>("homeTeam"));
homeTeam.setCellValueFactory(new PropertyValueFactory<Match, String>("homeTeam"));
awayTeam.setCellValueFactory(new PropertyValueFactory<Match, String>("awayTeam"));
handicap.setCellValueFactory(new PropertyValueFactory<Match, String>("handicap"));
goals.setCellValueFactory(new PropertyValueFactory<Match, String>("goals"));
corner.setCellValueFactory(new PropertyValueFactory<Match, String>("corner"));
halfScore.setCellValueFactory(new PropertyValueFactory<Match, String>("halfScore"));
fullScore.setCellValueFactory(new PropertyValueFactory<Match, String>("fullScore"));
halfCorner.setCellValueFactory(new PropertyValueFactory<Match, String>("halfCorner"));
fullCorner.setCellValueFactory(new PropertyValueFactory<Match, String>("fullCorner"));
}
}



<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TableColumn?>
<VBox fx:id="vBox" xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="indexForm.IndexController" prefWidth="1480" prefHeight="960" spacing="50">
<HBox fx:id="topHBox">
<children>
<TextField fx:id="txField" prefWidth="800.0" prefHeight="45.0">
<HBox.margin>
<Insets top="50" left="260.0" bottom="0" right="0" />
</HBox.margin>
</TextField>
<Button fx:id="searchButton" text="搜索" onAction="#searchHandle" prefWidth="80.0" prefHeight="45.0" >
<HBox.margin>
<Insets top="50" left="0.0" bottom="0" right="0" />
</HBox.margin>
</Button>
<Button fx:id="exportButton" text="导出" onAction="#exportHandle" prefWidth="80.0" prefHeight="45.0" >
<HBox.margin>
<Insets top="50" left="0.0" bottom="0" right="0" />
</HBox.margin>
</Button>
</children>
</HBox>
<HBox fx:id="bottomHBox" alignment="CENTER"> <!--水平居中-->
<TableView fx:id="tableView" HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets top="10.0" left="10.0" bottom="10.0" right="10.0" />
</HBox.margin>
<columns>
<TableColumn fx:id="matchDateTime" style="-fx-alignment: CENTER;-fx-font-family:'Consolas'; -fx-font-size:15;" prefWidth="180.0" sortable="false" text="比赛时间" />
<TableColumn fx:id="matchName" style="-fx-alignment: CENTER;-fx-font-family:'Consolas'; -fx-font-size:15;" prefWidth="80.0" sortable="false" text="赛事" />
<TableColumn fx:id="homeTeam" style="-fx-alignment: CENTER;-fx-font-family:'Consolas'; -fx-font-size:15;" prefWidth="120.0" sortable="false" text="主队" />
<TableColumn fx:id="awayTeam" style="-fx-alignment: CENTER;-fx-font-family:'Consolas'; -fx-font-size:15;" prefWidth="120.0" sortable="false" text="客队" />
<TableColumn fx:id="handicap" style="-fx-alignment: CENTER;-fx-font-family:'Consolas';-fx-font-size:15;" prefWidth="180.0" sortable="false" text="主队 让球 客队" />
<TableColumn fx:id="goals" style="-fx-alignment: CENTER;-fx-font-family:'Consolas';-fx-font-size:15;" prefWidth="180.0" sortable="false" text="高于 大小球 低于" />
<TableColumn fx:id="corner" style="-fx-alignment: CENTER;-fx-font-family:'Consolas';-fx-font-size:15;" prefWidth="180.0" sortable="false" text="高于 角球 低于" />
<TableColumn fx:id="halfScore" style="-fx-alignment: CENTER;-fx-font-family:'Consolas';-fx-font-size:15;" prefWidth="100.0" sortable="false" text="半场比分" />
<TableColumn fx:id="fullScore" style="-fx-alignment: CENTER;-fx-font-family:'Consolas';-fx-font-size:15;" prefWidth="100.0" sortable="false" text="全场比分" />
<TableColumn fx:id="halfCorner" style="-fx-alignment: CENTER;-fx-font-family:'Consolas';-fx-font-size:15;" prefWidth="100.0" sortable="false" text="半场角" />
<TableColumn fx:id="fullCorner" style="-fx-alignment: CENTER;-fx-font-family:'Consolas';-fx-font-size:15;" prefWidth="100.0" sortable="false" text="全场角" />
</columns>
</TableView>
</HBox>
</VBox>

















标签:String,javafx,FXML,其他,new,import,public
From: https://www.cnblogs.com/michaelShao/p/18139429

相关文章

  • T-SQL——关于求百分比(以及其他语言转百分比)
    目录1.SQL取百分比2.C#取百分比3.JS取百分比shanzm-2024-4-1621:21:451.SQL取百分比示例0:求1/3后取百分比,保留两位小数SELECTCAST(CAST(1*1.0*100/3ASDECIMAL(10,2))ASVARCHAR(50))+'%';--SqlServer2012版本之后:SELECTFORMAT(1*1.0/3,'P')Result;---33......
  • 开启网络共享,局域网内其他设备找不到本设备
    1.高级共享设置开启所有网络的文件共享和发现2.WIN+Rservices.msc进入服务管理 3.找到服务“FunctionDiscoveryResourcePublication4.服务启动 5.网络发现右键刷新,设备出现 ......
  • 前端学习-vue视频学习015-其他API
    尚硅谷视频教程shallowRefshallowReactive浅层次的响应式数据(仅第一层)shallowRef:只能整体修改person.value可以修改,但是person.value.name无法修改shallowReactive:只能修改对象的第一层数据car.brand可以修改,但是car.options.color无法修改主要用处在于:如果数据量非常......
  • Element-plus与其他UI库混用
    原来项目用的是vue3+vite4+vuexy的,vuexy是国外的一个看上去很漂亮的组件库,项目在开发了一段时间后发现vuexy组件库里的表格、日期等组件很难用,但尴尬的是此时项目已经开发了一半,不方便整体更换UI库。寻思可否把Element-plus里好用的组件筛选出来引入到项目里,让她们和正房vuex......
  • VisualSVN 迁移仓库到其他盘
    要将VisualSVN仓库迁移到其他盘,可以按照以下步骤进行操作:停止VisualSVN服务:打开Windows服务管理器(services.msc),找到"VisualSVNServer",右键点击并选择"停止"。备份仓库:在旧的仓库所在盘中创建一个备份文件夹,将整个仓库文件夹复制到备份文件夹中。确保备份过程完整,并且没有......
  • 为什么C++中不能将数组的内容拷贝给其他数组作为初始值,也不能用数组给其他数组赋值
    0前言来自primer的3.5部分以下写法是有问题的inta[]={0,1,2}inta2[]=a;//错误,不允许使用一个数组初始化另一个数组a2=a;//错误:不能把一个数组赋值给另一个数组有些编译器支持上面的操作,但是书上说这属于非标准功能,是编译器扩展1原因C++中的数组......
  • VOL框架 其他页面调用GetPageData的实现方法
    VOL框架其他页面调用GetPageData的实现方法例如:B页面访问A页面的GetPageData实现思路:1、A后端新建一个Controller,通过这个Controller调用A的service的GetPageData   注意 HttpPost参数要加上 [FromBody][HttpPost,Route("getSubList"),AllowAnonymous]......
  • #小白学Go-01# 学完Go指南感受,对比一下Go与其他语言
    本人以前是C/C++和Python选手,因为以后的工作需要用到Go,所以只好从零开始学习Go。本篇记录一下刚看完Go指南的感受,可能理解还不到位。总体感受学完Go指南给我最大的感觉就是,在变量定义方面很像Pascal,在函数、结构体、方法方面很像C,虽然没有C++中类的概念,但是通过方法可以实现类似......
  • 双摆及其他:从多臂摆研究混沌
    目录一、说明二、钟摆物理方程三、无法确定解的混沌方程四、计算机模拟一、说明        关于混沌如何实现?能否用计算机模拟?本文从简单的物理道具:双臂摆的物理方程,引进混沌理念。进而进行复杂的自然状态中。本文只是研究题目的引出,日后如......
  • intellij idea 使用git的 cherry pick 摘取其他分支的comment
    cherrypick摘取其他分支的comment如果想把feature_v1.0分支的comment摘到feature_v1.0_new分支上,先切换到feature_v1.0_new分支,这一步不能少了。然后点击下面菜单栏的git,点击LocalChanges旁边的Log,这时能看到local和remote的分支,点击feature_v1.0分支。从featur......