JavaFX 2.0 :: Two Finger Gesture Results In Touch Point Sequence
Sep 2, 2014
I'm trying to implement a two finger gesture to move a control for a touch screen. However simply touching the screen with two fingers will generate several events that jump all over the place. This here is the code:
import javafx.application.Application;
import javafx.geometry.Point2D;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
[Code] ....
The log output looks something like this:
Two finger move pressed
First layout: 100.0, 100.0
Move by 94.0, 209.0 event set=4
Move by 1.0, 0.0 event set=5
Move by 95.0, 208.0 event set=6
Move by 1.0, 1.0 event set=8
Move by 96.0, 208.0 event set=11
Move by 219.0, 147.0 event set=11
Move by -121.0, 61.0 event set=13
I know that there is the possibility that I get multiple events with the same event set id. However this is not always the case. I would have expected to get one for each of the finger in the gesture. Why is that? As I understand the difference between changing the layout coordinates and the transformation is, that with the transformation coordinates, the bounds in parent changes, but not the bounds itself.
I'm not entirely clear on what effect this has, especially as I will also have the zoom and rotate gesture on the component. Which one is the better choice to change?To my understanding the coordinates of the touchpoint are relative to the parent component. In this case the layout coordinates of the rectangle. This would mean that I have to calculate the delta of the touch point in the onTouchMoved to the touch point of onTouchPressed.
This would get me the vector the rectangle moved.In the above example I use the main touch point of the two touchpoints of the event. As I understand it this should always be the same one. The correct way would be to calculate the geometric mean of the two points and use that, but that has the same effect. Simplifying the above example to one touch point only shows the same jumping behavior.
View Replies
ADVERTISEMENT
Jun 30, 2014
I'll try to catch gesture events (ZoomEvent, SwipeEvent, etc.) from fx controls (e.g., an ImageView) that are embedded in a JFXPanel. However, no gesture events are thrown for the embedded fx controls.
I've read How to integrate javaFX gesture management in a complex Swing application? and it seems that "there is no gesture recognition in a JFXPanel".
But I've also tried this code SwingHtmlDemo - Pastebin.com that embedds an fx WebEngine in a JFXPanel. In this example, I can Zoom and Swipe the google map displayed in the WebEngine.
My Questions are:
How does the gesture recognition in the WebEngine work?
Can I reuse the gesture recoginition of the WebEngine for other fx controls embedded in a JFXPanel?
View Replies
View Related
Sep 17, 2014
I'm trying to stress test JavaFX and I'm on Window 8.1 using 1.8.0_20-b26. I have an application that has many objects on the scene with animation timers and overall it purposefully runs very slow. I have listeners on the root AnchorPane for touch input and if I generate many touch point events after a few minutes I get "Too many touch points reported" exceptions (posted below) and the app of course no longer responds to touch input. Is it possible to catch the exception and then reset the scene touch input so it goes back to normal without restarting the application? If it lost any current touch input that's fine.
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Too many touch points reported
at javafx.scene.Scene$ScenePeerListener.touchEventNext(Scene.java:2686)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleNextTouchEvent$346(GlassViewEventHandler.java:1090)
[Code]....
View Replies
View Related
Jul 6, 2015
I'm trying to open URL's that the WebView considers Popups (it triggers the PopupHandler installed through onCreatePopupHandler) in an external In the PopupHandler I return a Webengine on which I installed a StateChanged listene and when the State changes to SCHEDULED I run some code top get the location of the WebEngine and open that URL in an external browser and then cancel the loading of the URL by canceling the LoadWorker using the LoadWorker.cancel() method wrapped in a Platform.runLater(..) call (in order to not crash the JVM).
However, then the PopupHandler is invoked because a window.open(url) was called in JavaScript in the main WebEngine, something odd happens: while the canceling of the loadworker was successful (it returns true and the LoadWorker goes to state CANCELLED), all of a sudden the state goes back to scheduled and my StateListener is called again with a newState of SCHEDULED, to if I don't work around it, the URL is opened again in the external browser. I can work around this by keeping track if the URL was already opened in the external browser once, but from what I can tell, this is just a bug.
View Replies
View Related
May 25, 2015
I have a problem in with colissions in JavaFX.
First, I detect a collision between a line and a circle using the follow code:
if(line.getBoundsInParent().intersects(circle.getBoundsInParent())){
System.out.println("Collision!");
}
After this, i need catch the coordinate of collision, like the below figure:
How to catch this coordinate?
[]'s
View Replies
View Related
Mar 2, 2015
I have a shape, Polygon (javafx.scene.shape.Polygon) and want to test whether a point (javafx.geometry.point2D) is contained within the shape. (contains doesn't work)
I can change the polygon to any type, but I need to be able to create it using the 4 corners points and add it as a child to the Pane.
View Replies
View Related
Apr 8, 2015
I create a shape then, them translate shape to another place, how I teste if a point is inside the shape?
Rectangle rect = new Rectangle(20, 20, 100, 100);
rect.contains(21, 21); // returns true
rect.setTranslateX(200);
rect.setTranslateY(200);
rect.contains(21, 21); // returns true!!!
rect.contains(201, 201); // returns false
View Replies
View Related
May 22, 2014
We are doing a visualisation tool for point cloud research project. We use 3d sphere to represent each single point and when we have large number of points to display (~40,000), the rotation becomes very lagging.
What we have tried:
set JVM flag -Djavafx.animation.fullspeed=true, this worked a bit, but not significant.set JVM flag -Djavafx.autoproxy.disable=true, this did not work.
set Cache to true and CacheHint to Cache.SPEED, this did not make much difference.create another thread to do the rotation, and sync back after calculation, this did not work neither.
View Replies
View Related
Nov 30, 2014
I'm doing a program where a user enters in exam results for students. Once he's entered the code, the code should split the results in stars in 4 categories.
I am working with a while loop that prints out infinite results. What I want to do is, if the user enters 2 digits, say "12", it should output 1 "*".
If the user enters "21" and "22", it should output "**".
There are 4 categories of marks which are marked with ints range1, range2, range3 and range4, which are user enter digits. Part 1 of the code is to split the user entered digits into its correct ranges. the ranges are 0-29, 30-39, 40-69 and 70-100. I've done the part where when the user enters a digit, it goes into the correct variable. After that when the user enters a digit over 100, the enter results should show up as stars. For example
Enter number =
21
22
44
66
44
23
11
111 (the 111 is where the program breaks and moves on)
So it should then display
0-29 ****
30-39
40-69 ***
70-100
Whatever I'm trying, it displays an infinite amount of stars. If I try to use break, It only outputs a single star, no matter how many digits I enter
Here is the code
int mark = 0;
int range1 = 0, range2 = 0, range3 = 0, range4 = 0;
int count1 = 0, count2 = 0, count3 = 0, count4 = 0;
while (mark >=0 && mark <=100) {
[Code] .....
"The problem is with the while loop, the one above is something I was experimenting with "
View Replies
View Related
Jun 5, 2014
I was reading the oracle java tutorial under: URL....Here's the code for the Point class:
public class Point {
public int x = 0;
public int y = 0;
//constructor
public Point(int a, int b) {
x = a;
y = b;
}
}
and in the Rectangle class you have the following constructor:
public Rectangle(Point p, int w, int h) {
origin = p;
width = w;
height = h;
If we create a new Point object like this:
Point originOne = new Point(23, 94);
and then a new Rectangle object like this:
Rectangle rectOne = new Rectangle(originOne, 100, 200);
Will that set originOne to point to the object Point at (23, 94). just want to make that this is the meaning of this statement: Point(Point p)Constructs and initializes a point with the same location as the specified Point object.
View Replies
View Related
Jul 19, 2014
My Personal Researches on this topic was ::
1) Use socket programming (i was able to connect to that ip and port but of no use? how to get data ??)
2) A lot of forums suggest the JNI or JNA way.. which i tried out and accomplished a connection to the port.
But the problem was the appoarch i used in JNA which only supports the loading of C/C++ dll files... not C# dll.... the BioMetric Finger Print device is coded in C#...
View Replies
View Related
May 9, 2014
I'm currently meddling with javaScript in order to implement a fingerPrinting system in my web application. I've developed the following example in which I can get all the necessarily data:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
[Code] ....
Which works correctly.
So when I tried to run it in the following page:
<?xml version='1.0' encoding='UTF-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>SET - Simulador Econômico Tendências</title>
[Code] .....
It simply won't work!
The function faz() is called and only the first "alert" popup is called, the second one which should show what is returned by dadosDaTela() isn't generated, why is that?
View Replies
View Related
Aug 21, 2014
I need a java applet source to capture and verification code that i can integrate with html,
View Replies
View Related
Jan 30, 2015
Haven't used java in a long long time and firstly need to know if its possible to build an app to replicate my ipad touch so that I can loop it between two different points on the screen. Friend recommended I got netbeans to get me started but wanted to ensure its possible before I get started.
View Replies
View Related
Aug 7, 2014
I am trying to integrate the finger-print scanner to struts application. I only have it's executable jar file through which the device will operate and the required signature can be taken . I am not getting how to integrate this in my application or in the required jsp page.
View Replies
View Related
Apr 28, 2014
Let's say we have a matrics of coordinates:
(0,0) (0,10) (0,20)
(10,0) (10,10) (10,20)
(20,0) (20,10) (20,20)
And we have a class that draws a rectangle of 10 pixel height and 10 pixel width at 0,0 coordinates.
And we want to move with the arrows the rectangle but not to go off the frame.
The question is:
How can I do that if I draw another rectangle, it knows where is the other object and they not collapse. And so on, they move, but not collapse, just touch and stop.
View Replies
View Related
Dec 27, 2014
I don't know how to write a code to pong ball, when it touch red block.
public class bounc2 extends JPanel implements ActionListener,KeyListener{
double x = 0,y=0,velX=3,velY=3;
double x2 = 5,y2=145,velX2=0,velY2=0;
double x3= 473,y3=145,velX3=0,velY3=0;
Timer t = new Timer(5,this);
public bounc2(){
setBackground(Color.GREEN);
[Code] .....
View Replies
View Related
Jul 16, 2014
I want to make a touchable program to install on my costumer information server that my client can search and register via my local database, how can i do this????
View Replies
View Related
Mar 28, 2014
I know my problem is my lack of understanding of OOP but I have searched for a solution and can't even seem to get close.This is a very simplified version of what I will need to do. I have a button and six textboxes. When the button is pressed I want to take the text from textbox6 and place it in textbox1, textbox2, textbox3, textbox4, and textbox5.
I need sometthing better then this brut force method.Java Code:
package textboxes;
public class TextBoxesGUI extends javax.swing.JFrame {
public String NewText;
public TextBoxesGUI() {
initComponents();
[code]....
View Replies
View Related
Feb 23, 2014
try {
ProcessBuilder PB=new ProcessBuilder("find","/","-iname",""vim"");
PB.redirectOutput(Redirect.INHERIT);
PB.redirectError(Redirect.INHERIT);
PB.start();
}
catch (Exception e) {
e.printStackTrace();
}
It shows nothing. But when I tried
new ProcessBuilder("uname");
I gets a result ....
View Replies
View Related
Jun 12, 2014
I what to check if value is not equal to CharSequence value
I try this but getting error:
Java Code:
private CharSequence testvalue = "";
if (!isEqualTo("BCDEF".contains(testvalue))){
}
public boolean isEqualTo(String s_src, String s_compareTo) {
boolean flag = false;
[Code] .....
View Replies
View Related
Mar 23, 2014
Fibonacci Sequence Code:
public class FibSeqByIanNeumann {
public static void main(String[] args) {
Scanner get = new Scanner(System.in);
int ctr, num1, num2, fib, maxTimes;
System.out.print("How many sequences do you want?: ");
maxTimes = get.nextInt(); //inputs the maxium limit of the fib sequence
[code]....
how to do a simple YES/NO Loop so I can try to have it work on my code if I want to try to do the Fibonacci Sequence again.Now I think it might have something to do with a do/while loop.
View Replies
View Related
Sep 17, 2014
I want to declare integers, while the program is running.
I run the program and then I give it via System.in.println an integer and repeat this as long as I want. I want the program to give those integers a name of a certain type for, for example a(i) or a[i], dunno, (it should be handy) and then a(i) represents the the i'th integer I gave the program. My idea is then that I can use those elements by their name just like, if I had declared them in the first place. For example add two integers together. For example I defined a method add+, which waits for 2 integer and then adds them. For example I write:
add
a(2)
a(47)
(then I would get here the result.)
However I don't know, how to let the program count the number of inputs or how to let it declare and use variables.
View Replies
View Related
Sep 17, 2014
I want to declare integers, while the program is running.
I run the program and then I give it via System.in.println an integer and repeat this as long as I want. I want the program to give those integers a name of a certain type for, for example a(i) or a[i], dunno, (it should be handy) and then a(i) represents the the i'th integer I gave the program. My idea is then that I can use those elements by their name just like, if I had declared them in the first place. For example add two integers together. For example I defined a method add+, which waits for 2 integer and then adds them. For example I write:
add
a(2)
a(47)
(then I would get here the result.)
I don't think implementing the add function is difficult. However I don't know, how to let the program count the number of inputs or how to let it declare and use variables.
View Replies
View Related
Jan 6, 2014
Jdeveloper 11.1.1.7.0
Currently I am having an arrayList which consits of the yearweekno.
Example: 201303, 201402, 201401,201352,201351,201350,201349.
which means 01, 02,52,....48 are the weeknumbers.
No my question is if I have today's date i.e new java.util.Date...i.e week 01.
How do I arrange the ArrayList as below
201403 201402 201401 201352 201351 201350 201349
That is if current yearweek is 201401 then display should be as above(current week+2, current week, currentweek -4).
View Replies
View Related
May 14, 2014
i am trying to run a command in terminal the code is below if i run the command in terminal it works fine however when i run it from netbeans with code below nothing gets printed. however if i run a different command such as (ip addr) it works fine?
public static void a() throws IOException{
ArrayList lister=new ArrayList();
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("ps -ef | grep firefox");// the command i am trying to run to get pid of application
InputStream stderr = proc.getInputStream();
[Code] ....
View Replies
View Related