NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

MAİN.JAVA İÇİNDEKİLER
***********************************************
package sample;

import javafx.application.Application;


import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import static javafx.fxml.FXMLLoader.load;


public class Main extends Application {

@Override
public void start(Stage primaryStage) throws Exception {
Parent root = load(getClass().getResource("View.fxml"));
primaryStage.setTitle("Hesap Makinesi");
primaryStage.setScene(new Scene(root));
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}
}
**************************************************
Controller.java içindekiler
***************************************************
package sample;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;


public class Controller {


@FXML
private TextField num1Field;

@FXML
private TextField num2Field;

@FXML
private TextField resultField1;
private int num1;
private int num2;
private int result;
private Model model=new Model();
@FXML
void addClick() {
num1=Integer.parseInt(num1Field.getText());
num2=Integer.parseInt(num2Field.getText());
result=model.calculate(num1,num2,'+');
resultField1.setText(String.valueOf(result));
}

@FXML
void subClick() {
num1=Integer.parseInt(num1Field.getText());
num2=Integer.parseInt(num2Field.getText());
result=model.calculate(num1,num2,'-');
resultField1.setText(String.valueOf(result));
}



}
**************************************************
Model.java içindekiler
****************************************************
package sample;

public class Model {
public int calculate(int num1,int num2,char operator){
switch (operator){
case '+':
return num1+num2;
case '-':
return num1-num2;

}
return 0;
}
}
**************************************************
View.fxml içindekiler
**************************************************
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="sample.Controller">
<children>
<TextField fx:id="num1Field" layoutX="200.0" layoutY="78.0" prefWidth="200.0" promptText="İlk Sayı" />
<TextField fx:id="num2Field" layoutX="200.0" layoutY="115.0" prefWidth="200.0" promptText="İkinci Sayı" />
<Button layoutX="272.0" layoutY="150.0" mnemonicParsing="false" onAction="#addClick" text="Topla" />
<Button layoutX="272.0" layoutY="200.0" mnemonicParsing="false" onAction="#subClick" text="Çıkar" />
<TextField fx:id="resultField1" layoutX="200.0" layoutY="258.0" prefWidth="200.0" />
<Label layoutX="286.0" layoutY="242.0" text="Sonuç" />
</children>
</AnchorPane>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.