code.makery.ch | Tutorials and Blog about programming | Runtime Evironment library
kandi X-RAY | code.makery.ch Summary
kandi X-RAY | code.makery.ch Summary
This is the website source that is used for the code.makery.ch. This readme describes the setup of the website. With this information you can clone the entire website and run it on your local machine or on your own server.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of code.makery.ch
code.makery.ch Key Features
code.makery.ch Examples and Code Snippets
Community Discussions
Trending Discussions on code.makery.ch
QUESTION
I have a question that I couldn't find a solution for.
I'm trying to filter my javafx8 tableview but i'm facing a problem . I don't know how to show only data existing between two time stamps.
Edit : to be explicit i want to know how to configure a beginnig and an ending for the rows using text field
PS : screenshot of my tableview :
I have already seen https://code.makery.ch/blog/javafx-8-tableview-sorting-filtering/. I have a trouble with creating a proper Predicate
, in the tuto they show you how to display only informations that have the same informations. and i want to display the infos existing in between.
PS: item type is Timestamp
...ANSWER
Answered 2019-Jul-16 at 08:14confirmdatebtn1.setOnAction(new EventHandler(){
@Override public void handle(ActionEvent e) {
filterData.setPredicate(table -> {
if ((todatetxt.getText() == null &&fromdatetxt.getText() == null) ||
(todatetxt.getText().isEmpty()&&fromdatetxt.getText().isEmpty()) ) {
return true;}
try {
String fromtext = fromdatetxt.getText();
String totext = todatetxt.getText();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
Date date1 = null;
Date date2 = null;
Timestamp timestamp1 = null;
Timestamp timestamp2 = null;
if(todatetxt.getText().isEmpty() && !fromdatetxt.getText().isEmpty()) {
date1 = format.parse(fromtext+" 00:00:00.000");
timestamp1 = new java.sql.Timestamp(date1.getTime());
if (table.getTime_of_action().after(timestamp1) )
{return true;}
}
if(!todatetxt.getText().isEmpty() && fromdatetxt.getText().isEmpty()) {
date2 = format.parse(totext+" 23:59:59.000");
timestamp2 = new java.sql.Timestamp(date2.getTime());
if (table.getTime_of_action().before(timestamp2) )
{return true;}
}
if(!todatetxt.getText().isEmpty() && !fromdatetxt.getText().isEmpty()) {
date1 = format.parse(fromtext+" 00:00:00.000");
date2 = format.parse(totext+" 23:59:59.999");
timestamp1 = new java.sql.Timestamp(date1.getTime());
timestamp2 = new java.sql.Timestamp(date2.getTime());
if (table.getTime_of_action().before(timestamp2) &&table.getTime_of_action().after(timestamp1))
{return true;}
}
} catch (Exception e1) {
}
return false;
});} });*** i wrote this code and it came out good so my probleme is resolved thanks to your help guys***
QUESTION
I am developing a software using JavaFX
.
It is a desktop application.
I am new to MVC
, and also JavaFX
; But learn some details by googling.
I follow the steps here, to learn about JavaFX
and also MVC
.
I know that in MVC
, Model
is a POJO
, View
is visualization, and controller acts on both, accept input and convert to commands for view and model.
The model can also have logic to update the controller.
We also for each view, should have a controller.( view-controllers
)
But I have some question; Why in the tutorial
, We create both PersonEditDialog and PersonOverview stage
in the mainApp
?
I mean this :
ANSWER
Answered 2019-May-15 at 07:17It's not possible to do what you are saying, you can't create something from some other thing that's not even existing. If you don't instantiate the PersonOverview
in Main, you can't make it do anything.
Also, notice in this case that the view of PersonOverview
is attached to the RootLayout
which is created in Main
. So you can consider these as one Main View where each controller is managing one part of the view.
In the case of PersonEditDialog
, You are starting a stage through the main view to edit some information. That's why it's created in Main. The stage is attached to the MainStage.
And if you have several stages to create, You don't have to do that in Main
. It depends on your needs. You can basically run a stage which uses some controller from another controller by clicking on a button for example. So it depends on : after what event you want to see that stage.
Example : You can add a button in PersonEditDialog controller like More...
and you define its setOnAction
event to open a new view (stage) where you show the picture, the Twitter link...
QUESTION
In this JavaFX tutorial, address book application creation suggested. Registered person could be deleted, however before deleting, person must be selected in table view.
There will be an ArrayIndexOutOfBoundsException because it could not remove a person item at index -1. The index -1 was returned by getSelectedIndex() - which means that there was no selection.
To ignore such an error is not very nice, of course. We should let the user know that he/she must select a person before deleting. (Even better would be if we disabled the button so that the user doesn’t even have the chance to do something wrong.)
Author is totally correct about "Even better would be if we disabled the button ...", however he selected the first way. I suppose, manipulation of the button state is the essential skill for JavaFX application development, so I tried to implement the better solution.
Of course, we can do it by way like this:
...ANSWER
Answered 2019-May-05 at 16:26First off, I'm not sure if referencing a boolean
field that way would even let the FXML file be loaded (you don't specific exactly how it "doesn't work"). But ignoring that, fields are not observable in Java which means updating the field will not automagically cause the disable
property of the Button
to be updated. This is why JavaFX has the [ReadOnly]Property
interfaces and introduces the "JavaFX Bean" (an extension to Java Bean that adds a "property getter"); it allows observers to see changes in an object's properties. Note you can bind a writable property to an ObservableValue
so it always has the same value.
Now, I would have expected an expression binding would be what you're looking for, but the following:
QUESTION
I have very simple window for changing password from javafx dialog collection - i use custom dialog example to build it (http://code.makery.ch/blog/javafx-dialogs-official/). Questions are bolded in below code:
...ANSWER
Answered 2017-May-28 at 21:13How to check two observable values at once(if pass1.length>0 and pass2.length>0) with lambda expression and change saveButton to enable?
You can do this a number of ways.
With a listener on both password fields:
QUESTION
I use JavaFx with property binding. I got a object 'Person' with the properties 'name' and age. These objects are stored in a ObservableList.
The properties are bound to labels on the gui. When I change the person in the ListBox the data also change on the right hand side.
GUI with person list:
And now it comes to my problem. I want to disply all persons on one window, like the next picture shows.
GUI with multiple persons on one view:
How can I handle this. I thought about HBox but the binding doesn't work.
FYI: Here you can find the tutorial I used. https://code.makery.ch/library/javafx-tutorial/part1/
...ANSWER
Answered 2018-Dec-14 at 13:56This looks like a perfect time to use a ListView
with custom ListCell
implementations.
The sample application below shows a very basic application that displays each Person
object in a ListView
. We will provide our own ListCell
so we can control exactly how each Person
gets displayed.
I also added a profile photo just for fun :)
QUESTION
I am now doing a simple sudoku game by JavaFX. And now I met some difficulty on dialog. I had create two scene, the menu scene contain only "new game" and "continue" button, main scene contain sudoku game. In the main scene I had created a check button to check if the gamer's answer is correct, where if it is incorrect then show a dialog like this img here and when it's correct,it might like this img here.
Then I found that CONFIRMATION ALERT is very similar. All I need to change is to the button's text and it's action,while when click retry to back to game scene and click quit to back to the main scene.
Now I know how to set action for the button in alert box, but i had some new question for that, I have no idea how to call the ventHandler
in the statement.
Here is my code for two alert box
(source code from https://code.makery.ch/blog/javafx-dialogs-official/)
...ANSWER
Answered 2018-Oct-23 at 10:38In the linked tutorial, there is an example on how to set custom actions (I shortened it a bit):
QUESTION
I am currently working on my JavaFX ZOO project and I have a problem. I am showing all of my records in a TableView and one of the columns contains a delete button. It all works perfectly, but I want to have an alert box showing up after clicking that delete button, just for safety.
So my delete button class looks like this:
...ANSWER
Answered 2017-May-21 at 20:29I will borrow code from the website you mentioned.
QUESTION
I have a javafx TableView and I want to know when the sort order of a column changes. I added a listener to the getSortOrder
method. However, it only fires when I sort ascending, and never when I sort descending.
To test this I used this example code
Does anyone have an idea why this doesn't fire? Do I need to add sth else?
The data in the table is in a SortedList
and I added the listener as follows:
personTable.getSortOrder().addListener(this::onColumnSortOrderChanged);
ANSWER
Answered 2018-Sep-10 at 10:19Multiple columns can be used for sorting (e.g. sorting people by family name first and use given name as secondary criterion). You can hold Shift to add multiple columns. This list does not change, if you're changing between ascending and descending sort order of a column.
To listen to those changes too, you need to listen to the TableColumn.sortType
property.
QUESTION
I did some research on TableView's Filtering
and Pagination
separately.
Filtering : this post helped me as my need
Pagination : this, this post helped me also
I want to combine them together like so:
In Details --------------
I tried to make the pagination functionality first and it worked,
secondly, when i would start typing to the TextField
filter functionality will match/filter the data from ObservableList
, then rearrange the pagination according to the matched data size and show them through the table like the Datatable's search and pagination does and that's what i wanted, but i failed
My Code ...
PersonTableController.java
...ANSWER
Answered 2018-Feb-27 at 08:59here is my simple solution to your problem:
QUESTION
Following an example on : http://code.makery.ch/blog/javafx-8-event-handling-examples/ I have made a basic GUI involving a combobox. When Running my program however none of the items are being added to the combobox what so ever. I would very much appreciate it if you could point out my mistakes as to why it may not be adding the items to the combobox. Here is a ZIP file of my project: https://www.dropbox.com/home/Project-JavaFX All thanks in advance!
Main.java:
...ANSWER
Answered 2018-Feb-22 at 00:03There are several things I recommend to change:
Main classCommunity Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install code.makery.ch
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page