The following code uses a column constraint to specify that a column of labels should extend horizontally in their cell but they don't as you can see by looking at their border. My mistake or a bug?
if, instead of an ArrayList, can I do the following to initialize a Dyanmic array ? :
First, in my class, I have :
class Example{ private int rows; private int columns; private AnotherClass[][] 2DArray; public Example(int rows, int columns){ this.rows = rows; this.columns = columns;
I am trying to code a TableView with dynamic columns and I saw a lot of examples like this one: Creating columns dynamically. But any of those would work for my needs.
Its very simple: I got a List of Customers, and each one has a List of Buys. A Buy has a String "buyDetail" and a Date for the ship.
My TableView need to have the first column with the name of the Customer, and one column more for every day of existing ships. We don't know previously which days will be used. If the amount of money is superior of 100, for example, I need to be able of applying different styles.
I cant use the Properties because i dont know how many Buys will have each Customer.
My best try (only for the first column) was this, but I cant get the Buy updated if I edit the value in the cell: I didn't try to write the others columns code because I feel that im doing it really wrong.. This Shows the Customer´s names, but I cant handle if that data is edited.
table = new TableView<Customer>(); ObservableList<Customer> lista = FXCollections.observableList(registros); table.setItems(lista); TableColumn<Customer, Customer> customerNameColumn = new TableColumn<Customer, Customer>("");
I need to create dynamic Layouts that are created from java source code, using JAXB. As FXML does not have a schema, this gets me in trouble.
Scene Builder cannot be used for dynamic Layouts, but if there really is no schema I could use, maybe someone knows how Scene Builder generates the fxml files.
I'm trying to implement a scene with a ScrollPane in which the user can drag a node around and scale it dynamically. I have the dragging and scaling with the mouse wheel working as well as a reset zoom.
Here's my issue:
I'm having trouble with the calculations to fit the node to the width of the parent. If I zoom in or out, the fit to width does not work. If I change the window size after running fitWidth() once, the fit to width does not work the second time.
Here is my code as an SSCCE and how it works...
1. (works) Mouse wheel will zoom in and out around the mouse pointer 2. (works) Left or right mouse press to drag the rectangle around 3. (works) Left double-click to reset the zoom 4. (doesn't work) Right double-click to fit the width
My calculations to re-position the rectangle to the upper left of the pane and fit it (i.e. scale it up or down) to the width of the parent are incorrect.
Label is not a valid type., TableView is not a valid Type., etcera
This exception I then solve with placing an import tag inside the .fxml file.
However as I do not know each import name, I have to look this up like writing down:
Label label = new Label();
inside a class and then place my cursor on it to see which import name Eclipse generates.
This import name i then put inside the .fxml file with <? import ?> beginning and end tags with question marks around it.
Is there anyways to automatically generate these import tags inside an .fxml file even if you don't know the import name for the control you want to use?
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.
I have a simple JavaFX Application that open a Browser and shows google page. After exit the Application and free all objects, I can see that the JavaFX objects like Scene, Stage, WebView and WebEngine are alive in the heap memory after call GC. I can see this objects with JProfiler and other Profiler tools.
This is my Test code: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javafx.application.Application; import javafx.application.Platform;
To test the application click on Start Button to show google web page, click on Stop Button to stop the application, run a Profiler tool, and call gc, the JavaFX classes are alive. I am using java version "1.7.0_51" and windows 8.1 Is there something wrong in my code? Or this is the normal behavior?
I was doing a project in a usual Java Application, but now maybe I have to use some tools that are contained in javafx.scene.media.MediaPlayer so I wonder if can it all work? Will javafx methods and such works?
I have to use javafx.scene.media.MediaPlayer beacuse I have to create a very simple audio player (one jbutton and one jcombobox).
I am currently working on a project where I need to return data from a database over RMI to a client who requests it. Some of the fields in the Data Object can not be seen by the client so I need to create another object to send over the network instead. The method I use is this...
public static SerializableObject createSerializableObjectFromDataObject(DataObject dataObject){ SerializableObject serializableObject = new SerializableObject(); serializableObject.setField(dataObject.getField()); serializableObject.setAnotherField(dataObject.getAnotherField()); return serializableObject; }
Is there a better way of doing this? I am creating many subclasses DataObject which all require this static method to be implemented and I can't push it into the superclass because each one needs custom behaviour.
Create a one dimensional array which holds 10 values. Ask the user to input an index value between 0 and 9. Print the value the user selected. Be sure to explain the output to the user. That is my assignment, and here is my code:
import java.util.Scanner; public class Array { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int a[]= new int[9]; a[0] = 10; a[1] = 20;
[code]....
I don't know how to use the scanner to get someone's input properly.
I have a web form with a field Department. I want to add Sub Departments(unknown number) of one Department and then further Sub Sub Departments(unknown number) of one Sub Department. How I will make a form and how I will add this data in attached database. I have one solution:
One Department field with a button to add any sub department if any. By clicking on button, a new row will be generated with another text field and new button. In this way, it will go on. Tree like structure.
But I have another solution, JSF Tree to add or delete entries on the run time. But the problem is that I am unable to find any example of JSF tree like structure populated from database and in which we can add or delete entries on run time and on the same time these entries may also be stored in database.
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.
I'm trying to implement an Office class that contains an inner class: WorkerNode. The WorkerNode class has a name attribute (String) and WorkerNode attributes for boss, peer and subordinate. The attributes of Office are manager and current which are WorkerNode references. The manager refers to the entry point of the structure and current is the current node in the structure. For simplicity, i'm going to try to limit it to 3 levels and assume that the names are unique. I've put together a Office class that containing main and provided the code I've worked on so far.
public class Office { public static void main(String[] args) { String name=Input.getString("input the manager's name: "); Office office=new Office(name); int option;
I am trying to create a Android game. The game is a card game, where each card has a different action and has a different effect. My first thought was to create a Card class and somehow dynamically change the action method for each instance. However after a little bit of research it seems that may be too difficult. A different idea is that I create a class for each different card, and therefore can define the action method different for each one. However currently there is at least 300 cards and therefore I would need 300 different classes, which seems excessive.
I'm trying to implement a functionality which will control the visibility of three outputText. I'm using a selectOneMenu, which has three options. Each option will enable visibility of one outputText, and rest will be invisible.
Initially all outputText s is invisible as rendered value is false, but when I select different options, their respective outputText s are not visible.
public class Fibonacci { public static void main(String[] args) { int[] numbers; numbers = new int[20]; numbers[0] = 0; numbers[1] = 1; System.out.println("
[Code] ....
I wrote this program for my Java class to print out the first 20 numbers of the Fibonacci series. My assignment then tells me to Rewrite your program using dynamic array. I'm not sure how to do this.
I have some spatial datasets which are availabe in a opensource metadata catalog software GeoNetwork and in a PostGIS database.The problem is that the student who created the database used different IDs for the same datasets. So the IDs in the GeoNetwork differs from the IDs in the postGIS database. They only have the same name So, if someone uploads a new dataset into GeoNetwork, the same dataset is uploaded into a postGis database too.
Now I want to add a ID column into the database to give the field the same ID like the ID in geonetwork. I think I can only do this with using the filename cause they are same in both cases.Now I want to alter the table in eclipse with following code:
PHP Code:
Connection con = null; Statement stmt = null; String query = null; String filen = filename.substring(0, filename.indexOf('.')); con = DriverManager.getConnection("jdbc:postgresql_postGIS://localhost:5433" + "user=postgres;password=dominik1;" + "database=geonetwork"); --> (the connection data will later be in a properties file) query = "ALTER TABLE " + filen + " ADD GN_id INTEGER(10) "; stmt = con.createStatement(); stmt.execute(query); mh_sh_highlight_all('php');
But i get the following findbug error:
Failed to execute goal org.codehaus.mojo:findbugs-maven-plugin:2.5.2:check (default) on project services: failed with 1 bug org.fao.geonet.services.resources.UploadAndProcess .exec(Element, ServiceContext) passes a nonconstant String to an execute method on an SQL statement ["org.fao.geonet.services.resources.UploadAndProces s"] At UploadAndProcess.java:[lines 83-299]..
I tried to suppress this error and worked with PreparedStatement and String.Format but I can't get rid of this error.
I have a question regarding static binding and dynamic binding. Say for example we have below hierarchy,
class Animal { public void eat() { System.out.println("Animal Eating"); } }
[Code] .....
1) a.eat(); // Prints Animal eating ---> Static Binding 2) a.eat(); // Prints Dog eating ----> Dynamic Binding
Static Binding means,compiler will be able to decide which method to call based on class type of reference variable at compile time.That is compiler will check whether method is available or not in class.
Dynamic binding means,at runtime JVM will run the method implementaton,based on the object which reference variable is pointing.
So basically compiler will check class type of reference variable and at runtime JVM will check what type of object reference variable is pointing.
Here my my doubt is , in below both cases,that is
1) a.eat(); // Prints Animal eating ---> Static Binding 2) a1.eat(); // Prints Dog eating ----> Dynamic Binding
At compile time,compiler will check whether method is available or not in class. Since eat() method is available ,then in both cases it should be Static binding. or at run time if JVM decides which method implementation to call,then JVM will check which object the reference variable is pointing,then in above 2 cases also JVM will check in Animal object and Dog object for the method eat(). Since eat() method available then both should be dynamic binding.
I am getting doubt on what parameters/conditions we are deciding which is static binding and which is dynamic binding .
Will compiler will check the type of reference variable and also type of object at compile time and when it is ambiguous it leaves the decision to JVM?
Or is it like if method call and method implementation belong to same class then it is static binding and if method call and method implementation belong to different class in same inheritance hierarchy then dynamic binding.
This might make me look pretty silly but I was curious if there was a way to make a dynamic web page in java. Basically only using pure Java, with only HTML5, CSS and mySQL.
I have code which query value from database, the use case is the user can enter value as 1,01,11 in database but when the user enter value in xml file he can only enter 11,01,12 in database there is two columns lets say column test1=1 and test2=2 combination of this is 12, which is the value the use will enter in xml, but sometime the use can enter test1=04 than column test2=00 how can i approach this
I got table called card with column crdind,crdpos1,cardpos2 as primary key. The user can enter value as
The rule say if you enter one number in crdpos1 eg 2 than you must enter value in crdpos2 it can be any number 1-9 but if you enter 00-09 in crdpos1 than crdpos2 is 00
The challenge I have is to query this value after they been enter. I have xml file which got field crdpos the use enter 15 which is the combination of column crdpos1=1 and crdpos2=5 ... How can I split the value crdpos and got and able to query in database in two separate column ....
we had a requirement to display a combobox which is filled with some values on the webpage when somebody checks the checkbox which is present on the webpage.
The approach we have taken is ajax. how we did this is, when somebody checks the checkbox on the webpage we are initiating the ajax call requesting a servlet. this servlet pulls the data from the database, places the data in the request and forwards the request to a jsp. In that jsp i am writing simple html combobox and populating the values in the combobox from the request using JSTL and this jsp will be sent as response to ajax call. The ajax gets the html as responce which contains a combobox and i am just placing that html ( the complete response) in a div which is next to checkbox.
In this approach there is lot of pain. if i have to display 10 html components dynamically based on some condition then i have to have 10 jsp's one for each component. I always feel this is a wrong way of doing things. what is the best approach to deal with the dynamic stuff on webpages.