Most voted "java" questions
Use this tag when the question refers to some resource, information, or problem relating exclusively to the Java programming language. Java is a class-based, statically typed, reflective, and execution environment (JRE) language. Java programs are compiled to bytecode and run on a virtual machine (JVM), allowing a "write Once, run Anywhere" philosophy (WORA).
Learn more…14,468 questions
Sort by count of
-
2
votes1
answer111
viewsI’m having trouble adding a new student to my arraylist
I am reviewing previous java matter and in the middle of reviewing arraylists I found it difficult to add a student to the list. Each student has the following fields: name, student type, course…
-
2
votes2
answers1175
viewsHow to position the cursor at the beginning of the field?
How can I make a component (JTextField, JFormattedTextField and others) when being clicked/gaining focus, position the cursor in the position 0 component, especially when the component is already…
-
2
votes1
answer525
viewsImplications of @Autowired on and off
When working with Spring I realize two patterns of using the @Autowired, declare inside the manufacturer and outside. Builder @Service public class myService { private final PartnerRepository…
-
2
votes1
answer1838
viewsError while performing findviewbyid
Hello, I want to find the id of two Textviews, but they are returning NULL. Follows my code: private TextView nomeUser; private TextView cargoUser; @Override protected void onCreate(Bundle…
-
2
votes1
answer218
viewsCheck if there is a file in a particular jsf rendered folder
People I am saving image in a certain project folder and I need to check if this file exists in the folder. Was using a command as below:…
-
2
votes1
answer543
viewsProblems with image localization in the Spring Framework
I’m using Spring and Thymeleaf: I have an image in the directory: Resources/image/Telescope.png When I open the page posts.html (home),located at the address below, the image is displayed.…
-
2
votes1
answer313
viewsProblems with JPA, @Onetoone and mappedBy
I have three classes, Person, Client and Address, being Customer Person’s child and Address adding Person. Segue Pessoa: @Entity public abstract class Pessoa implements Serializable { private static…
-
2
votes0
answers385
viewsIs there a JSF style PHP famework?
I am a Java programmer and I use JSF in the projects of the company where I work. I am developing a personal project and I chose the PHP language even to learn a little more. The problem is that I…
-
2
votes1
answer3044
viewsHow to get the context in a Fragment?
What should I insert into a method that needs the context argument in this Fragment ? public class Tab1tests extends Fragment { private ViewPager mViewPager; private…
-
2
votes0
answers78
viewsInject EJB in Bean Spring
I’m working on a Java EE + Primefaces + JPA project with EJB. In the authentication part I decided to use Spring Security, but I’m having a hard time getting the EJB inside the Spring controller. I…
-
2
votes1
answer4570
viewsHow to send parameters via java post using Httpurlconnection?
I am having a problem sending through a POST method in java parameters using Httpurlconnection. I’ve been trying a few ways and researched a lot, but no way it worked for me. I’ll leave the code…
-
2
votes1
answer264
viewsError adding placeholder to a text component
I am implementing the component of this topic together with the following instruction: PromptSupport.setPrompt("Digite..", field); This command is from biblioteca swingx-core-1.6.2 and adds a sort…
-
2
votes2
answers1013
viewsRegular expression to select whole word and case sensitive in sharp word
I need to make a program that searches a certain word in a set of texts and marks the word searched in the middle of the text. For this I developed the following method: public void…
-
2
votes0
answers33
viewsthe type of "OBJECT" is erroneuos
I’m studying competition, and I was trying to make a code using the Semaphore, and that mistake has arisen "the type of Processadorthread(int, Semaphore) is erroneuos" when I tried to run. I’m using…
-
2
votes2
answers234
viewsBase64 biometrics generating different codes for the same digital
I am having problems with the encryption of digital (biometrics) in base64 for passage of track parameter http. The problem is that each capture of the same digital are generated different codes, so…
-
2
votes0
answers86
viewsGet GPS location
I want to get the user’s location. My code is below, but when I run, I do not see anything, nor map the mark. public class Gmapfragement extends Fragment implements OnMapReadyCallback { private…
-
2
votes2
answers355
viewsAdvantage in giving null in a variable on Android
Assign the value of null in a variable on Android can improve application performance? As far as I know, in Java we have the Garbage Collector, and in Android, the activity cycle of Activities and…
java android null variable-declaration garbage-collectorasked 7 years, 4 months ago Guilherme Ramos 343 -
2
votes1
answer138
viewsSum in Textview
I have a Json that returns the values of positive and negative, and that sets the text in mine TextView. This is the calculation I try to do, but it returns a invalid double: public double…
-
2
votes0
answers153
viewsHow to run a Java application with Play framework at the prompt?
I have a large system developed in Java using the Play, but this system was developed in the Linux, and now I need to spin it in Windows. There is a script to compile on Linux (run.sh.template). I…
-
2
votes0
answers71
viewsDrag & Drop in Jtree
I need to implement a Drag & Drop in one Jtree of 3 levels so that by clicking on one node of the tree and dragging it to another, some operations are performed. The scheme is basically:…
-
2
votes1
answer213
viewsCalculations of skinfolds
Well, I don’t know if I can ask for help in calculating, more anyway, my question is this:: I need to do the calculation of skin folds, in this case the calculation of Pollok 3 folds, I researched…
-
2
votes2
answers1141
viewsAndroid calendar with events
At the moment I only have this calendar. I’m using the Materialcalendarview <com.prolificinteractive.materialcalendarview.MaterialCalendarView xmlns:app="http://schemas.android.com/apk/res-auto"…
-
2
votes1
answer187
viewsHow to move animation in a clockwise direction?
Good guys, I’m developing a little project that aims to simulate the controlled environment of train tracks, where I have 3 trains circulating in a clockwise direction, where the three pass by the…
-
2
votes1
answer940
viewsLimit amount of typed characters based on view width
I got the following EditText width defined as match_parent, basically occupying the full width independent of the device: <EditText android:layout_width="match_parent"…
-
2
votes2
answers804
viewsFormat Jlabel text with different colors
How could I format with different "properties" a JLabel and its content? For example, I wish I could set a color for my text JLabel, and another to string that this concatenated with it. It is…
-
2
votes1
answer155
viewsREGEX - problem with validation
I need to do the following validation: a-z (upper and lower case), hyphenate (-), apostrophe (\'), space ( ) and numbers (0-9) For that I did the following: import java.util.regex.Matcher; import…
-
2
votes1
answer75
viewsI can’t put hamburger symbol on Navigation Drawer Panel
I’m trying to put one navigation Drawer Panel in my app, but I can’t put the burger symbol on my MainActivity. The code I’m using is: public class MainActivity extends AppCompatActivity implements…
-
2
votes1
answer6600
viewsHow to calculate the use of a football team in a championship?
I’m looking to do a media calculation of a football team in a certain league, for example, my team played two matches and won one. He would have 3 points from 6 points played and a 50%. public final…
-
2
votes1
answer242
viewsError entering data into database
I am making a system in java with postgresql database for client registration, any help is welcome to solve my problem. org.postgresql.util.psqlexception: ERROR: syntax error at or near ","…
-
2
votes1
answer118
viewsTry to create two-dimensional arrays as objects
I’m trying to create a simple program that allows me to create 2d (matrix) matrices with different objects. My thought process was that I should be able to create objects with arguments (as stated…
-
2
votes2
answers914
viewsPut vectors in order. JAVA
I need to put five pesos in order from the smallest to the largest. Defining the numbers instead for example: int vet[] = {3,4,2,8,7,1}; it runs right, but I need to do it this way: int vet[] = new…
-
2
votes1
answer324
views -
2
votes2
answers737
viewsDoubt about displaying inverted array
Could you explain to me how it works to return an array with inverted values? I took this exercise to do, but I couldn’t. Then a colleague gave me this exercise to dissect him, but I didn’t…
-
2
votes1
answer173
viewsSave value from a select and display
I’m developing a CRUD of a web system. In the employee registration I use two select elements to display the options, when registering work all ok, the information goes to the bank. The problem is…
-
2
votes1
answer1245
viewsAdd Contacts to an Array List
I would like to add contacts in a ArrayList, but adding initial values to the attribute. First I created a class called contact , and I want to create a contact type Arraylist and I would like to…
-
2
votes1
answer595
viewsQuestions Spring Boot Web App -> Android
A few weeks ago I finished the project of a web system that makes basic Ruds, I used Java, Maven, Spring Boot, Hibernate, Bootstrap + Thymeleaf pro frontend, etc... And I deployed to Heroku using…
-
2
votes0
answers44
viewsFile . java without class signature
I was taking a look at primefaces code, when I came across the following situation (buttontemplate.java file): import java.util.List; import java.util.Map; import org.primefaces.util.HTML; import…
-
2
votes0
answers223
viewsGet User name in jsf session
I’m having doubts about how to get the username in the session. I’m using Spring Security 4.2 I have my User Class import javax.persistence.Entity; import javax.persistence.GeneratedValue; import…
-
2
votes1
answer35
viewsVector Search - Arrayindexoutofboundsexception
I’m building a function that does a linear search on an arrangement. What I would like is that instead of leaving in the call the value of the size of the arrangement, I would like to use the…
-
2
votes1
answer638
viewsRead Json without "knowing" the JAVA keys
The problem is that I need to inform the professions and wanted it to be automatic to read the json without having to inform ocup[1] = "jornalista". I would like the json reading to be automatic. {…
-
2
votes1
answer490
viewsGenerate columns with repeat Primefaces
I’m unable to generate these columns dynamically with the p:repeat of the Primefaces. Is there no way to do this in Primefaces? Or is there no way to do it? There is a better solution? The problem…
-
2
votes2
answers370
viewsHow to Change Linear Layout Transparency
I have a login screen that has a LinearLayout blue background tranparente. How can I do this LinearLayout with id be translucent? <?xml version="1.0" encoding="utf-8"?> <LinearLayout…
-
2
votes1
answer323
viewsTransfer objects between methods in a bean
I am developing a web application using the bootsfaces framework in Java WEB On one of my screens I have a datatable of bootsfaces that when one of the lines is clicked, is selected by activating…
-
2
votes0
answers65
viewsCheck app idle time
What is the most efficient way to check for app idleness? I need to close the app if I haven’t interacted with it in a while. I have a working solution, but maybe there’s something more appropriate…
-
2
votes1
answer110
viewsHow to modify phone field?
I have a stylized component with phone formatting as follows (XX)XXXXX-XXXX I’d like to know, how can I withdraw the DD part (XX), so that the field stays just like this: XXXXX-XXXX I tried to…
-
2
votes1
answer374
viewsHow to change the background of a Jdatechooser?
I have a JDateChooser and I’d like to change the background when he wins focu, but I’m not getting it. I tried to do some ways: dataChooser.getDateEditor().getUiComponent().setBackground(new…
-
2
votes0
answers40
viewsJformattedtextfield deleting entered data
I have 4 Textfields to put DDD, numbers before the hyphen, numbers after the hyphen and zip. private JTextField ddd=null; private JTextField antesh=null; private JTextField depoish=null; And a…
-
2
votes2
answers161
viewsPosition Buttons Scaled Table Using Layouts Manager
I’m having trouble positioning components. I have a table, and 3 buttons, and I’m trying to place the buttons above the table centrally. Example: I tried to use the FlowLayout, and the result was…
-
2
votes1
answer103
viewsJava configuration on linux
I’m setting up JAVA and ANT on Linux Server, following a few steps I found on the internet, because I’ve never done this on Linux. I set them up by the terminal because I’m accessing the machine…
-
2
votes1
answer143
viewsDouble click primefaces button to run method
I am developing a Javaweb application with the Bootsfaces and Primefaces framework. On one of my screens I have a form with a Bootsfaces datatable that when clicking on one of its lines triggers the…