Questions tagged as 'java'

5
answers

Using line break "\ n" in Java

What problem can a Java programmer have when using "\n" to skip line? Note: I have already used it for N reasons, writing a file TXT and others.     
asked by 26.02.2014 / 19:03
1
answer

How to track letters and cut them?

I have this image below. As you can see, they are together. In this case, it is a "7", "h" and "a". Is it possible to crawl the image to find them and then cut them where exactly you found them? I'm using the OpenCV, OCR, and Tesseract...
asked by 07.08.2017 / 10:49
0
answers

SelectOneMenu is not loaded when selecting object for editing

I have a SelectOneMenu (Primefaces) component of cities, which loads according to the selected state. My component has the following behavior, right after saving the object and then selecting it in DataTable through commandLi...
asked by 26.05.2015 / 01:55
1
answer

How to optimize the game naval battle in JAVA?

I do not know if this is allowed here on the site, so if I break some rule let me know! I recently started learning the JAVA language. I did a naval battle game (human vs. computer) using everything I've learned so far and would like to hea...
asked by 11.09.2016 / 20:09
1
answer

Change spring-security role by bean

I'm using spring-security to authenticate my user, until now, I want to be able to change the user role for managed bean , does anyone have an idea? Type I have several modules and each user has a role for each module then when h...
asked by 04.05.2015 / 21:36
9
answers

How to count the zeros to the right of a number?

I have a number, nnnnn000 . I must count how many zeros on the right has this number. Test Cases: 123000 zeros numbers 3 102030 zeros numbers 1 Open to suggestions!     
asked by 12.02.2016 / 21:39
2
answers

How to avoid an IllegalStateException: The content of the adapter has changed but ListView did not receive a notification?

I have Activity that displays a ListView , which is associated with Adapter "backed by" ArrayList global. If I add an element to this ArrayList , ideally I do it on the main thread and immediately call Adapter...
asked by 14.01.2014 / 12:39
2
answers

Differences and use of Strings vs. CharSequence

Many methods in Java expect parameters CharSequence , but the code runs normally when I pass String without conversion, for example: String mensagem = intent.getStringExtra(MainActivity.MENSAGEM); TextView t = (TextView)findViewB...
asked by 17.01.2014 / 12:43
2
answers

How does a Java Virtual Machine written in Java work?

Seeing the Jikes RVM I was curious to know how this works (in theory), but only found material in English . Is it correct to assume that the JVM today is done in C / C ++, which in turn is done in Assembler? How can a language "self-inte...
asked by 19.01.2017 / 18:06
1
answer

Multiple Controllers with JavaFX 2, such as referencing the instance of the other

UPDATED. I am creating a new Java application using JavaFX, when programming with Swing I had the custom of creating multiple specialized controllers for the interface, and in Swing I use a controller that is aware of all others and so with...
asked by 03.08.2015 / 02:03