JavaFX 2.0 :: VRML - Unit Of Measure Convention In 3D?

Apr 12, 2015

When creating VRML, there is a convention that one unit corresponds to 1 metre in the real world. This makes sharing models easier. Is there any similar convention for JavaFX 3D?

View Replies


ADVERTISEMENT

How To Call EnrolStudent Method On Unit Constructor In Another Class When Create A New Unit

Mar 29, 2014

public Unit(String code, String name)
{
enrolStudent(student);
this.unitCode = code;
this.unitName = name;
}
public void enrolStudent(Student newStudent){
students = new ArrayList<Student>();
newStudent = new Student(24662496, "Kingsley", " Iwunze");
students.add(newStudent);
}

how can I call this enrolStudent() method on this Unit constructor in another class when I create a new Unit. all I need is to enroll students in units when units are created. below is my create unit method.

public void createUnits( ){
units = new ArrayList<Unit>();
units.add(new Unit("FIT2034", "Java Programming 2"));
units.add(new Unit("FIT2024", "Software Engineering"));
units.add(new Unit("MAT1830","Discrete Maths"));
unit.enrolStudent(new Student(25486321, "Julia", "Garcia"));
unit.enrolStudent(new Student(44589736, "James", "Olivia"));
unit.enrolStudent(new Student(47852103, "Lucky", "Thyriod"));
}

View Replies View Related

Measure Current Download Speed Of File?

Jan 5, 2014

Is there a way to measure current download speed of a file being downloaded? I've searched all over google and the only thing i get is average download speed. This is basically how it is being done, the result is average download speed.

Java Code:

OutputStream out = null;
URLConnection conn;
InputStream in = null;
long startup = System.currentTimeMillis();
try {
URL url = new URL(adress);
out = new BufferedOutputStream(

[Code] .....

View Replies View Related

EJB / EE :: JTA And Dynamic Persistence Unit?

Jan 26, 2015

In my application, users select the year and manage data for that year (for example, they can choose 2014 for managing invoices for 2014, then switch to 2015 and work with that year). Each year as his own database.

I'am able to change persistence unit connection at runtime with Persistence.createEntityManagerFactory(PU_NAME,map_with_connection_info) This procedure build a non-jta environment.

It is possible to create entityManager / entityManagerFactory with JTA ?

I don't want to create new persistence unit each year or each time a new database is required.

View Replies View Related

Shifting Row From 2D Array Down One Unit?

Feb 24, 2014

So I have this 2D array that contains some Object foo.

[f] [f] [f][f]

[3][3][3][3]

[b][b][b][b]

[x][x][x][x]

[ ][ ][ ][ ]

[ ][ ][ ][ ]

[ ][ ][ ][ ]

I want to shift all the rows down one unit, starting for the rows containing x. So the x row is first shifted to row 4. then the b row shifted to where the x row was, row 3 and so on. My question is:

1. How can I check if the next row is empty

2. How do I shift a row down

Here's my attempt:

Java Code:

//board is the 2D array defined elsewhere
public void shiftRowDown(){
int counter = 0;
int rowCounter = 0;
for (int i = 0; i < this.board.length; i++) {

[code]....

Is this correct.

View Replies View Related

Website Interaction Using HTML UNIT

Apr 23, 2015

I am having a difficult time trying to get results from the code below. The purpose is for my program to insert the DHL tracking number in the tracking text box, and then for the program to "click" the search button and get the tracking results.

This is the code:

import com.gargoylesoftware.htmlunit.WebClient;
import java.io.*;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import java.net.*;
public class DHL {

[Code]...

These are the results I am getting in the console (in red), which look like an error:

Apr 23, 2015 7:55:49 PM com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement addbehavior
WARNING: Unimplemented behavior: #default#userdata
Exception in thread "main" com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName=[*] attributeName=[name] attributeValue=[sbtc]
at com.gargoylesoftware.htmlunit.html.HtmlPage.getElementByName(HtmlPage.java:1747)
at htmlTest.main(htmlTest.java:17)

I just cannot figure it out for the life of me. Also, is there a community that focuses on HTML Unit?

View Replies View Related

EJB / EE :: Bean Annotations And Unit Testing?

Mar 6, 2014

I have a bean that represents data been collected from a form on a jsp page. Currently I would like to validate my fields and write some test cases for them. As you can see from my test case example I test a string in the hope that it fails because it contains only one letter. My problem is my unit test is passing. The reason this is from what I can tell is that at runtime it fails when I try to persist my object using my entity manager. During my unit test I just I don’t call my entity manager I just try and set the field.

What I thought would happen was that when I use my bean fields set method the annotations would be checked and fail at that point. Hence why I expected my unit test in this case to fail.

What I would like to know is

1.Are annotations specifically designed to validate when I persist my object and am I using them incorrectly at this point?

2.Is this the best method to use to validate fields, is there a better way, should I write my own code to validate for me when I set my value?

a. Should I throw an exception from the set method of each bean field?

Unit Test:

@Test
public void testName(){
Human h=new Human();
try {
h.setFname("a");
} catch (Exception e) {
// TODO Auto-generated catch block
fail("failed");
e.printStackTrace();

[code]....

View Replies View Related

Time Unit Conversion Program

Feb 8, 2015

So, here is the question I have been working on: Write a java class named Time that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (For example the elapsed time is 9630 seconds, and then the output is 2:40:30 ).Hint: an hour has 3600 seconds and a minute has 60 seconds. Use Scanner class for reading the input.

Here is my code:

import java.util.Scanner;
public class Time {
public static void main(String[] args) {
Scanner scan= new Scanner(System.in);
System.out.println("Enter the elapsed time in seconds:");
int totalseconds= scan.nextInt();

[Code] .....

Now, I know I am supposed to use the remainder operator to figure out the time in minutes and seconds, but the hours has be a little confused. Right now this code compiles but gives me an exception.

View Replies View Related

EJB / EE :: How To Unit Test MDBs And Session Beans

Apr 18, 2014

What are the best practices for unit testing MDBs and session beans ?How can they be tested without running an application server ?

View Replies View Related

Write Unit Tests When Some Other Classes Are Involved And Abstraction Is Much Higher?

Mar 5, 2015

I have two classes Person and Group. Group object is suppose to contain many Persons, How can I write unit tests when some other classes are involved and abstraction is much higher?

View Replies View Related

Calculate Possible Tiles Clicked Unit Can Be Moved On And Display It To Player

May 15, 2014

Alright, so I'm having problems with lines 11 - 55. I'm trying to calculate the possible tiles the clicked unit can be moved on and display it to the player.

The field is a 9 (columns) by 5 (rows) grid. A unit with can move tiles horizontally or vertically based on its movement.

Example: (unit = o; possible tiles = x) (assuming movement of 2).

[ ][ ][ ][ ][x][ ][ ][ ][ ]
[ ][ ][ ][x][x][x][ ][ ][ ]
[ ][ ][x][x][o][x][x][ ][ ]
[ ][ ][ ][x][x][x][][ ][ ]
[ ][ ][ ][ ][x][ ][ ][ ][ ]

I tried to calculate movement by finding out what column the unit is in, subtracting the column it wants to go to, multiplying the difference by *-1 if the difference is less than 0. Then, doing the same with rows and adding the difference of columns to the difference of rows and comparing it to the unit's movement. Unfortunately, with my code, it seems to move in any directions.

@Override
public void mouseClicked(MouseEvent e) {
if (Main.cards.size() > 0) {
mainloop: for (int i = 0; i < Main.cards.size(); i++) {
Card c = (Card) Main.cards.get(i);
int startingColumn = 0;

[Code] ......

View Replies View Related

Getting NullPointer Exception In Unit Test At Activemq Connection Factory Creation

Dec 2, 2014

I have the following unit test that gives me a null pointer exception. The debugger goes to the finally block right after the line that creates a connection factory. Here's the test:

@Test
public void receiveMessage() throws Exception {
MessageConsumer consumer = null;
ConnectionFactory connectionFactory = null;
Connection connection = null;
Session session = null;
Destination destination = null;

[code]....

View Replies View Related

JavaFX 2.0 :: Stage Always On Top

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

Difference Between JavaFX And Swing?

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

How To Convert Java App To JavaFX App

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

JavaFX Will Not Display Image

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

JavaFX Get Coordinates From Path?

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

New Object JavaFX With Scenebuilder

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

JavaFX 2.0 :: Navigating Between Views

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

JavaFX 2.0 :: Using CSS Sub-structure On Own Nodes

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

JavaFX 2.0 :: How To Get Actually Typed $ From KeyPressed

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

JavaFX 2.0 :: How To Get Text From TextFlow

Sep 5, 2014

I would like to extract text (String) from a TextFlow control.

View Replies View Related

JavaFX 2.0 :: Is It Possible To Create Dynamic GUI?

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

JavaFX 2.0 :: How To Save Image As JPG

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

JavaFX 2.0 :: BufferedImage To Mat - OpenCV

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

JavaFX 2.0 :: Fit FlowPane Into ScrollPane

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







Copyrights 2005-15 www.BigResource.com, All rights reserved