Code Monkey home page Code Monkey logo

project's Introduction

⭐STUDENT REGISTRATION

⚠️JAVA, JAVAFX LIBRARY, FXML and MYSQL

Untitled

⚠️PROBLEMS

1→ SQL erişilememesi

Maven archetype lı projede javafx kullanıp sonrasında sql eklemek istediğimde problem aldım. Çözüm

STEP 1- module-info.java ya requires java.sql;

module com.example.sjsj {
    requires javafx.controls;
    requires javafx.fxml;
    requires java.sql;

    opens com.example.sjsj to javafx.fxml;
    exports com.example.sjsj;
}

STEP 2- OPEN MODULE SETTINGS → MODULES → ADD JARs or DIRECTORIES → Add MySQL java connector jar

Untitled

Untitled

STEP 3- IMPORT JAVA SQL TO OUR CLASS THAT MAKES CONNECTION BETWEEN PROJECT AND DATABASE

import java.sql.*;

public class makeConnectionClass{...}

PROBLEM -2 (TABLEVIEW KULLANIMI)

ListView kullanımında columnlar birbirinden bağımsız oldukları için görüntü olarak iyi bir biçimde değildi(Slider geldiğinde özellikle). Bunun için listView yerine tableView kullanılması gerekli.

TableView kullanımı için

1→ FXML tasarım ve sütunlara ID ler verilir.

2→ Controller içerisinde dimension <> içerisinde tableView ve tableColumnlar tanımlanır

@FXML
private TableView<Student> tableView
@FXML
private TableColumn <Student,String> secondColumn,thirdColumn,fourthColumn

3 → Initializable Interface i implement edilir ve metod içerisinde ObservableList kullanılarak Student classından nesneler depolanır.

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
ObservableList<Student> students = FXCollections.observableArrayList(
		new Student(1,"MAHMUT","CELIK","JAVA"),
		new Student(1,"MAHMUT","CELIK","JAVA"),
    new Student(1,"MAHMUT","CELIK","JAVA"),
    new Student(1,"MAHMUT","CELIK","JAVA"),
    new Student(1,"MAHMUT","CELIK","JAVA"),
    new Student(1,"MAHMUT","CELIK","JAVA"));
}

4→ Her column un Student classından hangi field ları alacakları setCellValueProperty(…) metoduyla belirlenir.

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
    firstColumn.setCellValueFactory(new PropertyValueFactory<Student,Integer>("studentID"));
    secondColumn.setCellValueFactory(new PropertyValueFactory<Student,String>("studentName"));
    thirdColumn.setCellValueFactory(new PropertyValueFactory<Student,String>("studentMobileNumber"));
    fourthColumn.setCellValueFactory(new PropertyValueFactory<Student,String>("studentCourseName"));

    tableView.setItems(students);

}

//FIRSTCOLUMN , GELEN OBS.LIST ICERISINDEKI STUDENTLARDAN "studentID" FIELD INI GOSTERECEK
//...
package com.example.dsdsds;

public class Student {
    public int studentID;
    public String studentName;
    public String studentMobileNumber;
    public String studentCourseName;

    public Student(int studentID, String studentName, String studentMobileNumber, String studentCourseName) {
        this.studentID = studentID;
        this.studentName = studentName;
        this.studentMobileNumber = studentMobileNumber;
        this.studentCourseName = studentCourseName;
    }

    public int getStudentID() {
        return studentID;
    }

    public String getStudentName() {
        return studentName;
    }

    public String getStudentMobileNumber() {
        return studentMobileNumber;
    }

    public String getStudentCourseName() {
        return studentCourseName;
    }
}

This is an image

project's People

Contributors

mahmutcelik0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.