Guruh talabasi Ergashev Abduvohid 1-amaliy ish
Download 195.67 Kb.
|
1-dttl
Dastur kodi
package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override
primaryStage.setScene(new Scene(root)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } package sample; import javafx.event.ActionEvent;
import java.net.URL; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.ResourceBundle; import java.util.function.Function; import static java.util.Arrays.sort; public class Controller implements Initializable {
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
private MyGraph mathsGraph; private MyGraph areaMathsGraph; @FXML
lineGraph.setVisible(true); areaGraph.setVisible(false); } @FXML
areaGraph.setVisible(true); lineGraph.setVisible(false); } @FXML
plotLine(x -> x); } private void plotLine(Function if (lineGraph.isVisible()) { mathsGraph.plotLine(function); } else { areaMathsGraph.plotLine(function); } } @FXML
plotLine(x -> x - 3); } @FXML
plotLine(x -> Math.pow(x, 2)); } @FXML
plotLine(x -> 3*x*(x*x+3.5)+Math.log(x)); } @FXML
plotLine(x -> -3*Math.pow(x, 2)); } @FXML
plotLine(x -> Math.pow(x - 3, 3) - 1); } @FXML
clear(); } private void clear() { if (lineGraph.isVisible()) { mathsGraph.clear(); } else { areaMathsGraph.clear(); } } @Override public void initialize(URL location, ResourceBundle resources) { mathsGraph = new MyGraph(lineGraph, 10); areaMathsGraph = new MyGraph(areaGraph, 10); }
package sample; import javafx.scene.chart.XYChart; import java.util.function.Function; public class MyGraph { private XYChart private double range; public MyGraph(final XYChart this.graph = graph; this.range = range; } public void plotLine(final Function final XYChart.Series for (double x = -range; x <= range; x = x + 0.01) { plotPoint(x, function.apply(x), series); } graph.getData().add(series); } private void plotPoint(final double x, final double y, final XYChart.Series series.getData().add(new XYChart.Data } public void clear() { graph.getData().clear(); } } #pane, .root, .split-pane{ -fx-background-color: #353434; -fx-foreground-color: #353434; } .default-color0.chart-series-line { -fx-stroke: #2c2e4e; } .chart-vertical-zero-line {
.chart-plot-background { -fx-background-color: #575758; -fx-foreground-color: white; -fx-stroke: white; } .chart-vertical-grid-lines { -fx-stroke: #898887; } .chart-horizontal-grid-lines { -fx-stroke: #898887; } .chart-alternative-row-fill { -fx-fill: transparent; -fx-stroke: transparent; -fx-stroke-width: 0; } .axis {
-fx-fill: white; -fx-font-size: 1.4em; -fx-tick-label-fill: white; -fx-font-family: Tahoma; -fx-tick-length: 0; -fx-minor-tick-length: 0; } .background { -fx-background-color: #674A44; -fx-foreground-color: #353434; } .button { -fx-padding: 5 22 5 22; -fx-border-color: #353434; -fx-border-width: 0; -fx-background-radius: 0; -fx-background-color: derive(#353434,20%); -fx-font-family: "Segoe UI", Helvetica, Arial, sans-serif; -fx-font-size: 11pt; -fx-text-fill: #d8d8d8; -fx-background-insets: 0 0 0 0, 0, 1, 2; } .button:hover { -fx-background-color: #3a3a3a; } .button:pressed, .button:default:hover:pressed { -fx-background-color: #bdbcbc; -fx-text-fill: black; } .button:disabled, .button:default:disabled { -fx-opacity: 0.4; -fx-background-color: #353434; -fx-text-fill: white; } .button:default { -fx-background-color: -fx-focus-color; -fx-text-fill: #ffffff; } .button:default:hover { -fx-background-color: derive(-fx-focus-color,30%); } .text-area .content { -fx-background-color: #575758; } Download 195.67 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling