Skip to content

It was the part of mine training (Internshala) Java App Development. which is the basic application that converts the temperature as per users choise ie from degree celsius into fahrenheit and vice versa .

Notifications You must be signed in to change notification settings

sonukushwaha403/temperature-converter-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

temperature-converter-tool

It was the part of mine training (Internshala) Java App Development. which is the basic application that converts the temperature as per users choise ie from degree celsius into fahrenheit and vice versa . package sample;

import javafx.application.Application; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.VBox; import javafx.stage.Stage; import java.util.Optional;

public class Main extends Application {

public static void main(String[] args) {
	launch(args);
}

@Override
public void start(Stage primaryStage) throws Exception {
	FXMLLoader loader = new
			FXMLLoader(getClass().getResource("sample.fxml"));
	VBox rootNode = loader.load();

	Scene scene = new Scene(rootNode);

	primaryStage.setScene(scene);
	primaryStage.setTitle("Temperature converter tool");
	MenuBar menuBar=createmenu();
	rootNode.getChildren().add(0,menuBar);
	primaryStage.show();
}

private MenuBar createmenu(){
	Menu filemenu=new Menu("File");
	MenuItem newMenuItems=new MenuItem("New");

	MenuItem exitMenuItems=new MenuItem("Exit");
	SeparatorMenuItem separatorMenuItems=new SeparatorMenuItem();
	filemenu.getItems().addAll(newMenuItems, separatorMenuItems,exitMenuItems);
	exitMenuItems.setOnAction(event ->{
		Platform.exit();
		System.exit(0);
	});
	newMenuItems.setOnAction(event ->System.out.println("new menu item is clicked"));



	Menu help=new Menu("Help");
	MenuItem about=new MenuItem("about developer");
	help.getItems().addAll(about);
	about.setOnAction(event -> aboutapp());

	MenuBar menuBar=new MenuBar();
	menuBar.getMenus().addAll(filemenu,help);
		return menuBar;
}

private void aboutapp() {
	Alert alertDialog=new Alert(Alert.AlertType.INFORMATION);
	alertDialog.setTitle("MY FIRST DESKTOP APP");
	alertDialog.setHeaderText("LEARNING JAVA FX");
	alertDialog.setContentText("(DEVELOPER---> SONU KUMAR KUSHWAHA)This Is My First Desktop Application ,As I Am A Beginner,Soon I Will Be An Expert In Java fx ");
	ButtonType yb=new ButtonType("YES");
	ButtonType nb=new ButtonType("NO");
	alertDialog.getButtonTypes().setAll(yb,nb);

		Optional<ButtonType> ClickedBtn=alertDialog.showAndWait();
	if(ClickedBtn.isPresent()  && ClickedBtn.get()==yb){
		System.out.println("yes button clicked");
	}else{
		System.out.println("no button clicked");
	}

}

}

About

It was the part of mine training (Internshala) Java App Development. which is the basic application that converts the temperature as per users choise ie from degree celsius into fahrenheit and vice versa .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published