JavaFX 2.0 :: TreeItem And Custom Rendering

May 31, 2014

I am fairly new to FX but well experienced with Swing. Since I am familiar with the Swing concept of rendering a let's say JTree I got problems with the FX model of - in this case - TreeView.
 
I read several documentations about FX. From the API doc of TreeItem I adapted the file browser example to create an own class like this :
 
public class PathTreeItem extends TreeItem<PathTreeItem> implements
        Comparable<PathTreeItem> {
    private boolean firstVisit = true;
    private boolean readable;
    private boolean dir;
    private boolean symlink;

[Code] ...
 
But this did not change anything. I try to override toString() in both classes but even this did not change anything.
 
What I wonder so far:
 
Why is item in PathNodeTreeCell always null?What is the difference between the item I get in the updateItem method and the one I get from getItem() (line 10)How can I connect the PathTreeItem class to the PathNodeTreeCell classShould I always call super() in the constructors? (I delved a little bit in the sources of TreeItem and TreeCell and I found some setup code there )Is it ok to extend TreeItem in the way I does for my custom PathTreeItem class? ( I wonder if this is a cyclic dependency when I extends TreeItem in this way )How can I sort the nodes? I added the Comparable interface but this not change the sorting of the nodesAre ther some tutorials of TreeItem/TreeCell with no trivial objects like String ? 

I want to adapt an well running Swing application to FX. In the Swing app I used a mechanism to load the child path's of a directory in a separate thread to avoid freezing if the UI if there are much child elements. I guess in FX I should use the Properties pattern to achieve this should I?

View Replies


ADVERTISEMENT

JavaFX 2.0 :: Rendering Text Along A Curve

Nov 8, 2014

I'm currently working on a project which requires to have text displayed along a curve. If found this entry a good starting point. It works fine for me on my develompment machine, however the customer on his machine noticed some issues.

The basic idea is to define a path for the text, explode the text into the separate characters and animate them along the path the fraction of the character of the whole lenght. So with a animation duration of 10 seconds and a label of ten characters, the first character would be animated along 1 second, the second 2, and so forth.

This is done by jumping to the designated time in the animation, start the animation and stop it immediately.

Now the problem as I see it, for stopping the animation a separate timer is used, so it can happen that at the time the animation is actually stopped, the animation moved further than the first frame. The effect is that the last characters of the text appear in front (wrapped around).

As I have no evidence to prove or disprove my theory, what do you think is this plausable? I can see a workaround for this issue by defining a path for each character and then let the animation run to the end. While I can set the duration of the animation to 1 ms which should not be visible to the human eye, I'm not able to make the characters invisible and turn the visiblity on when the animation finishes, they always become visible at the start.

Or create my own animation/transition for placing the characters.

View Replies View Related

JavaFX 2.0 :: Triangle Mesh Rendering

Aug 7, 2014

I'm new to JavaFX and I'm exploring its 3D capabilities, and in particular the TriangleMesh visualisation.
 
I have developed a very basic application, based on the Molecule Sample Application provided in the examples, that read a mesh file generated by an external tool (Gmsh) and displays it. Pretty basic.
 
My problem is that the rendering is not what I expected (see attachement)
  
My guess is that I got something wrong with the texture coordinates or the triangles orientation.

- I don't what to have textures attached to my meshes. These are 3D meshes used for scientific simulation purposes. I thus have set all texCoords to 0.
- I don't control the orientation of my triangles, they are generated by Gmsh. Their orientation is also not interesting for my end users so I would like to display all triangles the same way. I used the meshView.setCullFace(CullFace.NONE); method.

View Replies View Related

JavaFX 2.0 :: HTML Rendering With Webview Component

Nov 14, 2014

I have a big issue to render this html page with the webview component :
 
<html><head lang="en">  <meta charset="UTF-8">  <title>Pb Rotate</title>  <style type="text/css">   #myDivRotate {
color: purple;   background-color: #d8da3d;   height: 200px;   width: 300px;   margin-top: 20px;   margin-left:20px;   -webkit-transform:perspective(400px) rotateX(30deg);   -webkit-backface-visibility: visible;   }
   </style></head><body>  <div id="myDivRotate">   Coucou
   </div></body></html>

The problem is from "perspective" in -webkit-transform. Without it's ok. But with this one, the result is different from a standard browser like chrome or safari.

View Replies View Related

JavaFX 2.0 :: Custom Icons Into Bundle DMG Package

Jul 21, 2014

I created an ant script to create an installer for my JavaFx app:
 
<?xml version="1.0" encoding="UTF-8"?>
<project name="app-javafx" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
    <property name="java8.jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home" />
    <property name="javafx.tools.ant.jar" value="${java8.jdk.home}/lib/ant-javafx.jar" />
    <target name="init-fx-tasks">

[Code] .... 

During compiling I see:

Using base JDK at:

/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk
  Using default package resource [Bundle config file] (add package/macosx/Info.plist to the class path to customize)
  Using default package resource [icon] (add package/macosx/app.icns to the class path to customize)
Creating app bundle: /Users/Utente/Documents/workspaceServer/javafx/target/deploy/bundles/app.app
Config files are saved to /var/folders/q6/vmt_h0tx3rgdbt_4h2_2f3780000gn/T/build6635061168386632777.fxbundler/macosx.

Use them to customize package.
fxbund
ler/macosx. Use them to customize package.
 
So I get files inside the temp directory and I copied them inside my project target directory. Unfortunally javafxbuilder don't use them to customize the package so I think the path where I have to put that files is wrong.

View Replies View Related

JavaFX 2.0 :: Keep Last Button Pressed With Custom Style

Dec 27, 2014

I have a VBox with 20 buttons and I have this style applied (menu.css) (only for VBox wrapper):
 
.button:focused {
    -fx-background-color: #0768A9;
    -fx-text-fill: #FFFFFF;
}

But when I pressed other button outside the VBox the style disappears, because the other button get the focus.

How I can do to keep the last button pressed with a custom style? (Only for buttons containing the VBox).

View Replies View Related

JavaFX 2.0 :: Continuous Drawing In Custom NGRegion

Jul 15, 2014

I am subclassing a Pane to be able to use my custom NGRegion:
 
public class MyPane extends Pane {
@Override
public NGNode impl_createPeer() {       
return new MyNGRegion();
}
}
 
in MyNGRegion i override renderContent(Graphics g) for custom drawing
 
@Override
protected void renderContent(Graphics g) {
/* custom drawing */
}
 
The custom NGRegion gets drawn one time, but i want to continuously draw on every pulse.
 
i already tried a lot of things, but don't see how to do it properly:
 
using -Dprism.forcerepaint=true did not work.

overriding clearDirty() and set it

View Replies View Related

JavaFX 2.0 :: SceneBuilder Custom Types (not Node Derived)

Sep 24, 2014

Adding Node derived objects to SceneBuilder is easy and works fine.
 
I'm wondering how to add non-Node derived objects. It seems to be possible as MenuItem derived objects are listed and can be used.
 
How to add custom types (not Node derived) to SceneBuilder?

View Replies View Related

JavaFX 2.0 :: Custom ComboBox Implementation Not Recognized By Scene Builder 2.0

Jun 3, 2015

I did an implementation which is an extension of javafx.scene.control.ComboBox

Inside I imported the Class ComboBoxListViewSkin

import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin;
 
I think this might be the reason as this comboBox is not recognized at the import to the scene builder library. I can show up the import dialog of custom controls, but my custom ComboBox is not showing up. All other implementations are there correctly as they are loaded from my customControl.jar file
 
I use the ComboBoxListViewSkin for the functionality to scroll to an item in the combo as a user types a letter on the keyboard.

I do this by:

/**
     * This method scrolls the itemView of the items to the first item starting
     * with the given char or string
     *
     * @param pressedKey
     */
    public void scrollToChar(String pressedKey) {
        String value = pressedKey.toUpperCase(); 
        for (Object userEntry : getItems()) {

[Code] ....
 
I really need to show up my custom Combo in the scenebuilder, as otherwise the rest of my fxml is not editable in sceneBuilder 2.0 ....

View Replies View Related

JavaFX 2.0 :: No Tooltip In Custom Control Allowed - Cannot Be Imported To SceneBuilder?

May 21, 2014

If I use an instance of Tooltip in my custom-control, it can not be imported to SceneBuilder any more. Using Tooltip in my custom-control skin works - is that the way it is supposed to be?
 
Background: I have a control (ValidatedTextField) which uses Tooltips to inform about unwanted characters. It works in SceneBuilder1.x.

SceneBuilder 2 does not "accept" this control unless I take out all Tooltips. I have verified this behavior with some other working controls.
 
I have found a workaround to use the Tooltip in the Skin.

View Replies View Related

Storing Custom Object In SQLite DB / Serializing Custom Object?

Jul 13, 2014

I have this arraylist off a custom object that looks like this witch also contains a list off custom objects

package holders;
import java.util.ArrayList;
public class ManufacturingJobHolder {
private String name;

[code]....

View Replies View Related

Rendering Actions In A Combo Box?

Feb 2, 2014

When I add an array of action-objects (the class extends AbstractAction)

to a combo box, I do receive the action performed events, great!

But the combo box items show the long string of the action object, of course!

How to render that string in a way that only the Action.NAME appears?

I was experimenting a little, but could not make it to work:

Java Code: private class ComboRenderer2 extends BasicComboBoxRenderer {
@Override
public Component getListCellRendererComponent(JList list,

[Code]....

View Replies View Related

Rendering The Cells Of JComboBox In Java?

Aug 27, 2014

I have a student class with fields names and Gender. Now, I have a students' array. such that I can create multiple students' classes: student a, student b, student c e.t.c and store them into the students' array. Now, I store this students' array in a JComboBox and want to only display the names of these students in the array. Such that the JComboBox lists only the names of student a, student b and student c. . When a user clicks on a selected Item on the JComboBox, even though, it was a student's name that was selected, I want the selectedItem to be a object of the Student class. This, I have learnt works with JList by writing your own custom JList models and then DefaultListCellRenderer. Is there anyway, one could also do this with JComboBox?

//Main Method
import StudentList;
import Student;
import ViewGui;
import Controller;
public class SwingMainMethod {

[code]....

View Replies View Related

JSF :: CDI With Primefaces Charts Not Rendering Properly

Jun 3, 2014

I have 4 Primefaces bar charts which sometimes renders, sometimes not. In one of them, I inject a http user session attribute and use it to render the chart (the idea is to show only the data that corresponds to the (logged in) user department).

There are 4 session beans which I'm using the javax.enterprise.context.RequestScoped. Sometimes, the Glassfish destroys the instance as expected, but sometimes not.Based on Exception below, how can I resolve it?

The xhtml below shows the main code for only 2 of the 4 bar charts:

<p:tab title="Horas de Treinamento (por Funci)" closable="true" >
<p:barChart id="horasBars" value="#{chartHorasFunci.modelHoras}"
legendPosition="ne"
orientation="horizontal"
seriesColors="AA5555, 00438F"
xaxisLabel="Horas" yaxisLabel="Funcis"
title="34 Horas de Treinamento (Orçado/Realizado) por Funci"

[Code] .....

The Exception:

SEVERE: Error Rendering View[/capacitacao/capacitacao/index.xhtml]
javax.el.ELException: /WEB-INF/include/capacitacao/capacitacao/List.xhtml @145,38 value="#{chartHorasFunci.modelHoras}": org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke private void br.com.bb.upb.diage.atb.capacitacao.beans.ChartHorasFunci.initialize() on br.com.bb.upb.diage.atb.capacitacao.beans.ChartHorasFunci@3e9c727c
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)

[Code] .....

View Replies View Related

JSF :: Element Is Not Rendering / Parsing While Migrating

Jan 24, 2014

I m trying to migrate JSF 1.2 project with myfaces to JSF 2.0 with myfaces 2.0 jars on weblogic10.3 server. Found some problem related build and publishing after resolving them when i hitting my application all JSF html tags are coming in browser as it is they are parsed to html tags. all h: tages are coming as it is on my browser they are not converted to html tags for browser display.

View Replies View Related

JTree Branch Icon Rendering

Nov 12, 2014

I have a problem I must solve and could not find an answer after a couple weeks of research, so here I am. I have created a custom Table Cell Renderer than extends DefaultTreeCellRenderer. The mission of this renderer is to set the branch icons depending on conditional statements. There are 3 conditions, and each one should render a different icon. These conditions must be tested against all branches in the tree. This means that using something like setOpenIcon() and setClosedIcon() will not work since it seems as though these methods set all branches to a specific icon (I could be wrong about that though). Below is the code for my custom. I made comments so it is easier to understand what I want to happen and what is not happening.

/**Custom Cell Render that will set the icons for the tree branches and the leafs*/
private TreeIconCellRenderer extends DefaultTreeCellRenderer{
public Component.getTreeCellRendererComponent(JTree tree, Object value,boolean selected,boolean expanded, boolean leaf, boolean row, boolean hasFocus){
//Get defaults in case there is no need to renderer

[Code] ...

What I really need to know is why the renderer is not differentiating between the leaves and branches. The logging statements I have added confirm that the branch block of code does not execute.

View Replies View Related

JSF :: Rendering A Page Using EJBs Between Separate Applications

Oct 16, 2014

I would like users in an application to be able to access and edit their user profiles (Application A). The problem is that the user objects (entities, dao, beans) are handled in a separate application (Application B) which is specifically for managing user accounts. Importing the java sources for App B into App A could be messy and might need configuration of the persistence unit and connection. I'm thinking it would be better to inject an EJB from App B to App A to query the user DB and return the results so a user profile form is rendered in App A.

I know how to inject EJBs within the same application, but I'm not so sure about how it's done across different applications or even if that's the most advisable way to achieve what I want. it's better practice to inject an external EJB into App A or simply import the classes from App B and use those.

@Stateless
public class UsersDaoImpl implements UsersDAO {
@PersistenceContext
private EntityManager em;

[code]....

View Replies View Related

Rendering Multiple Image Objects From Array In Location

Jan 11, 2015

Untitled.jpg I have been working over this game lately, and i have managed to render multiple images from an array. in this fashion. I created a Main() class with the following in it:

public Main() {
for (int i = 0; i < fuel.length; i++) {
Random r = new Random(); 
changef = r.nextBoolean();
y = (-600 * i) + r.nextInt(300);
if (changef)
fx = 325;
else

[Code]...

Also, this is the Fuel image class and Obstacle image class:

public void tick(Player2 p2) {
y += dy;
Random r = new Random();
if(x >= p2.getH()) {
y = -40 - r.nextInt(700);

[Code]...

(Fuel and obstacle class are identical but separate for better accessibility) I even have player class with an image listening to key events and also a scrolling background. The problem is when i run the game, the images of obstacles render themselves as i want, except for that they overlap each other, i need to prevent over lapping of this images. The fuel is read and obs is black. Heres a glance of how it looks.

View Replies View Related

Java 1.8 - Rendering Images To Printer / Result Is Not Good

Feb 10, 2015

I have some troubles rendering images to the printer, any resolution does not work, even 72 in PDF printer does not work, the image is crappy.

I use the following code but the result is not good. I mean the image quality is not acceptable.

img=new ImageIcon("c:\test\m.jpg").getImage();
scale=72/300d;
g.scale(scale,scale);
g.drawImage(img, 0, 0, (int) (img.getWidth(null)/scale), (int) (img.getHeight(null)/scale), null);

I've also tried :

img=new ImageIcon("c:\test\m.jpg").getImage();
AffineTransform aft=g.getTransform();
double scale=aft.getScaleX();
g.scale(scale,scale);
g.drawImage(img, 0, 0, (int) (img.getWidth(null)/scale), (int) (img.getHeight(null)/scale), null);

The result is the same even if I change the image, very poor and unacceptable!

View Replies View Related

Rendering Images Of Type BufferedImage - Pixels Are Not Consistent In Size

Jun 26, 2014

As implied by the title, when I am rendering images of the type "BufferedImage" unto a Swing application, the images' pixels are not consistent in size. Some might be larger than other, and some might be smaller than other.

Here is a screenshot of what I am talking about (you might need to zoom in a bit because the image is so small): [URL] ....

And here is also some code for you. The images are actually from a sprite sheet, which I first load in its entirety and then split up in an array.

Java Code:

public static BufferedImage sprites[];
...
public void loadSprites(){
try{
BufferedImage bigImage = ImageIO.read(new File("SOURCE/BLA/BLA/THIS/IS/ACTUALLY/NOT/THE/REAL/SOURCE/IN/CASE/YOU'RE/WONDERING/I/JUST/DON'T/WANT/YOU/TO/FIND/ME/AND/RAPE/ME"));
sprites = new BufferedImage[16 * 16];

[Code] ....

So, how do I make the pixels equally small?

View Replies View Related

2D Tile Game Lag (Caused By Loop) - Rendering All Tile Rectangles

Jan 18, 2014

So the following is my code for the Terrian Generation of my game, however the way i have it rendering all the tile rectangles as opposed to just rendering whats visable on my JFrame causes lots of lag.

These are the variables and Rectangles inside _TerrianGen.class

//CHUNK
static int chunkx =2048;
static int chunky =2048;
 
//RECTANGLES
public static Rectangle[][] tile = new Rectangle[64][64];
static int[][] blockType = new int[64][64];
//0=Grass 1=Dirt 2=Stone 10=Brick 11=Coal 12=Iron 21=Gold 22=Diamond -1=null

This is the Init() code

for (int x =0; x < chunkx-32; x+=32){
for (int y=0; y < chunky-32; y+=32){
tile[y/32][x/32] = new Rectangle(x, y, 32, 32);
blockType[y/32][x/32] = -1;

[Code] ....

View Replies View Related

JSP :: Custom Tag Not Called At All

Jun 30, 2014

I am working on a project that uses a custom tag in a JSP file. Here is the tag descriptor

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0.0</tlibversion>
<jspversion>1.1</jspversion>

[code]...

Everything seems working fine except that the custom tag handler does not get called at call. I set breakpoint and it never stops there. The JSP page is displayed fine, only not showing the custom tag content and there is no logged error/warning from the log. The tld is found fine. Like what classes called/validated the tag handler so I can logging those classes at DEBUG level to see what goes wrong.

View Replies View Related

JSP :: How To Create A Custom Tag

Apr 22, 2015

I would like to create a custom tag which works similar to <c:forEach/> tag i.e

<c:forEach var = "movie" items = "${collection}>
${movie}
</c:forEach>

I would want to create the similar behaviour(as above) in my own custom Tag.Morever I would like to use the doStartTag() and doEndTag() and doAfterBody() methods while creating custom Tag.

View Replies View Related

JSP :: Dropdown Box Using Custom Tags

Mar 19, 2014

My jsp page needs to have a dropdown box. on selecting one/more than one values from this list, the same values get populated in another one.. we have a delete button too , it allows to populate the second box again.

The thing is i am to avoid scripts and use custom tags as much as i can...

View Replies View Related

Implementing Custom Map Interface

Nov 5, 2014

I am supposed to implement a custom Map interface and I'm having some trouble with this method:

// 1. From the interface
/**
* Gives an iterator iterating over the key set from the smallest key that is not less than the key provided.
* @param key the key
* @return the iterator
* @throws NullPointerException if key == null
*/

public Iterator<Key> tailIterator(Key key);

[Code] .....

My implementation is wrong according to a JUnit test. Also, to get a full score this method should have a worst case running time of O(log N), which obviously isn't the case now. (My Map implementation is currently based on binary search in an ordered array, keeping a prallel array for the values).

View Replies View Related

Counting Using Custom Scale

Aug 6, 2014

I'm having trouble creating a highly efficient algorithm for counting within a custom scale. This problem applies to futures trading, specifically treasuries contracts.

One specific treasury contract has 32 units before rolling over to the next whole number. So, the price scale looks something like this ...

1 0
1 1
1 2
...
1 29
1 30
1 31
2 0
2 1
...
2 30
2 31
3 0
...

If I pick a number (price) at random, let's say 1 28, and I want to add 8 units to that value, I should end up with 2 4. I can do this using brute force, calculating remainders, etc, etc....

View Replies View Related







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