Posts by Gustavo Fragoso • 2,321 points
112 posts
-
1
votes1
answer159
viewsA: How to Print Step by Step
Try to do it that way: boolean checkWord(String palavra) { System.out.format("%-10s %-10s\n", "Palavra", "Estado"); System.out.format("%-10s %-10s\n", palavra, inicial); return checkWord(palavra,…
-
1
votes2
answers1757
viewsA: FXML file stopped opening with Scene Builder
This can happen because of the error in your FXML or a bug in the window. To resolve the first situation just remove the code below (Right here with the error opened normally, maybe because of the…
-
4
votes3
answers722
viewsA: Format String to "00:00:00"
I believe it would be easier to put a formatter to String this way: String hora = String.format("%02d:%02d:%02d", diffHours2, diffMinutes2, diffSeconds2); I am saying that the value has to have 2…
-
1
votes1
answer271
viewsA: Double chained list with remove method that does not work
Here I identified a Nullpointerexception error in your method get (int position): @Override public T get(int position) { Node<T> node = list; int i = 0; if (position == 0) { return…
javaanswered Gustavo Fragoso 2,321 -
1
votes1
answer771
viewsA: Help with simply chained java list
The problem is really where you imagined it, in the Linkedlist get method. The mistake was the following: public T get(int position) { //pegar o valor da posicao Node<T> node=list; int i=1;…
javaanswered Gustavo Fragoso 2,321 -
1
votes2
answers5419
viewsA: Format Date yyyy-mm-ddTHH:mm:ssZ to dd/MM/yyyy HH:mm
Try using the new Java 8 date API this way: public static void main(String[] args) { String data = "2013-01-08T20:11:48Z"; DateTimeFormatter originalFormat =…
javaanswered Gustavo Fragoso 2,321 -
1
votes1
answer364
viewsA: Problem Keypressed Javafx
This happened because you haven’t defined what kind of event you’re dealing with, it can be done like this: public class ButtonTest extends Application{ private Button mybutton; @Override public…
-
0
votes1
answer496
viewsA: How can I change a label that is on a javafx gridpane
I researched a lot about your problem and the solutions I found involved navigating all grid nodes and putting a onMouseClick on all nodes (Well pig in my opinion). As I did not find what seems most…
-
0
votes1
answer298
viewsA: Problem with Keypressed Event to open another JAVAFX window
Javafx has an easier way to make a button react to the ENTER event, just put it default button. Basically a button in Javafx can be 3 types: Normal: Default behavior, react only with click; Default:…
-
1
votes1
answer251
viewsA: How to know if the cursor is on a certain component in javafx
I believe this is the result you want, from what I understand: @FXML private Button btn; // ... @FXML public void mostrarPopup(){ Popup popup = new Popup(); popup.setAutoHide(true); HBox hb = new…
-
1
votes1
answer51
viewsA: How to catch serial fields with Javafx reflecition API?
Option 1: Add your Checkbox to a Checkbox list, then navigate with a loop like this: ch1 = new CheckBox("1"); ch2 = new CheckBox("2"); ch3 = new CheckBox("3"); //[...] List<CheckBox>…
-
0
votes3
answers3370
viewsA: How to convert Date to whole in Java?
Java dates are stored internally as the number of milliseconds since 1/1/1970 so the result is greater than the storage limit of type int, to solve this problem you must use a Long. A solution would…
-
1
votes1
answer73
viewsA: REGEX JAVA Find a chunk throughout the document
To search for a sequence of symbols in a given order we use (...), for example (Xyz) for x followed by y and z. In your case you have some reserved symbols so we use to use them as literals. The…
-
0
votes2
answers381
viewsA: How to create several variables of the same type without repeating conditions?
As already mentioned, there is a lot of code there that is not necessary. Much of this is due to the misuse of object-oriented programming. I’ve changed a few things to make your program clearer: //…
-
1
votes1
answer76
viewsA: How to choose between types of Nosql?
According to Han2014 models can be described as such: Key-value: Means that each value has a corresponding key. This model supports highly concurrent operations, horizontal scalability (Scale out)…
nosqlanswered Gustavo Fragoso 2,321 -
2
votes1
answer189
viewsA: Socket with UTF-8
It is not in the socket that goes to condification but in the Inputstreamreader and in the Printstream, see the builder: public InputStreamReader(InputStream in, String charsetName) In the client…
-
3
votes4
answers482
viewsA: Comparing Strings using Arraylist
You can use java streams to count this way: List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.add("c"); list.add("d"); list.add("b"); list.add("c");…
-
0
votes3
answers290
viewsA: Doubt with Insert in Postgres Bank
I believe that at the time of creating the field you have used Character Varing[] which is an array of varchars (or an array of dynamic strings). The correct field, if you want to create only 1…
-
1
votes1
answer2936
viewsA: How do I print a hexa in c through the printf?
To print a HEX in C we have the options: %i Prints the corresponding integer value. %x Prints normal HEX value You can also specify how many boxes either in print using %4x for 4 houses for example…
-
1
votes1
answer147
viewsA: progress bar is not updating correctly
The problem is that you gave a bind to the messageProperty in the thread without using the upgrade methods that the thread class offers: updateMessage(), updateProgress(), updateTitle(),…
-
1
votes1
answer999
viewsA: How to search for an element in a structure vector?
I tried to change your code by maintaining the maximum fidelity to what you did, when possible just by switching things around. (Tested in Debian 9 with GCC 6.3.0) Summary of amendments I had to…
-
8
votes2
answers7796
viewsA: Use timestamp with or without Timezone in postgresql?
The difference between the two can be found in the official Postgresql documentation and can be summarised as follows: When the time zone is associated with the timestamp value, this value will be…
-
2
votes1
answer128
viewsA: How do I find the average of a note? In R
To make the arithmetic mean in R we use the function mean(c[x]) which receives a list of numbers. But in your case you would have to do something like: // Para X = 10 e Y = 20 Z <- (X + 2*Y)/3…
ranswered Gustavo Fragoso 2,321 -
1
votes1
answer488
viewsA: Corrupted Latex file
According to this topic on Texexchange Texstudio does not save temporary copies of your file (There is even this option but amazing how it seems it is disabled by default), IE, you have to press to…
-
0
votes2
answers680
viewsA: Javafx how to close an internal Anchorpane
To do this you must assign an ID to the parent Anchorpane and modify its method according to the code below: @FXML private AnchorPane pai; // [...] @FXML public void fecharPane(ActionEvent event){…
-
1
votes1
answer50
viewsA: Algorithm C. Why does the string "Why" return and does not return numerical values?
Your code is a little fuzzy, but I ran some tests and I figured out what’s going on. When you type "Why" in the first code it can assign the upper limit of integers which is 2 15-1 (32767) if you do…
-
1
votes1
answer1245
viewsA: Add Contacts to an Array List
To assign values in the act of creating an object we create a constructor, the syntax is the following: public class MinhaClasse{ // Tem o mesmo nome da classe só que sem o class public…
-
1
votes1
answer728
viewsA: Open Jasper Reports report on Web Server
According to the Troubleshooting jasperreport: This error is normally Associated with a JVM not being Started on a Linux machine in AWT headless mode. Jasperreports Server doesn’t provide a virtual…
-
0
votes1
answer663
viewsA: Passing pointer pointer by reference
There are some errors in the code regarding the understanding of what is happening. A two-dimensional matrix can be represented as a pointer to pointer, in your case, as quoted in the comments, you…
-
0
votes1
answer250
viewsA: Calling element of one method in another method
Your code is very much like a procedural style of programming, there are some things that need to be adapted. If it is your intention to disregard some comments. public static Scanner sc = new…
-
2
votes1
answer510
viewsA: Create iReport variable for database
In this case you will have to create a parameter. In iReport do the following: It will create a new parameter named "parameter1", you will need to go into properties and edit its name and type. To…
-
0
votes1
answer1355
viewsA: MDI Javafx Window: how to make an Anchorpane responsive to Anchorpane Parent
You’re probably not setting the anchors. In FXML, just go to Scenebuilder in the Anchorpane Child Layout section: Already in the code (which is your case), you will have to place the anchors…
-
0
votes1
answer631
viewsA: Tabpane: How to change Tab by clicking the Javafx button
To do this the code is as follows: // Desabilita a mudança de tab através das setas direcionais tabpane.setFocusTraversable(false); // Muda a aba selecionada para 1 next.setOnAction(new…
-
1
votes2
answers221
viewsA: Boot Block
The use of the keys in both scenarios delimited the scope of the variable. The scope is the code piece where the variable is still "alive". In scenario 1 the scope in which the println was used did…
javaanswered Gustavo Fragoso 2,321 -
1
votes1
answer861
viewsA: Wait for the execution of a method to be finished, before being able to re-export it again
If your synchronization operation involves interface updates these tasks must be performed in the FX Thread, otherwise such an error will occur: Not on FX application thread Assuming this is the…
-
0
votes1
answer32
viewsA: What is the best type of field? Textfield, slider, ...? For value above 0.1?
You can achieve this by using the component Spinner. Look for it in the component tab of your Scenebuilder and configure it that way in your controller: @FXML private Spinner spinner; @Override…
-
1
votes1
answer789
viewsA: Create report with barcode
I found a solution here that worked in this online barcode reader. <!-- Coloque isso após a tag de abertura <jasperReport> --> <style name="Barcode" mode="Opaque" forecolor="#000066"…
-
0
votes1
answer124
viewsA: Jasper with javafx does not open by jar
Try to generate your Jasperreports this way: URL arquivo = getClass().getResource("/companyname/seupackage/arquivo.jasper"); JasperReports jreport = (JasperReport) JRLoader.loadObject(arquivo); The…
-
2
votes1
answer981
viewsA: Report details are not displayed
I’ll show you how to build a Jasperreports report from scratch, since you don’t know exactly what the problem is. In Jasperreport Studio 5.6.0: First thing is to set the Data Adapter by clicking on…
-
1
votes1
answer207
viewsA: Creating Dynamic Jtextpane component
How you’re extending your Jtextpane component gives you access to his methods within the class. That way, you could use setText() within your format method but this is not necessary because when…
-
0
votes3
answers5677
viewsA: How to create input masks in a Textfield?
I also developed a solution that works almost the same as Jformmatedtextfield. The following characters can be used: # : Any Valid number (Character.isDigit). ' : Escape Character, used to escape…
javafxanswered Gustavo Fragoso 2,321 -
3
votes1
answer762
viewsA: Why use the Observablelist?
Usually the books about Javafx present in their codes the reduced version of the expression that caused you doubts, putting it this way: Group root = new Group(); root.getChildren().add(text); // O…
-
0
votes1
answer161
viewsA: Import txt to postgresql
Replace the word current_timestamp in your text file with now(): 'Granada', now() 'Grecia', now() 'Guatemala', now() 'Guiana', now() 'Guine', now() 'Guine Esquatorial', now() 'Guine Bissau', now()…
postgresqlanswered Gustavo Fragoso 2,321 -
1
votes1
answer429
viewsA: Add SQLITE data in Java
There are some problems in your code that I’ve observed, I’ll explain each of them. 1° There is a way to do all this work with only 1 select, it is enough that your Primary key has the attribute…
-
1
votes1
answer467
viewsA: Error creating login screen with Javafx
I created a screen similar to the result you want with a Vbox and a Hbox. Follow the code: TextField login = new TextField(); PasswordField senha = new PasswordField();…
-
0
votes1
answer77
viewsA: Transform Curl http://IP:PORT/sendLocalEvent? eventName=_event into Javafx
In this case Javafx does not differ from Java, so the same traditional method is used: URL url = new URL("http://IP:PORTA/sendLocalEvent?eventName=_evento"); HttpURLConnection httpcon =…
-
1
votes1
answer152
viewsA: Clean components within a tab
In this case you have to clean the Container that is attached to the Tab (Usually it is an Anchorpane, for Scenebuilder users). Recovering the components: To recover the nodes that exist inside a…
-
0
votes1
answer36
viewsA: How can I end and resume recording a file using a single Printwriter?
There is no problem opening and closing your Printwriter while running the method because if the file already exists and the append is flagged as True (Second parameter of filewriter), it will use…
javaanswered Gustavo Fragoso 2,321 -
2
votes1
answer152
viewsA: How to insert link in Menubar?
To use the getHostServices() in an application with FXML you must pass Hostservices as a parameter to your controller, as this method can only be called in the main class (application class method).…
javafxanswered Gustavo Fragoso 2,321 -
2
votes1
answer370
viewsA: Focus event in fxml
Unfortunately you can’t do this directly in fxml. The events that can be configured directly in FXML are: setOnAction, Drag & Drop (Drag & Drop), Keyboard, Mouse, Rotation, Swipe and Zoom.…