JavaFX 2.0 :: Combobox - Visible Count Row Not Applied And Doesn't Change

Oct 15, 2014

I have noticed a strange behavior of Combobox element. The number of visible rows is not the same established by setVisibleRowCount() method. It happens when changing the items list dynamically. The following example reproduces it. I think it is Javafx 8 bug. I have tried unsuccessfully to trigger some event indirectly to refresh the combobox drop down.

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TestComboBox extends Application {
    private int count;

[Code] .....

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: Panel Doesn't Refresh When New Component Added If Smaller Than Largest Visible Component

Jan 26, 2014

I have a JPanel that's using a simple GridBagLayout.

JPanel panel = new JPanel();
GridBagLayout qPanelLayout = new GridBagLayout();
qPanelLayout.columnWidths = new int[] { 0 };
qPanelLayout.rowHeights = new int[] { 0 };
qPanelLayout.columnWeights = new double[] { Double.MIN_VALUE };
qPanelLayout.rowWeights = new double[] { 0.0 };
panel.setLayout(qPanelLayout);
componentCount = 0;

Based on user input I am adding sub-panels to the panel. These sub-panels may vary in height. They take up the full width of the Panel.

public void add(Component comp) {
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(2,2,2,2);
gbc.gridx = 0;
gbc.gridy = componentCount++;
panel.add(comp, gbc_questionPane1);
}

The odd behaviour I'm seeing is that if the height of the new sub-panel I'm adding is less than the height of the largest sub-panel currently displayed then the main panel does not repaint. If its height is equal or greater then the Panel does repaint, and any sub-panels that were added but not visible before are now painted. What have I missed?

View Replies View Related

Combobox To Change Color And Shape

Nov 19, 2014

i java a project with java draw golf course and currently working on 2 combo boxes to change shape of the flag on the post and fill color as well on combo box item change. I have below code. as am new to java what to do next.

import java.awt.*;
import java.awt.event.ItemEvent;
import javax.swing.*;
public class GulfCourse extends JPanel{
public void paintComponent( Graphics g){
super.paintComponents(g);
//draw green oval

[Code]...

View Replies View Related

String Counter Doesn't Count Appropriate Strings Properly

May 11, 2014

I have this source code that is supposed to count the repeated occurrences of certain strings in the text file, "string.txt". The contents of the file are listed below:

AA-AB-AC-AG-AE-AL
AL-AQ-AE-AN-AO-AM
AM-AQ-AO-AA-AB-AC
AD-AJ-AK-AI-AM-AO
AN-AH-AC-AA-AP-AQ
AP-AP-AN-AN-AL-AP
AN-AD-AU-AE-AH-AQ
AK-AQ-AE-AL-AE-AA
AA-AJ-AB-AG-AE-AF

[code]....

View Replies View Related

JavaFX 2.0 :: TableView - Keeping Track Of Topmost Visible Row

Apr 1, 2015

I have a TableView and it is scrolled to have some rows visible. Lets call the top visible row T, and the bottom one B.

I now replace the items in the TableView with a whole new list of items (so new data to view), but I want to scroll back to either T or B.

It seems to me that I have to somehow keep track of the topmost visible row, or the bottom-most visible row, but I can't figure out how to do that.

View Replies View Related

JavaFX 2.0 :: How To Dynamically Load Image Into TableView When Its Row / Cell Becomes Visible

Jan 24, 2015

I am building an application that shows tables with large amounts of data containing columns that should display a thumbnail. However, this thumbnail is supposed to be loaded in the background lazily, when a row becomes visible because it is computationally too expensive to to this when the model data is loaded and typically not necessary to retrieve the thumbnail for all data that is in the table.
 
I have done the exact same thing in the past in a Swing application by doing this:
 
Whenever the model has changed or the vertical scrollbar has moved:

- Render a placeholder image in the custom cell renderer for this JTable if no image is available in the model object representing the corresponding row
- Compute the visible rows by using getVisibleRect and rowAtPoint methods in JTable
- Start a background thread that retrieves the image for the given rows and sets the resulting BufferedImage in a custom Model Object that was used in the TableModel (if not already there because of an earlier run)
- Fire a corresponding model change event in the EDT whenever an image has been retrieved in the background thread so the row is rendered again
 
Btw. the field in the model class holding the BufferedImage was a weak reference in this case so the memory can be reclaimed as needed by the application.
 
What is the best way to achieve this behaviour using a JFX TableView? I have so far failed to find anything in the API to retrieve the visible items/rows. Is there a completely different approach available/required that uses the Cell API? I fail to see it so far.

View Replies View Related

Looping Doesn't Change Value

Apr 28, 2014

Write a program that asks the user for the low and high integer in a range of integers. The program then asks the user for integers to be added up. The program computes two sums:

The sum of integers that are in the range (inclusive), and the sum of integers that are outside of the range. The user signals the end of input with a 0.

Your output should look like this:

Sample input/output

In-range Adder Low end of range: 20
High end of range: 50
Enter data: 21
Enter data: 60
Enter data: 49
Enter data: 30
Enter data: 91
Enter data: 0
Sum of in range values: 100
Sum of out of range values: 151

This is my assignment and below is my code.

import java.util.Scanner;
class InRangeAdder {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
int low, high, data=1, rangesum=0, outrangesum=0;

[Code] ....

The problem is that the program simply gives an output of 0 for both "rangesum" and "outrangesum". I don't quite understand why that is. Also i have a quick question, the program needs me to end the program when the value of data is 0 but in order to initialize it I need to give it a value. Usually I would give it a value of 0 like I have for rangesum and outrangesum but if I do the program does not run till the loop as it considers the value of data to be 0 and ends the program right away. What would be a work around to this and when do I need to have a value to initialize an integer? for example, I do not need a value for low and high. Is this because the program recognizes that a value is going to be defined but cannot do that for the other integers as they are inside a loop?

View Replies View Related

Array Doesn't Change From Default Entries

Dec 7, 2014

I have a 2d array that i am manipulating. In my class i have a constructor that takes the dimensions of the array and within th econstructor i need to randomly fill the array. However, when i try to manipulate it in the test program, all that prints out are the default values.

here is the class

import java.util.*;
import java.lang.Math;
import java.util.Arrays;
import java.util.Random;
class SummerStats

[Code] .....

And here is the printout

Enter number of rows(people):
3
Enter number of columns(years):
3
Enter number of person to find sum salary:
1
Enter year to find Max salary of that year:
1
[]
[]
The max salary is at index: (0, 0, )
The largest salary ocurred in year: 0
The sum of person 1 is: 0.0
The total of all salaries is: $0.0
The max salary in year 1 is: 0.0
The average salaries for each year:
0.0, 0.0, 0.0,

The total salary for each person is recorded below.

And the last method called doesn't finish or printout ie the program doesnt end

View Replies View Related

JavaFX 2.0 :: Set Default Skin With ComboBox

Aug 4, 2014

I would like to change the default skin of JavaFXapplication during runtime. How I can do this using ComboBox? Now I use this code to change the value:
 
setUserAgentStylesheet(STYLESHEET_MODENA);
 
Is there a way to change the skin in a run time?
 
Ref Set default skin in JavaFX with ComboBox - Stack Overflow

View Replies View Related

JavaFX 2.0 :: Combobox Inside A Tablecell

Mar 24, 2015

I have a combo box inside a table cell for each row. I have defined a value change listener for each combobox. Whenever the combo box value is changed, the selected item is placed inside a MAPVOBean. The problem i am facing is when the user scrolls Up and down the tableview , the change listener is fired even without clicking on it the explicitly, and this changes the my value in my data structure. How to handle this. The source code is attached.

My Model:

Person class

Has first name, last name and MAPVOBean.

Address is stored in a MAPVOBean. It has a map and key is house number and the value is the state where the house is. It is assumed that the person can have one house in each state.

Columns in table view:

Column 1: First Name
Column 2: Last name
Column 3: State combo box. This shows the state in which the person owns a house. 

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package taleviewtester;
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;

[Code] .....

View Replies View Related

JavaFX 2.0 :: Combobox In Subscene Is Not Working

May 9, 2014

In the below example i'm trying to add a combo box inside a subscene. But it is not working correctly .If I select a value from the combo box ,it's is not set in the combobox and the combobox values are not displaying properly.
 
package javaFxExamples;                   
import javafx.application.Application;
import javafx.beans.binding.When;  
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;   

[Code] .....

View Replies View Related

JavaFX 2.0 :: ComboBox Caret Position

Feb 23, 2015

I am developing a form with ComboBox as a subject (the user can choose one from the list , or type one) and TextArea where the user can write his notes (attached a picture). The user using a virtual keyboard (touch) to enter any characters.
 
I am using the append method to append the next Char to the TextInputControl class (both Combo and TextArea Inherit from it). When I try to deletePreviousChar() in the TextArea it works, but in ComboBox it fails

I put some System.out.println() to see what is the problem and it seems that with the ComboBox the class is loosing the Caret position after every action
 
Here is my code: (Look it also as a attached picture)

public void changed(ObservableValue<? extends String> observable,
  String oldVal, String newVal) {
  if (newVal != null) {
  if (lastNodeInFocus instanceof TextArea) {
  switch (newVal) {

[Code] ....
 
Here is the Debug results:  CB = Combo  TA = TextArea  B=Before  A=After , the numbers are the caret position (also attached as a picture )

CB - append B 0
CB - append A :1
CB - append B 0
CB - append A :2
CB - append B 0

[Code] ....
 
combo caret code.png
33.5 K

combo caret debug results .png
9.9 K

my form.png
28.4 K

View Replies View Related

Why Reference Node Doesn't Change It Value In Binary Search Tree

Feb 10, 2015

the problem was :

i wrote it on paper with my examples.and just for laughts , i uploaded another picture that dont belong to my problem. its just my way to understand binary search tree implementation , so i wanted so share.just for laught : looks like the map of the universe.

now my problem : why after i changed Current to Current.left, Parent still has the value of root. i draw and wrote it on a paper. to be clear as possible - picture 2 :

View Replies View Related

JavaFX 2.0 :: Sizing Width Of ComboBox Based On Items

Apr 16, 2015

I have a ComboBox -- just a simple ComboBox with string items.
 
My string items aren't very long (5 letters max), but the ComboBox shows quite wide relative to my strings. So I would like to size my ComboBox to the size of my strings.
 
I messed around with setting the CellFactory of the ComboBox, and have the Cells produced by the CellFactory set the preferred width of the cells to some constant like 100. That worked in terms of changing the size of the ComboBox to the preferred width of 100.
 
But what I really want to do is to compute the preferred width from the string items. For that I need to be able to compute how wide a string item will be when rendered. And I guess that depends on the font size used by the ComboBox to render strings, which probably depends on the platform (OS X different to Windows?).

View Replies View Related

JavaFX 2.0 :: How To Properly Customize Text Label Of ComboBox

Jun 8, 2014

Switching from Swing to JFX 8, I am trying to find out how to do something I would normally do in a super-simple ListCellRenderer, i.e. customize the String displayed for an item. I tried this:

ComboBox<Integer> combo = new ComboBox<>();
    combo.getItems().addAll(1, 2, 3);
    combo.setCellFactory(new Callback<ListView<Integer>, ListCell<Integer>>() {
        @Override
        public ListCell<Integer> call(ListView<Integer> param) {
  
[Code] .....
 
However, when I do this, the customized String is not used for the selected Item (rather the standard toString() value of the item). Apart from that it is no longer selectable using the mouse (I submitted a bug report for this at [URL] .... but that is not really the point of my question.

Anything else I have to do to make sure the selected item is also rendered using the custom cell or is there a different mechanism for this?

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 :: Why Splashscreen Of Application Doesn't Show

Jul 11, 2014

I built my application under Windows XP (x32), Eclipse Luna (x32), JDK 1.8 (x32 - beta version B116).
 
When i launch it, the splashscreen (preloader) appears !
 
I rebuilt my application under Windows 7 (x64), Eclipse Luna x64, JDK 1.8.0_20 (x64).
 
When i launch it, the splashscreen doesn't appear !!!
 
For information, The structure of my application :
 
app
     | libs
          | preloader.jar
 
myapplication.jar
 
runtime
 
The behavior of JDK 1.8.0_20 about the management of the preloading mecanism is it different of the behavior of JDK 1.8 (B116) ?

View Replies View Related

JavaFX 2.0 :: StackPane Doesn't Center Another AnchorPane

Dec 8, 2014

In the documentation of StackPane i read: "The stackpane will attempt to resize each child to fill its content area. If the child could not be sized to fill the stackpane (either because it was not resizable or its max size prevented it) then it will be aligned within the area using the alignment property, which defaults to Pos.CENTER."

But as I add another Pane (Anchor- or BorderPane) this added Pane is shows always in left upper corner of the StackPane. How could I force my StackPane to center another AnchorPane?

View Replies View Related

JavaFX 2.0 :: Styling Of Controls Doesn't Work programmatically

Dec 9, 2014

I have a stylesheet (mystylesheet.css) with following entry:
 
.flowpane{
    -fx-background-color: rgb(0,0,0);
}
 
In then start-method of my application I execute:
 
       StackPane root = new FlowPane();
        Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
        scene.getStylesheets().add(css.getFile());
        root.applyCss();

No FlowPane gets black. But if I do that in SceneBuilder and add the stylesheet to root than after loading Fxml-file the FlowPane gets black.

Another approach:

        StackPane root = new FlowPane();
        Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
        scene.getStylesheets().add(css.getFile());
        root.getStyleSheets().add(css.getFile());
        root.applyCss();

Nothing happens.

        StackPane root = new FlowPane();
        Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
        scene.getStylesheets().add(css.getFile());
        root.getStyleSheets().add(css.getFile());
        root.getStyleClass().add("flowpanel"); 
        root.applyCss();

Doesn't work too;
 
but root.setStyle("-fx-background-color: rgb(0,0,0) works. But I need to style my application by css-files.

View Replies View Related

JavaFX 2.0 :: Progress Indicator Doesn't Rotate Anymore (8u20)

Aug 28, 2014

Since the upgrade to JavaFX 8u20 my ProgressIndicator won't rotate anymore when using Caspian style. Is there any workaround for this?
 
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ProgressIndicator;
import javafx.stage.Stage;
public class TestApp2 extends Application {
    public static void main(String[] args) {
    
[Code] ....

View Replies View Related

JavaFX 2.0 :: Modifying Item In Observable List Doesn't Update ListView

Oct 3, 2014

I am using:

Java:..... 1.8.0_20JavaFX:... 8.0.20-b26 

I have this class:
 
public class Person {
    private SimpleStringProperty name;
    public SimpleStringProperty nameProperty(){
        if(this.name==null){
            this.name=new SimpleStringProperty();

[Code] .....

I have this:

lista = FXCollections.<Person>observableArrayList();
lista.addAll(new Person("uno"),new Person("due"),new Person("tre"));
myListView.setItems(lista);

The problem is if I add /remove an item all is fine, the listView refreshes correctly:

Person p = new Person(tfld_textAdd.getText());
lista.add(0, p);
 
But if I change a value on an item into the observable list it doesn't:

lista.get(0).setName("new value");
 
I also have a table linked in the same way and the table workd correctly after I updated my Java version...

View Replies View Related

JavaFX 2.0 :: ImageView Image Created In Scene Builder 2.0 Doesn't Display In Running App

Sep 9, 2014

I'm using Scene Builder 2.0 and have added an ImageView to the parent AnchorPane.  I've added my PNG files for the app icon and the various buttons. I select the ImageView in Scene Builder and then crawl the filesystem to the project package folder and select the PNG for the Image.  The assigned image is displayed in the Imageview in Scene Builder in both design mode and Preview mode.
 
While everything else shows up properly when the app is executed, the image assigned to the ImageView does not display.
 
From the FXML file:

<ImageView fx:id="ivBRULogo" fitHeight="64.0" fitWidth="64.0" layoutX="14.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
         <image>
            <Image url="@BRU_PE_B_64.png" />
         </image>
      </ImageView>
 
What might be occurring between the compiled app and what Scene Builder generates?

View Replies View Related

Change Position Objects In JavaFX

Jun 4, 2014

I can't recolate and align the button, the circle or the line where i want it to on the canvas. I want to be able to move the line where i want it, now it seems like all objects are stuck in the middle of the scene or canvas.

package application;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;

[Code] ....

View Replies View Related

JavaFX 2.0 :: Only One Change Event On ObservableList?

Apr 9, 2015

I have a list of Row objects and want to listen to changes in the name property of a Row object.
 
public class Row implements Serializable {
    private final SimpleStringProperty name = new SimpleStringProperty(this, "name", "");
    public Row() {
        this("");
    }
    public Row(String name) {
        this.name.set(name);

[Code] ....
 
I would expect to be notified 4 times. Line 23: Added, Line25, 26, 27: Update

But there are only 2 change events. For Line 26 and 27 there is no change event.

View Replies View Related

JavaFX 2.0 :: Unable To Change Textfield Value

Jun 8, 2014

I am having a small JavaFX program where I try to set a value to TextField. Below is the part of FXML file and highlighted is the Textfield ....

fxml file  
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="185.0" prefWidth="598.0">
          <children>
            <TextField fx:id="actiontarget" editable="true" layoutX="146.0" layoutY="73.0" prefWidth="198.0" text="" />
           
[Code] ...
 
I want to display a string value to that text field.

So, I am using that fxid (actiontarget)

But actiontarget.setText (pathofFile) is not working .
 
Nothing displays and no value sets for the Text field.
 
How can I set value in that text field through above code.

View Replies View Related

JavaFX 2.0 :: TreeTable Can't Change Title

Mar 16, 2015

I change TreeTableColumn.text but I got a Exception
 
Exception in thread "JavaFX Application Thread" java.lang.ClassCastException:
javafx.scene.control.TreeTableColumn cannot be cast to javafx.scene.control.TableColumn
    at com.sun.javafx.scene.control.skin.TableHeaderRow$10.invalidated(TableHeaderRow.java:277)

so I check TableHeaderRow . I find this method
 
private final InvalidationListener columnTextListener = new InvalidationListener() {
        @Override public void invalidated(Observable observable) {
            TableColumn<?,?> column = (TableColumn<?,?>) ((StringProperty)observable).getBean();
            CheckMenuItem menuItem = columnMenuItems.get(column);
            if (menuItem != null) {
                menuItem.setText(getText(column.getText(), column));
            }
        }
    };

why don't they use this

TableColumnBase<?,?> column = (TableColumnBase<?,?>) ((StringProperty)observable).getBean();

View Replies View Related







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