Questions tagged as 'java'

1
answer

Put array of objects in comboBox

I have the following method to add objects to a JComboBox : public void PopulaCategoria() throws SQLException{ for(Categoria categoria : caDAO.getCategorias()){ comboCategoria.addItem(categoria); } } But...
asked by 04.05.2018 / 18:54
1
answer

Program works by debugging but not executing

I'm making a game of the old one and I wonder if the tight button I set up in class MenuPrincipal is returning the correct value for the main class that controls the change between windows. Running the program normally does not work, b...
asked by 09.03.2018 / 12:18
1
answer

Doubt regarding the dispose () and repaint () methods

What is the function of .dispose() and repaint() methods in using Graphics in Java?     
asked by 12.03.2018 / 03:34
1
answer

Fixed background, no resize when keyboard is activated

I have the following color layout, set to background of LinearLayout : background.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangl...
asked by 07.02.2018 / 12:43
1
answer

Initialize and change static variable in a safe way. Does this code make sense? Intellij IDEA thinks it does not

Hello I'm looking for a secure way to initialize and change a static variable that will be shared by different threads that will be accessing its value. The idea is that at some point I will check that this variable needs to be changed a...
asked by 13.06.2018 / 15:00
1
answer

Fix JButton that is running 2 events

I have an application where in a JFrame I create new records for a mysql table, and in another I return a select in a JTable with all records created. I have a button change, which when I select a line from JTable and click on it, open...
asked by 10.06.2018 / 14:54
1
answer

Prevent repeat animation by changing device orientation

I'm working on a screen that contains an animation that is repeated every time the screen is rotated. I looked for but I did not find any precise information on what I need to do so that the animation does not repeat itself when changing the ori...
asked by 16.06.2014 / 07:24
1
answer

'mvn clean compile package' run the phase compiler 2 times?

Once I run mvn clean package I know that all phases of maven's lifecycle default prior to package (compile, test, package) , So I wonder is: mvn clean compile package mvn clean compile package The reason for the question is because...
asked by 03.08.2018 / 21:57
1
answer

Convert lambda java predicates

I'm trying to do a template transformation using java lambda. Here is a code block that exemplifies what I want to do: public String translatePrimitivePredicate(){ Predicate<Integer> predicate = a -> a == 1; return transl...
asked by 27.12.2017 / 01:16
2
answers

Execute HTTP POST asynchronously JAVA

I have a method that sends a POST to the server, how can I send multiple requests asynchronously? public void sendPost (Object content) { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Inc...
asked by 04.01.2018 / 12:08