Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Menai Ala Eddine MenaiAla

🏠
Working from home
Block or report user

Report or block MenaiAla

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MenaiAla
MenaiAla / RemoveNodeFromCustomTextField.java
Created Apr 23, 2018
A piece of code to remove a right/left node from CustomTextField in ControlFX
View RemoveNodeFromCustomTextField.java
public static void removeErrorIcon(TextField textField) {
if (textField instanceof CustomTextField) {
CustomTextField customTextField = (CustomTextField) textField;
Platform.runLater(() -> {
((StackPane)customTextField.getRight().getParent()).getChildren().remove(customTextField.getRight());
});
}
}
@MenaiAla
MenaiAla / Phones.json
Created Mar 23, 2018
Sample code to read JSON file in java
View Phones.json
{
"countries": [
{
"code": "+7 840",
"name": "Abkhazia"
},
{
"code": "+93",
"name": "Afghanistan"
},
@MenaiAla
MenaiAla / ChangeHTMLContent.java
Last active Mar 27, 2018
JavaFx example to make a changes in html file and reload it again in webview.
View ChangeHTMLContent.java
public void reloadContent()
{
//Using Jsoup library https://jsoup.org/cookbook/introduction/parsing-a-document
//Get html file
InputStream inputStream = Odata.class.getClass().getResourceAsStream("/web/html/template.html");
//Parse the content
org.jsoup.nodes.Document doc = Jsoup.parse(inputStream, "UTF-8", "");
//Get Element for make some changes
org.jsoup.nodes.Element content = doc.getElementById("name");
//Change the text of element
@MenaiAla
MenaiAla / JavaFXCSVTableView.java
Last active Jul 10, 2019
Java example read csv file and display the content in JavaFX TableView.
View JavaFXCSVTableView.java
package javafxcsvtableview;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
@MenaiAla
MenaiAla / JFXDialog.java
Created Jan 4, 2018
simple code to show a dialog using JFXDialog of @Jfoenix
View JFXDialog.java
private void showJDialog() {
JFXDialogLayout dialogContent = new JFXDialogLayout();
dialogContent.setHeading(new Text("Hello" == null ? "good" : "good" + "\n" + "Hello"));
dialogContent.setBody(new Text("Body"));
JFXButton close = new JFXButton("Close");
dialogContent.setActions(close);
JFXDialog dialog = new JFXDialog((StackPane) loginstage.getScene().getRoot(), dialogContent, JFXDialog.DialogTransition.CENTER);
close.setOnAction(new EventHandler<ActionEvent>() {
@MenaiAla
MenaiAla / ReadImage.java
Created Dec 28, 2017
Read an image from database
View ReadImage.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package readimage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@MenaiAla
MenaiAla / RunCmd.java
Last active Apr 15, 2019
Run most of windows commands with java language.
View RunCmd.java
/*
* Copyright 2017 M.Ala Eddine.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@MenaiAla
MenaiAla / Receive mail.java
Last active Aug 1, 2017
Receive mail using java mail API
View Receive mail.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package SimpleMail;
import com.sun.mail.pop3.POP3Store;
import java.io.IOException;
import java.util.Properties;
You can’t perform that action at this time.