zoukankan      html  css  js  c++  java
  • Java实验九第一题

    不废话,直接上代码~

     1 package 集合与映射表;
     2 
     3 import java.util.TreeSet;
     4 import javafx.application.Application;
     5 import javafx.geometry.Pos;
     6 import javafx.scene.Scene;
     7 import javafx.scene.control.Button;
     8 import javafx.scene.layout.BorderPane;
     9 import javafx.scene.layout.FlowPane;
    10 import javafx.scene.paint.Color;
    11 import javafx.scene.shape.Circle;
    12 import javafx.stage.Stage;
    13 
    14 /**
    15  * 首先移除最大的球
    16  * @author AngoLi
    17  */
    18 public class Exercise20_09 extends Application{
    19     @Override
    20     public void start(Stage stage){
    21         TreeSet<Double> ts = new TreeSet<>();
    22         
    23         FlowPane fp = new FlowPane();
    24         BorderPane bp = new BorderPane();
    25         Button bt = new Button("—");
    26         
    27         Circle[] circle = new Circle[20];
    28         
    29         for(int i = 0; i < circle.length; i++){
    30             circle[i] = new Circle(Math.random()*18+2);
    31             circle[i].setFill(Color.CORAL); 
    32             ts.add(circle[i].getRadius());
    33             fp.getChildren().add(circle[i]);
    34         }
    35         
    36         bp.setCenter(fp);
    37         bp.setBottom(bt); 
    38         
    39         Scene scene = new Scene(bp, 500,300);
    40         
    41         stage.setTitle("Exercise20_09");
    42         stage.setScene(scene);
    43         stage.show();
    44         
    45         bt.setOnMouseClicked(e->{
    46             // ts.last()
    47             for(int j = 0; j < circle.length; j++){
    48                 if(circle[j].getRadius()==ts.last()){
    49                     fp.getChildren().remove(circle[j]);
    50                 }
    51             }  
    52         });   
    53     }
    54     public static void main(String[] args){
    55         Application.launch(args); 
    56     }
    57 }
    爱我没结果!
  • 相关阅读:
    相机标定 和 单应性矩阵H
    全景视频拼接关键技术
    OpenCV图像变换(仿射变换与透视变换)
    用非数学语言讲解贝叶斯定理
    (二)SMO算法
    (一)SVM原理
    什么是赋范线性空间、内积空间,度量空间,希尔伯特空间
    决策树算法(五)——处理一些特殊的分类
    V8学习资源
    perforce 学习资源
  • 原文地址:https://www.cnblogs.com/angoli/p/12879784.html
Copyright © 2011-2022 走看看