JavaFX 2.0 :: Setup CellFactory Of TreeView?
Jun 5, 2014
I create my own TreeCell class to customize the look of the tree items of a TreeView which is displaying java.nio.file.Path information.
To setup the CellFactory of the TreeView I used the following:
pathTV.setCellFactory( (TreeView<Path> tv) -> {
return new MyCustomTreeCell();
} );
This works... Now I tried to do some other things with my custom tree cell class so I created an instance of it
MyCustomTreeCell mctCell = new ...
Later I changed the code to setup the CellFactory
pathTV.setCellFactory( (TreeView<Path> tv) -> {
return mctCell;
} );
This doesn't work ... I did not see anything in my TreeView...
Here is the MyCustomTreeCell class:
public class MyCustomTreeCell extends TreeCell<java.nio.file.Path> {
private final ImageView icon;
public MyCustomTreeCell() {
super();
icon = new ImageView();
[Code] .....
View Replies
ADVERTISEMENT
Jun 12, 2014
I want to create mouse click event. I tested this code but I cannot make it work:
treeView.setCellFactory(new Callback<TreeView<DynamicTreeNodeModel>, TreeCell<DynamicTreeNodeModel>>()
{
@Override
[Code].....
View Replies
View Related
Jun 2, 2014
I want to ask if there is an option to set the vertical position of the node handles of the TreeView-control.
I used a custom TreeCell factory with icons of sizes between 24 and 64 pixel and the location of the handle is regardless of the size of the icon on top of the cell. So if you got large icons the view did not look so nice.What I want is a property or something to center the handle in the cell depending on the size of the cell. Is there such an option?
View Replies
View Related
Jun 3, 2014
Is there some equivalent of the Swing TreeWillExpand-listener for TreeView?
In my particular case I want to check whether some constrains are set to show some children before they will populated in the view.
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
Jul 14, 2014
How do I keep an item (TreeItem) from being selected when performing a drag -n- drop? I don't want it to be selected because it will end up making the target disappear (selection of TreeItem changes target panel).
Related question: Is there a way to "veto" a tree selection change as well?
View Replies
View Related
Oct 31, 2014
I have a case where I have a TreeView and I use it to select items from the tree. After I select each item I then clear the TreeView selection. Then, when I select outside of the window, the setFocused is called which in turn selects item 0 from the tree. I see in the TreeView.java the code,
private InvalidationListener focusedListener = observable -> {
// RT-25679 - we select the first item in the control if there is no
// current selection or focus on any other cell
MultipleSelectionModel<TreeItem<T>> sm = getSelectionModel();
FocusModel<TreeItem<T>> fm = getFocusModel();
[Code] .....
Is there anyway to suppress this behavior?
View Replies
View Related
Jul 12, 2014
Any documentation that deals with assigining an icon to your application? I have tried the:
"stage.getIcons().add(new Image(this.getClass().getResourceAsStream("myicon.png")));"
Code as suggested on the web. It looks like this changes the icon in the window decoration only, which doesn't actually show on my Ubuntu desktop with Unity. What I really want is a custom icon for when I alt-tab through open applications. Currently it shows the default grey question mark. How do I assign an icon to the application.
View Replies
View Related
Jun 5, 2014
I try to bind the text-property of a selected cell of a TreeView to a label. So if the user click on a cell in the treeview the label should show the cell text. Now I am quite confused about the options I got to do so. Should I use label.textProperty().bind( ... ??? ... ) The treeview.onMouseClicked()property? or something different?
View Replies
View Related
Apr 18, 2015
Right now it displays a number like this "$25.0" and I want it to display it like this "$25.00" and don't know how to do it.
View Replies
View Related
Apr 30, 2014
I am trying to set a picture in the background of my GUI. I had already made the GUI with the all the required buttons and labels. So I was trying to separately make a class which extends JPanel and add a picture to a panel by overriding the paintComponent() method, and then added it to a frame (I did not set the default layout of the frame, so it was the default...), and it worked very fine. Here is the code:
Java Code:
private BufferedImage image;
public ParentPanel() {
try {
image = ImageIO.read(getClass().getResource("/com/dev_nna/scheduler/UI/1405188.png"));
} catch (IOException ex) {
ex.printStackTrace();
[code]....
Then I needed to add this panel with background picture to the background frame of my already made frame with all the buttons on it.The layout of the parent frame of my GUI was BorderLayout(50, 50), panels (with buttons) were added to it n the north and south positions.
Then I tried to add a JPanel with the background image to the parent frame (of my GUI), (I wanted it to elapse the entire frame, and come under all the buttons and controls, which were only present in the north and south positions of the border layout), and then the panels holding the buttons to the north and south postions of this panel, everything disappeared.
If I don't do anything except adding this panel with the background image to the parent frame, it only takes up the place not taken up by the two panels on the frame (Border Layout)
how to add this panel to the parent frame of my GUI such that it elapses the entire parent frame's background, and the panels containing the buttons should sit on it.
IMPORTANT PARTS OF CODE:-
Java Code:
//TOP LEFT PANEL
JPanel topleftpanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
parentPanel_top.add(topleftpanel);
topleftpanel.setOpaque(false);
[code]....
View Replies
View Related
Jul 20, 2014
I am new to Java. I am from .net background.I am trying to setup Sonar server. In one of our training sessions on Sonar, the instructor did the anaysis of solution using pom.xml file and then calling mvn sonar:sonar. I am trying to replicate the entire setup locally.
1. I installed JRE 7. When I run , java -version, it shows,
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
2. I download sonar 3.5 and extracted it to new folder
3. In that folder I installed sonar-runner 2.4
3. setup the path and sonar_runner environment variable
4. downloaded jtds-1.3.1 and placed the jar file in mssql folder of sonar
5. I create database sonar with username and password as sonar
6. changed sonar-runner.properties for sql server connection
7. changed sonar.properties for sql server connection
8. Ran Sonar.bat and found that it created tables in the sql server db. To me the command prompt seems like it is hanging as after creating table graphs, the last line is
"jvm 1 | 2014-07-20 13:03:34.967:INFO::Started SelectChannelConnector@0.0.0.0:
9000 "
Is it supposed to stay like this always or should i closed this command prompt by pressing CTRL+C?
9. Now when i run mvn-sonar:sonar, it says mvn is not recrognizes as internal or external command. A quick search on google showed that I need to install Apache maven something I belive. What is this or how do I solve this issue so that the command mvn sonar:sonar can work?
10. I would like to use c sharp ecosystem plugin. But when I browse to C# Plugin - SonarQube - Codehaus , I am confused as what to select? i.e. version 3.2, 3.1, 3.0
11. So if I do a system restart and everytime I have to use sonar, should i run sonar.bat and then do mvn sonar:sonar after modifying the pom.xml file?
View Replies
View Related
Aug 21, 2014
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
View Replies
View Related
Mar 26, 2014
First I was using this way how to get connection and all was fine.
con = DriverManager.getConnection("jdbc:derby:memory:datab;create=true");
But now I have to change it to DataSource and how I find out derby had class ClientDataSource for this but for the hell I can't find out how to setup that virtual DB.
ClientDataSource ds = new ClientDataSource();
con = ds.getConnection();
View Replies
View Related
Feb 16, 2015
I've setup an array that I would like to analyze by adding up the contents of each column, however, the out of bounds exception pops up when I try to execute the program. I know the book usually expresses this operation the other way around, where the row is the argument of the first for statement, but I've set my array up where I need to add each row before moving to the next column.
vowelCounter is a 5x3 array.
// Display the line which had the most number of vowels
public static int maxVowelSentence() {
int max = 0, sum = 0;
int sentence = 1;
for (int row = 0; row < vowelCounter.length; row++) {
max = vowelCounter[row][0];
[Code] ....
View Replies
View Related
Aug 21, 2014
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
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