Mavzu: Dasturiy ta’minotni loyihalash va dizayn jarayonini hamda uning ma’lumotlar bazasi qismini dasturiy ta’minot standartlariga ko’ra tayyorlash


import com.jfoenix.controls.JFXPasswordField; import


Download 1.46 Mb.
bet9/9
Sana02.01.2022
Hajmi1.46 Mb.
#191718
1   2   3   4   5   6   7   8   9
Bog'liq
651-17-7-Otajonov-Abduqahhor

import com.jfoenix.controls.JFXPasswordField;
import com.jfoenix.controls.JFXTextField;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import sample.DataAccsesObject.DataAccsesObject;

import java.io.IOException;
public class Controller {
double x=0,y=0;
DataAccsesObject dao;
String sql;
@FXML
private JFXTextField txt_login;
@FXML
private JFXPasswordField txt_parol;
@FXML
void Kirish(ActionEvent event) throws IOException {
if (!txt_login.getText().isEmpty()&&!txt_parol.getText().isEmpty()){
sql="SELECT id FROM markaz.user WHERE login='"+txt_login.getText().trim()+"' AND parol='"+txt_parol.getText().trim()+"'";
int tek= dao.tekUser(sql);
if(tek!=0){
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/sample/FXML/Asosiy.fxml"));
AnchorPane pane=(AnchorPane)fxmlLoader.load();
Scene scene=new Scene(pane);
Stage stage=new Stage();
stage.setScene(scene);
stage.centerOnScreen();
stage.initModality(Modality.APPLICATION_MODAL);
stage.show();
Node node=(Node)event.getSource();
Stage stage1=(Stage)node.getScene().getWindow();
stage1.close();
}else {
Alert alert=new Alert(Alert.AlertType.ERROR);
alert.setTitle("xatolik");
alert.setHeaderText(null);
alert.setContentText("parol yoki login xato");
alert.show();
}
}else {
Alert alert=new Alert (Alert.AlertType.ERROR);
alert.setTitle("xatolik");
alert.setHeaderText(null);
alert.setContentText("parol yoki login yoq");
alert.show();
txt_login.requestFocus();
}
}
@FXML
void Sozlama(ActionEvent event) throws IOException {
FXMLLoader fxmlLoader=new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/sample/FXML/Sozlamalar.fxml"));
AnchorPane pane=(AnchorPane)fxmlLoader.load();
Scene scene=new Scene(pane);
Stage stage=new Stage();
stage.setScene(scene);
//stage.initStyle(StageStyle.TRANSPARENT);
stage.centerOnScreen();
stage.initModality(Modality.APPLICATION_MODAL);
pane.setOnMousePressed(new EventHandler() {
@Override
public void handle(MouseEvent event) {
x=event.getSceneX();
y=event.getSceneY();
}
});
pane.setOnMouseDragged(new EventHandler() {
@Override
public void handle(MouseEvent event) {
stage.setX(event.getScreenX()-x);
stage.setY(event.getScreenY()-y);
}
});
stage.show();
}
@FXML
void initialize() {
dao=new DataAccsesObject();
}
}

  • //------------------------Guruhlar-------------------//

  • package sample.Controllers;
    import com.jfoenix.controls.JFXTextField;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.collections.transformation.FilteredList;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.fxml.FXML;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Scene;
    import javafx.scene.control.MenuItem;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.input.KeyEvent;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Modality;
    import javafx.stage.Stage;
    import javafx.stage.WindowEvent;
    import sample.DataAccsesObject.DataAccsesObject;
    import sample.Modellar.Guruh;
    import sample.Modellar.Hodim;
    import sample.Modellar.Telefon;

    import java.io.IOException;
    public class Guruhlar {
    DataAccsesObject dao;
    String sql;
    ObservableList list= FXCollections.observableArrayList();
    public static int holat=0;//0-add 1-edit

    public static String g_nom,g_teacher,g_fan,g_id,txt_gr;

    public static int getHolat() {
    return holat;
    }

    public static String getTxt_gr() {
    return txt_gr;
    }

    public static void setTxt_gr(String txt_gr) {
    Guruhlar.txt_gr = txt_gr;
    }

    public static void setHolat(int holat) {
    Guruhlar.holat = holat;
    }

    public static String getG_nom() {
    return g_nom;
    }

    public static void setG_nom(String g_nom) {
    Guruhlar.g_nom = g_nom;
    }

    public static String getG_teacher() {
    return g_teacher;
    }

    public static void setG_teacher(String g_teacher) {
    Guruhlar.g_teacher = g_teacher;
    }

    public static String getG_fan() {
    return g_fan;
    }

    public static void setG_fan(String g_fan) {
    Guruhlar.g_fan = g_fan;
    }

    public static String getG_id() {
    return g_id;
    }

    public static void setG_id(String g_id) {
    Guruhlar.g_id = g_id;
    }

    @FXML
    private MenuItem taxrirlash;

    @FXML
    private JFXTextField txt_qidiruv;
    @FXML
    private TableView tableview;
    @FXML
    private TableColumn column_nomer;

    @FXML
    private TableColumn column_nom;


    @FXML
    private TableColumn column_teacher;
    @FXML
    private TableColumn column_fan;
    @FXML
    private TableColumn column_id;


    Download 1.46 Mb.

    Do'stlaringiz bilan baham:
  • 1   2   3   4   5   6   7   8   9




    Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
    ma'muriyatiga murojaat qiling