JavaFX 2.0 :: Only One Change Event On ObservableList?
Apr 9, 2015
I have a list of Row objects and want to listen to changes in the name property of a Row object.
public class Row implements Serializable {
private final SimpleStringProperty name = new SimpleStringProperty(this, "name", "");
public Row() {
this("");
}
public Row(String name) {
this.name.set(name);
[Code] ....
I would expect to be notified 4 times. Line 23: Added, Line25, 26, 27: Update
But there are only 2 change events. For Line 26 and 27 there is no change event.
View Replies
ADVERTISEMENT
Aug 13, 2014
I would like to detect when the user change de JFrame. I make:
public class UI implements ActionListener, ComponentListener, DocumentListener, MouseListener{
private JFrame ventana;
private JTable table;
private JPanel panel;
private JScrollPane tableScrollPane;
[Code] ....
I put componentResized but when I change JFrame I cant see the string that I put in the method.
View Replies
View Related
Dec 30, 2014
I have two classes involved in this portion. CheckIn_Search
(class #1) is my main UI and I am collecting search information from the user in a jPanel form. When they click "Search" it passes the search criteria to a method that contacts a web service and gets the results. These results are passed to coSearchResults
(class #2) that opens a jFrame and jTable (in modal format, over the main window created by CheckIn_Search.
The user selects a row in the table and that selection data is passed back to coSearchResults to populate a new jPanel form. When the data is passed from coSearchResults, I want to close its window, hide the first jPanel in CheckIn_Search and make the second jPanel visible. To accomplish this, I created a method in CheckIn_Search that simply hides/shows the panels (it will do more later).
I instantiate and call the method in CoSearchResults as part of the button click event. The problem is, it doesn't work. The panels are unaffected and there are no errors. I've put in break-points and it goes into the method.. Here is the coSearch_Results code.
Here is am retrieving the jtable row id and using the first value in the row to get the data from the table model as there is more data than what is displayed in the table. I'm sending that whole row of data to the method that changes visibility.
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
// TODO add your handling code here:
int rowNum = jTable1.getSelectedRow();
String coNum = jTable1.getValueAt(rowNum,0).toString();
String[] text;
[code]....
View Replies
View Related
Jun 18, 2014
We are doing a Timeline project, So this is what i want to do:
Pressing a "New Event" button opens the New event window where you are supposed to write input in three fields, name, date, and information. There is also a button "Create" that when i press that button, i want to take all the input from the fields and save/send it to our database, and go back to the timeline GUI. With this, i want a new event object to be created(in this case i have done several shapes in a group) so basically a new group i want to be added. All the information is suppose to be taken from the database right after i create it.
I'm pretty stuck on how i should solve this, for the moment have a group called event that i add on the canvas. First thing that pops up in my head is a void method that draws the event, or maybe a temporary array.. P
package application;
import controllers.CreateEventController;
import application.EventPop;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
[Code] ....
View Replies
View Related
Jun 10, 2014
I have a TreeView insight TabPane
treeView.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if (mouseEvent.getClickCount() == 2 && mouseEvent.getButton() == MouseButton.PRIMARY) {
// Some action
}
}
});
For some reason when I click on a tab body I can also perform the listener action. How I can add additional statement to perform the action only if I select node?
View Replies
View Related
Mar 26, 2015
I want to do something when the treeitem collapsed or expanded,but both clicked the tree item icon and double clicked tree item can collapsed or expanded the tree item.so how to listen collapse and expand event?
View Replies
View Related
Jan 15, 2015
I develop a desktop soft use javafx8, and remove default border (e.g. title and close/min/max button), now use mouse left key click the taskbar icon is nothing,i want click the taskbar icon,if stage it's show then hidden, if stage it's hidden then show it,the problem is I can't capture any mouse click event,so i can't show or hidden my stage.
View Replies
View Related
Sep 4, 2014
How to catch the event when table view's column are re-positioned. Basically when the column is re-positioned from 1 position to 5 position , i want to do update the db.
View Replies
View Related
Jun 4, 2014
I can't recolate and align the button, the circle or the line where i want it to on the canvas. I want to be able to move the line where i want it, now it seems like all objects are stuck in the middle of the scene or canvas.
package application;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
[Code] ....
View Replies
View Related
Jun 8, 2014
I am having a small JavaFX program where I try to set a value to TextField. Below is the part of FXML file and highlighted is the Textfield ....
fxml file
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="185.0" prefWidth="598.0">
<children>
<TextField fx:id="actiontarget" editable="true" layoutX="146.0" layoutY="73.0" prefWidth="198.0" text="" />
[Code] ...
I want to display a string value to that text field.
So, I am using that fxid (actiontarget)
But actiontarget.setText (pathofFile) is not working .
Nothing displays and no value sets for the Text field.
How can I set value in that text field through above code.
View Replies
View Related
Mar 16, 2015
I change TreeTableColumn.text but I got a Exception
Exception in thread "JavaFX Application Thread" java.lang.ClassCastException:
javafx.scene.control.TreeTableColumn cannot be cast to javafx.scene.control.TableColumn
at com.sun.javafx.scene.control.skin.TableHeaderRow$10.invalidated(TableHeaderRow.java:277)
so I check TableHeaderRow . I find this method
private final InvalidationListener columnTextListener = new InvalidationListener() {
@Override public void invalidated(Observable observable) {
TableColumn<?,?> column = (TableColumn<?,?>) ((StringProperty)observable).getBean();
CheckMenuItem menuItem = columnMenuItems.get(column);
if (menuItem != null) {
menuItem.setText(getText(column.getText(), column));
}
}
};
why don't they use this
TableColumnBase<?,?> column = (TableColumnBase<?,?>) ((StringProperty)observable).getBean();
View Replies
View Related
Jul 2, 2014
We have developed a theme called default.css that is extending of the default caspian.css. What we want to do is offer users the ability to override values from default.css to change colors etc. How can that be done?
View Replies
View Related
Dec 28, 2014
I created two CheckBox in 2 tableColumn and I want to listen theire change. I tried
col_orien.setOnEditCommit
But it doesn't work (col_orien is the name of the tablecolumn that contain the check box)
Here is my code :
col_orien.setOnEditCommit(new EventHandler<CellEditEvent<Information,Boolean>>() {
@Override
public void handle(CellEditEvent<Information, Boolean> event) {
System.out.println("Edit commit");
}
});
View Replies
View Related
Mar 26, 2015
I am using javafx 2 in my project,After user change the text in HTMLEditor,i will save the context to database,if text wasn't changed,then i do nothing .so i want to know if the user have changed the text.
I only saw how to add text changed listener to HTML web viewer. So how to add text changed listener to htmleditor?
View Replies
View Related
May 26, 2014
I have a table column and I want to change the columns header justification from center justified to left justified. How do I do this, either via code or via CSS.
View Replies
View Related
May 20, 2014
is possibile to change the color of the sorting arrow that appears in the columns of the Table View by css? My attempts have failed and I have not found any documentation, nor is there any reference in the Modena css.
View Replies
View Related
Oct 15, 2014
I have noticed a strange behavior of Combobox element. The number of visible rows is not the same established by setVisibleRowCount() method. It happens when changing the items list dynamically. The following example reproduces it. I think it is Javafx 8 bug. I have tried unsuccessfully to trigger some event indirectly to refresh the combobox drop down.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TestComboBox extends Application {
private int count;
[Code] .....
View Replies
View Related
Jan 12, 2015
So it seems to reason that many JavaFX applications will want to dynamically change CSS styles. Is the best way to do this via the <node>.getStyleClass().add("classname")? The underlying data structure is an observable list. So lets say one has 5 styles that simply change the fill color of a circle to 5 different colors respectively. So if I have a condition in which I want to dynamically apply 1 of these 5 styles, the way I currently do this is by defining all 5 styles as strings in a list using a static initializer, then I call <node>.getStyleClass().removeAll(list), then getStyleClass().add("classname"). I do this to avoid adding the same style over and over and inflating the underlying list. Is this the correct way to manage dynamic CSS styles?
So I know there is a few different way to implement a splash screen. My app has definitely gotten larger over the last few months of development and I have noticed there is about a 5 second delay between when I run the application to when I see the main stage. I was thinking a splash screen would be nice to fill this time period. I have not had time to prototype using a Preloader and I fear that using an alternate, lightweight stage on startup would still take too long of a delay. I was actually thinking that using the nice and simple JVM argument "-splash:<image name>" would be simple, easy and effective. Unfortunately when I try to do this, the splash screen comes up but never goes away.
View Replies
View Related
Mar 23, 2015
How to define Cell in the table by table event?
I need to process one component drag to the table. I misunderstand, how I can see to which Cell fall the component. I tried to use Event and Mouse event handlers in my custom Cell, but they do not work. I can copy the drag event to the table and table handles it, but how to get needed Cell I cant understand.
View Replies
View Related
Dec 5, 2014
I am currently making a video player which allows users to open/play videos which are stored on their computer. I am using JavaFX for this.My problem, is that sometimes when I click the button to load a video, a java.util.ConcurrentModificationException is raised. Other times, it's perfectly fine.I put the calls to .loadAndPlayMediaA() and .prepareMedia() (see below) inside a .runLater(Runnable) to try to prevent this, but it has not worked. My Code (below) is called by a listener on a button, "testButton". I have a class called JfxMediaPlayer which holds the method loadAndPlayMediaA(), and a class called MixingDeck which holds the method prepareMedia()
testButton.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent arg0) {
Platform.runLater(new Runnable(){
@Override
[code]....
View Replies
View Related
May 20, 2014
I have a WindowClosing(WindowEvent e) method, but when I close my window it isn't doing anything inside the method. I am making a launcher and I want to make it so when the actual game window is closed it makes the launcher window visible again.
Java Code: public void windowClosing(WindowEvent e) {
this.jf.setVisible(true);
} mh_sh_highlight_all('java');
View Replies
View Related
May 6, 2014
How the event Listeners work in java,To get the data based on the event occurs in outside the application. I have this method in one of my API class I am not understanding how this methods are going to work.
public interface SBXPCXMLEventListener {
public void OnReceiveEventXML(String eventXML);
}
private static List<SBXPCXMLEventListener> listenerList = new ArrayList<SBXPCXMLEventListener>();
protected static void fireXMLEvent(String xml) {
[Code] ....
I have done like this.This is used to capture the events from the fingerprint machine when run this class I am not getting any data from the machine when i did thumb impression in the machine.
public class EventListnere implements SBXPCXMLEventListener {
public static void main(String[] args) {
boolean flag = SBXPCProxy.ConnectTcpip(1, "10.0.0.8", 5005, 1234);
System.out.println("flag = " + flag);
// SBXPCProxy.st
[Code] .....
View Replies
View Related
Feb 28, 2015
java.awt.Component is an abstract class, and it's direct Sub-classes are Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, Text Component
So, when I use addXListener(mylistenerclass m);//which is a method of Component class which object is holding the list of all listeners, for a particular Event Source?
I am under the assumption that - there is an Event Source Object(possibly static) for every Event Source type(mouse, keyboard etc) that holds a list of destinations(classes that implements their listener interface) - added to the the object via addXListener method. When an event happens(mouse click, drag etc) the Event Source Object creates an Event Object and send it to all the destinations. Is my assumption correct? I can't seem to find the location or declaration of Event Source Object and the list where it stores it's registered destinations.
View Replies
View Related
Oct 5, 2014
this is the first code
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class ChickenListener implements ActionListener {
int loopctrl;
static Connection cn;
static Statement st;
static ResultSet rs;
static PreparedStatement ps;
[Code]...
the second code
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class QuantityCounterListener implements ActionListener {
String tempStrng;
int tempInt;
int x = 0;
[Code]...
what my problem is i need to transfer what does "tempString" from code 1 holds to code 2 in the //x part in the prepared statement.
View Replies
View Related
Jan 14, 2015
I'm not so new to java i know the basics. I want to make a mastermind game. Just for training purpose.
Now i am at the comparison phase where it is comparing your chosen "colors" with the actual "color code"
This is my code for that part:
guesChars is a char array of 4 of the actual code
readGuess is a string of 4 of which the players has filled in the console
goodGuess is a char at the right position with the right "color"
avgGues is a char with the right "color" at the wrong position
Java Code:
for(int i = 0; i < guessChars.length; i++){
for(int ii = 0; ii < readGuess.length(); ii++){
if(readGuess.charAt(ii) == guessChars[i]){
if(ii == i){
[Code] .....
The problem is when the code is for example
ACDD
and the player guess is
ADDD
Result is
2 right spot right color
1 right color wrong spot
It have to be
2 right spot right color
0 right color wrong spot
View Replies
View Related
Dec 17, 2014
How would you begin a program that schedules events? I've found codes that are similar like Calendars, but I need something that will still import the real day, month, year. But I want to have columns that show Room numbers, and rows that shows time slots. How to get started such as which GUI components to use, what packages to import, etc.?
View Replies
View Related