Skip to content

Instantly share code, notes, and snippets.

@Conrad6
Created July 20, 2017 20:02
Show Gist options
  • Save Conrad6/7b8baf96752e0c63fdf9e857cd469534 to your computer and use it in GitHub Desktop.
Save Conrad6/7b8baf96752e0c63fdf9e857cd469534 to your computer and use it in GitHub Desktop.
Who can help me with this. I cannot seem to implement a popup menu with the JFXPopup class.
package sample.systemwindow;
import com.jfoenix.controls.*;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
import de.jensd.fx.glyphs.icons525.Icons525;
import de.jensd.fx.glyphs.icons525.Icons525View;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.TreeTableColumn;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import sample.objectClasses.Book;
import sample.objectClasses.Student;
import java.net.URL;
import java.sql.Timestamp;
import java.util.ResourceBundle;
public class LibsysController implements Initializable{
public HBox dateLabel;
public JFXButton removeStudentButton1;
public JFXButton addStudentButton1;
public JFXButton addBookButton1;
public JFXButton removeBookButton1;
public JFXButton lendBookButton1;
public JFXHamburger hamburger;
public JFXPopup popup;
@FXML
private Label countLabel;
@FXML
private TreeTableColumn<Book, Integer> bookID;
@FXML
private TreeTableColumn<Book, String> bookTitle;
@FXML
private TreeTableColumn<Book, String> bookISBN;
@FXML
private TreeTableColumn<Book, String> bookAuthor;
@FXML
private TreeTableColumn<Book, Timestamp> bookDateAdded;
@FXML
private JFXListView<String> bookDisciplineListView;
@FXML
private JFXTextField searchTextField;
@FXML
private JFXButton addStudentButton;
@FXML
private JFXButton removeStudentButton;
@FXML
private JFXButton addBookButton;
@FXML
private JFXButton removeBookButton;
@FXML
private JFXButton lendBookButton;
@FXML
private JFXListView<String> departmentListView;
@FXML
private TreeTableColumn<Student, Integer> studentID;
@FXML
private TreeTableColumn<Student, String> studentName;
@FXML
private TreeTableColumn<Student, String> studentMatricule;
@FXML
private TreeTableColumn<Student, String> studentGender;
@FXML
private TreeTableColumn<Student, Integer> studentLevel;
@FXML
private TreeTableColumn<Student, Timestamp> studentDateAdded;
@FXML
private JFXTextField searchTextField1;
@FXML
void searchBooks(ActionEvent event) {
}
@FXML
void searchStudent(ActionEvent event) {
}
@Override
public void initialize(URL location, ResourceBundle resources) {
popup = new JFXPopup();
hamburger.addEventHandler((MouseEvent.MOUSE_CLICKED), e->{
popup.show(hamburger, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, e.getX(), e.getY());
});
//VBox vBox = new VBox();
//vBox.getChildren().addAll(addStudentButton, removeStudentButton,addBookButton, removeBookButton, lendBookButton);
//popup.setPopupContent(vBox);
MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.ACCOUNT_PLUS);
icon.setStyle("-fx-background-color: #00BCD4");
addStudentButton.setGraphic(icon);
MaterialDesignIconView icon1 = new MaterialDesignIconView(MaterialDesignIcon.ACCOUNT_MINUS);
icon1.setStyle("-fx-background-color: #00BCD4");
removeStudentButton.setGraphic(icon1);
}
public void addStudentAction(ActionEvent actionEvent) {
}
public void removeStudentAction(ActionEvent actionEvent) {
}
public void addBookAction(ActionEvent actionEvent) {
}
public void removeBookAction(ActionEvent actionEvent) {
}
public void lendBookButton(ActionEvent actionEvent) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment