JavaFX 2.0 :: TreeTableView With Inline Editing
Aug 8, 2014
I am developing a JavaFX application and have succesfully created a tree table with in-line editing. My problem is I am unsure how to check when an object has been changed so I can update the back-end database. According to the TreeTableView API documentation I should register an event handler on each tree table column with event type TreeTableColumn.EDIT_COMMIT_EVENT. Unfortunately I cannot find this constant! I am using JDK 8 update 11.
View Replies
ADVERTISEMENT
May 14, 2014
I have a TableCell that will hold numbers in a tableview. All is working work nicely, but I want the following behavior:
- when the user begins to edit such a cell, if it doesn't enter a number, the cell will not call commitEdit, but rather display a red border and prevent the user from changing the focus to anything else until he either: enters a correct number or presses ESC.
I don't know how to keep the user in that editting cell if while he has an incorect number. Currently he can click other row/control and he will break the edditing state. I repeat, I don't want the user to be able to click on any row/control until he has a correct number.
Here is my cell implementation:
public class EditableIntegerCell extends TableCell<Person, Integer> {
private TextField textField;
@Override
public void startEdit() {
if (!isEmpty()) {
super.startEdit();
createTextField();
setText(null);
[Code] .....
View Replies
View Related
Sep 29, 2014
I have a requirement to insert the data into xml file . I have used DOM class for doing this.
Below is my xml file
<code>
-<deployments>
-<applications>
-<application>
<name> PCMH</name>
-<envs>
-<env>
<name> DEVA</name>
<version>1.0.0 </version>
[code]....
The thing is if SITA is the name then I have to insert component to the particular envi tabs , if DEVB is the component I have to insert the component there. How can I do this I have done some code its inserting the data at the bottom og the XML.
View Replies
View Related
Jan 30, 2015
So I'm Half way done with this assignment and all I need to is edit and sort my directory. What I've been trying to do as of now is edit my directory. I've tried to use the set function in the Array List, Iterator List etc but I just don't know how implement them mainly because I keep thinking "how can check which variable in the directory the user wants to change(Name, cost etc etc)?".
Main class
Java Code:
package plantnursery;
import java.util.Scanner;
import java.util.ArrayList;
public class PlantNursery {
private ArrayList<Plant> plantDirectory = new ArrayList<>();
private static Scanner read = new Scanner(System.in);
[Code] .....
View Replies
View Related
Apr 7, 2015
I need to check an existence of a file if it is already created or not but the problem is on my code I obviously making the file first before I am able to check if it exist or not.
File createFile = new File ("//path/name.txt");
I've read somewhere that that line should not make a file without the createFile.createNewFile(); but when I tested it and on my program, my program was creating the file even without the .createNewFile() method with that said. I'm confused on how would I be able to check an existence of a file without of course having it pre-created. here is the partial code:
File newFile = new File ("C:/Documents and Settings/Admin/Desktop/Keys.txt");
BufferedWriter write = new BufferedWriter (new FileWriter (newFile));
BufferedReader read = new BufferedReader (new FileReader (newFile));
if (newFile.exist())
{
System.out.print("File is existing");
}
View Replies
View Related
Apr 11, 2014
Is it possible to edit hosts file in java program? I tried it but I'm getting "AccessDeniedException". I need to have permissions for it, but can i somehow set the permissions in java program for current user?
View Replies
View Related
Jun 22, 2014
So, I decompiled a jar file and went to edit some code, but this is the only error i get upon decompiling which I am unable to find a fix for.
int i3 = var32.read(abyte0, k2, exception4);
if(i3 < 0) {
"Length error: " + k2 + "/" + j2; //Not a statement
throw new IOException("EOF");
}
View Replies
View Related
Jun 22, 2014
I have a program for a phone directory. It needs to add, delete, append, and edit telephone records. I've gotten it to write and search the files. Just need to get it to delete and edit them.
Here's what I have so far:
import java.nio.file.*;
import java.io.*;
import java.nio.channels.FileChannel;
import java.nio.ByteBuffer;
import static java.nio.file.StandardOpenOption.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
[code]....
View Replies
View Related
Jan 23, 2015
I'm making a project about school management system , i have a jframe to set marks and inside the jframe i have a jtable which is connected to sql database , in the jframe I have a JCombobox with 6 different subjects and in my database i have created 6 tables for the subjects and if any of the subjects are clicked then the jTable will connect to database and change the table to that subject , after it is changed if you double click on any row and insert a value then it will automatically update the table in the database , but my problem is that if I select the first option from the jcombox which is English and edit the values then it works fine , but if I select any other option e.g Math or Science , then I try to edit the table then it edits the English table , I commented the English option in the code to see what happens and I saw that it edits only the first option and if you try to change the subjects and edit than it edits the first subject in the combobox , so how can I solve this ?
CODE:
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JComboBox;
import javax.swing.JTable;
[code]....
View Replies
View Related
Nov 17, 2014
I have an in-cell editable data table with a viewscoped managed bean.I found that the control never goes to the ajax event method onCellEdit when the scope of the bean is @Viewscoped but it works when the scope is changed to request scope.how to get this feature work with viewscope.Below is my code snippet
xhtml snippet
<p:dataTable id="workSpaceList" var="data"
value="#{workSpaceBean.lpInfoList}" widgetVar="multiSelection"
selection="#{workSpaceBean.selectedRows}"
scrollable="true" rowIndexVar="index" editable="true"
editMode="cell".......>
[code]....
View Replies
View Related
Aug 14, 2014
I am developing JavaFX application. I have requirement like that javafx application should be always on top. I could not find an option to make it always on top.
View Replies
View Related
Jan 28, 2014
I know that oracle has released a statement saying that JavaFX will eventually replace Swing. What is the advantage of JavaFX? The new format, using "stage" instead of JFrame, seemed weird. Why is this change necessary? What benefit do we reap from JavaFX that Swing does not have?
View Replies
View Related
Oct 24, 2014
I am using netbeans scenebuilder and I am a little confused on how I would convert my state capitals java code to a javaFX app.
public class StateCapitals {
Scanner in;
public static void main(String[] args) {
readData();
}
public static void readData() { // Location of file to read
File file = new File("statecapitals.txt");
[code]....
View Replies
View Related
Oct 21, 2014
I've been on this for a while and for some reason I just can't seem to get this to work. I know my code is solid, but it won't display my image. I've tried swithcing the image to different directories and also using different image sizes and types. I even used Orcale's guide to display your image, but still no go! All I get is a blank canvas? There are no errors. I'm also running NetbeansIDE 8 that supports JavaFX and I made sure the project is a JavaFX Application project.
All I get is a blank new window, but no images.
Here's my code:
package javafxapplication3;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.image.Image;
[code]....
The homework called for me to display it three times - the first one regular, second resized, and the last one rotated. I even deleted the extra images in hope at least one appears.
View Replies
View Related
May 8, 2014
I'm working on a project right now in JavaFX, and got stuck. I am drawing a path consisting of CubicCurveTo's and I wonder if there's any way to get the X and Y coordinates from certain parts of that path.
Imagine following a curve (path) with a pencil slowly, and every second you take note the X and Y coordinate. I mean I'm not interested in the control points or start and end points, but the points "in between", preferably at a certain interval.
I've searched for many things online, but have trouble knowing exactly which words to search for. "Paths" often bring up file paths, traversing, coordinates etc. all fail to give me any good results.
I tried to be as specific I could, and I don't think my current code is of any interest in this matter.
(The point of it all is that the path should simulate the path a person walks, and I will store the coordinates in a database for every second).
View Replies
View Related
May 28, 2014
When i press a button, i want to create a new object in my window(that i have created using scenbuilder, so i have a FXML file and a Controller class). In the window where i have a create button, there are also some textfields where you are supposed to enter name and date.
What i want to do is take the input from the TextField and store is temporally in a String variable, Its this strings i want to take the data from when i create a new object on my View. When i try to do something with the TextFields i get multiple errors that i dont understand at all.
I know my code may be very un-structured the absolute right way, i know, but i dont have time reconstructing and trying to understanding new patterns .The object is the circle and the vertical line.
TimelineMainView Controller
public class TimelineController{
StageClass sc = new StageClass();
NewTimelineController nt = new NewTimelineController();
[code]....
View Replies
View Related
Jan 24, 2015
I'm quite new to JavaFX, and currently struggling with navigation between views. I'll post the code and the stacktrace.
public class MainApp extends Application {
private Stage primaryStage;
private AnchorPane overviewPage;
@Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
[Code] .....
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
[Code] ......
View Replies
View Related
May 26, 2014
I have noticed that you can style JavaFX controls using their sub-structure.
E.g. to style the label in a table column header to be left justified I can do this :
.table-view .column-header-background .label { -fx-alignment: center-left ; }
How can I style my own nodes/controls doing this? Basically it amounts to asking how the selectors like ".column-header-background" are associated with sub-structures of my Java control/node objects. So suppose I have something like
.fancy-node .fred .label { ... }
How does JavaFX associate fancy-node and fred with something in my implementation of a Node/Control?
View Replies
View Related
Jan 13, 2015
ToString()-Representation of KeyEvents. I was expecting '$' as text value, because Shift was pressed.
Unfortunately, KeyTyped is not fired in this case, so I am not able to get the information from this event.
How can I get the actually typed '$' from KeyPressed?
KeyEvent [source = BorderPane[id=cnt_borderPane], target = Button@1a3fc21a[styleClass=button]'', eventType = KEY_PRESSED, consumed = false, character = , text = , code = SHIFT, shiftDown]
KeyEvent [source = BorderPane[id=cnt_borderPane], target = Button@1a3fc21a[styleClass=button]'', eventType = KEY_PRESSED, consumed = false, character = , text = 4, code = DIGIT4, shiftDown]
KeyEvent [source = BorderPane[id=cnt_borderPane], target = Button@1a3fc21a[styleClass=button]'', eventType = KEY_RELEASED, consumed = false, character = , text = , code = SHIFT]
KeyEvent [source = BorderPane[id=cnt_borderPane], target = Button@1a3fc21a[styleClass=button]'', eventType = KEY_RELEASED, consumed = false, character = , text = 4, code = DIGIT4]
View Replies
View Related
Sep 5, 2014
I would like to extract text (String) from a TextFlow control.
View Replies
View Related
Jul 7, 2014
I'd like the GUI to be drawn based on definition file. Is it possible to "generate" fxml (like PHP does html) so I could do this:
for (...) {
command_to_generate (<button ....>);
}
?
Or is using legaxy javaFX code the only way to achieve it?
View Replies
View Related
Apr 10, 2015
My JavaFX code like this:
WritableImage image = scene.snapshot(null);
File outputFile = new File("C:PSBJavaFXApplication1src est0.jpg");
ImageIO.write(SwingFXUtils.fromFXImage(image, null), "jpg", outputFile);
When open this jpg, its background is in orange color. For png type, it works great.
View Replies
View Related
Mar 16, 2015
I am new to JavaFX and OpenCV. The Problem is, that JavaFX can't handle Mat objects. First I load an image as a BufferedImage. Then i have to convert this to Mat. Do my image Processing with OpenCV and again convert the result image to a BufferedImage to display in on my UI. Here are the methods for converting Buff to Mat and Mat to Buff I found on the internet:
public static Mat img2Mat(BufferedImage image)
{
byte[] data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
Mat mat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8UC3);
mat.put(0, 0, data);
return mat;
[Code] ....
Next I do some OpenCV stuff:
public static BufferedImage hello(BufferedImage img) {
Mat source = img2Mat(img); //Convert Buff to Mat
BufferedImage outImg = null;
try{
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
[Code] ....
Finally I call the hello method in my controller:
void menuItemTestFired(ActionEvent event) {
try {
result = ImageProc.hallo(bImage);//bImage is an image I've loaded before.
imageView.setImage(SwingFXUtils.toFXImage(result, null));
[Code] .....
Unfortunately I get a lot of errors. Here are the first one:
Caused by: java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(III)J
at org.opencv.core.Mat.n_Mat(Native Method)
at org.opencv.core.Mat.<init>(Mat.java:471)
[Code] ....
Can't figure out why this doesn't work. -.-
View Replies
View Related
Jun 10, 2014
I using this code to fir FlowPane into ScrollPane
FlowPane flowPane = new FlowPane(Orientation.HORIZONTAL);
ScrollPane scroll = new ScrollPane();
scroll.setContent(flowPane);
scroll.viewportBoundsProperty().addListener(new ChangeListener<Bounds>() {
@Override
public void changed(ObservableValue<? extends Bounds> ov, Bounds oldBounds, Bounds bounds) {
flowPane.setPrefWidth(bounds.getWidth());
flowPane.setPrefHeight(bounds.getHeight());
}
});
Unfortunately this maybe is not the best solution. Is there another more simple way to fit FlowPane into ScrollPane in Java 8?
View Replies
View Related
Sep 22, 2014
I'm using WebView to display an OpenLayers3 map, e.g. Animation example from openlayers.org. When I lock my screen and unlock it, none of the openlayers layers are re-drawn. Sometimes bringing the window in to focus or a small resize of the component will cause the map to go blank. This doesn't occur in any browser I've tested, so it seems to be a WebView specific issue, although it also seems to be layer specific and possibly cache related. I've only tested on Windows, 1.7.0_51 x64 and 1.8.0_05 x64 ....
View Replies
View Related
Mar 18, 2015
Unless I missed it, there does not seem to be a Spinner control in SceneBuilder.
Is this right?
View Replies
View Related