Posts

Showing posts from January, 2016

JavaFX 8 Tutorial 46 - FileChooser

Image
The Code written in this tutorial is:     private FileChooser fileChooser;     private Button browse;     private File file;     private final Desktop desktop = Desktop.getDesktop(); fileChooser = new FileChooser();         fileChooser.getExtensionFilters().addAll(                 new ExtensionFilter("Text Files", "*txt"),                 new ExtensionFilter("Image Files", "*.png", "*.jpg", "*.gif"),                 new ExtensionFilter("Audio Files", "*wav", "*.mp3", "*.aac"),                 new ExtensionFilter("All Files", "*.*")         );                 browse = new Button("Browse");         browse.setFont(Font.font("SanSerif", 15));         browse.setOnAction(e ->{             /*Single File Selection             file = fileChooser.showOpenDialog(primaryStage);             if(file != null){                 try

JavaFX 8 Tutorial 46 - FileChooser

Image
The Code written in this tutorial is:     private FileChooser fileChooser;     private Button browse;     private File file;     private final Desktop desktop = Desktop.getDesktop(); fileChooser = new FileChooser();         fileChooser.getExtensionFilters().addAll(                 new ExtensionFilter("Text Files", "*txt"),                 new ExtensionFilter("Image Files", "*.png", "*.jpg", "*.gif"),                 new ExtensionFilter("Audio Files", "*wav", "*.mp3", "*.aac"),                 new ExtensionFilter("All Files", "*.*")         );                 browse = new Button("Browse");         browse.setFont(Font.font("SanSerif", 15));         browse.setOnAction(e ->{             /*Single File Selection             file = fileChooser.showOpenDialog(primaryStage);             if(file != null){                 try

JavaFX 8 Tutorial 45 - ScrollPane

Image
The code written in the tutorial is :         ScrollPane sp = new ScrollPane(table);         //sp.setContent(table);         sp.setPrefSize(600, 200);         sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);         sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);         sp.setFitToHeight(true);         sp.setHmax(3);         sp.setHvalue(0);         sp.setDisable(false);                 layout.setRight(sp);         BorderPane.setMargin(sp, new Insets(0, 0, 10, 10));

JavaFX 8 Tutorial 44 - Search or Filter Table By ID, FirstName and LastName

Image
The code written in the tutorial is TextField  searchField; searchField = new TextField(); searchField.setFont(Font.font("SanSerif", 15)); searchField.setPromptText("Search"); searchField.setMaxWidth(200); fields.getChildren().addAll(searchField, label1, id, fn, ln, em, mobile, un, pw, date, male, female, checkBox1, checkBox2, checkBox3, button); FilteredList<User> filteredData = new FilteredList<>(data, e -> true);         searchField.setOnKeyReleased(e ->{             searchField.textProperty().addListener((observableValue, oldValue, newValue) ->{                 filteredData.setPredicate((Predicate<? super User>) user->{                     if(newValue == null || newValue.isEmpty()){                         return true;                     }                     String lowerCaseFilter = newValue.toLowerCase();                     if(user.getID().contains(newValue)){                         return true;        

JavaFX 8 Tutorial 43 - Fetch Database Values on Table KeyReleased Method

Image
The code written in the tutorial is : table.setOnKeyReleased(e ->{             if(e.getCode()== KeyCode.UP || e.getCode() == KeyCode.DOWN){                 try {                 User user = (User)table.getSelectionModel().getSelectedItem();                               String query = "select * from UserDatabase where ID = ?";                 pst = conn.prepareStatement(query);                 pst.setString(1, user.getID());                 rs = pst.executeQuery();                               while(rs.next()){                     id.setText(rs.getString("ID"));                     fn.setText(rs.getString("FirstName"));                     ln.setText(rs.getString("LastName"));                     em.setText(rs.getString("Email"));                     mobile.setText(rs.getString("MobileNo"));                     un.setText(rs.getString("Username"));                     pw.setText(rs.getString

JavaFX 8 Tutorial 42 - Fetch Database Values on Table MouseClicked Method

Image
The code written in the tutorial is:  table.setOnMouseClicked(e ->{             try {                 User user = (User)table.getSelectionModel().getSelectedItem();                                 String query = "select * from UserDatabase where ID = ?";                 pst = conn.prepareStatement(query);                 pst.setString(1, user.getID());                 rs = pst.executeQuery();                                 while(rs.next()){                     id.setText(rs.getString("ID"));                     fn.setText(rs.getString("FirstName"));                     ln.setText(rs.getString("LastName"));                     em.setText(rs.getString("Email"));                     mobile.setText(rs.getString("MobileNo"));                     un.setText(rs.getString("Username"));                     pw.setText(rs.getString("Password"));                     ((TextField)date.getEditor(

JavaFX 8 Tutorial 41 - Validate and Clear CheckBox

Image
The code written in the tutorial is: checkBox1.requestFocus(); checkBox2.requestFocus(); checkBox3.requestFocus(); private boolean validateFields(){               if(!(checkBox1.isSelected() | checkBox2.isSelected() | checkBox3.isSelected())){                             Alert alert = new Alert(AlertType.WARNING);                 alert.setTitle("Validate Fields");                 alert.setHeaderText(null);                 alert.setContentText("Please Selct One of The Hobby ");                 alert.showAndWait();                                 return false;         }                 return true;     } public void clearFields(){                   checkBox1.setSelected(false);         checkBox2.setSelected(false);         checkBox3.setSelected(false);         checkBoxList.clear();     }

JavaFX 8 Tutorial 40 - CheckBox and Database

Image

JavaFX 8 Tutorial 39 - Update or Edit User Details or Table from Database

Image

JavaFX 8 Tutorial 38 - Mobile Number Validation

Image

JavaFX 8 Tutorial 37 - Password Validation

Image

JavaFX 8 Tutorial 36 - Email Validation

Image

JavaFX 8 Tutorial 35 - Name Validation

Image

JavaFX 8 Tutorial 34 - Number or User ID Validation

Image

JavaFX 8 Tutorial 33 - Fetch or Get RadioButton Value From Database

Image

JavaFX 8 Tutorial 32 - Validate and Clear RadioButton

Image

JavaFX 8 Tutorial 31 - RadioButton and Database

Image

JavaFX 8 Tutorial 30 - RadioButton with Example of Gender

Image