Questions tagged as 'java'

1
answer

How do I save an image in the database in SQLite?

How do I save an image in SQLite? I ask to be as specific as possible because I do not have much experience. In case I want to include a table row to save the image. import br.gestaoBd.Login; public class EstruturaBanco { public static...
asked by 11.01.2016 / 04:38
1
answer

What is the purpose of internal lateinit?

I converted to Kotlin a simple Fragment with any button. In the alternation, it basically looks like this: Java private Button btn; Kotlin internal lateinit var btn: Button What is the goal of internal lateinit ?...
asked by 09.08.2017 / 17:26
1
answer

How to check if a File can be created in a Folder before trying to create it in it?

My program allows the user to define a Folder, and later the program will create a New File in this Folder. However, the program is not able to create a file in any folder, for example:    Creates the new file in the folder normally:...
asked by 02.09.2017 / 22:21
1
answer

Temporary text in JLabel

I would like to change the text of a JLabel and leave it for just a few seconds, then return the previous text. I have to run a method that takes a few seconds to get ready and would like to notify the user that it is running and this way...
asked by 07.12.2015 / 23:49
1
answer

Generate random numbers in Java

How to generate only numbers greater than 2? How to generate only numbers greater than 2 and the generated numbers have to be multiples of 3 (eg 3, 6, 9)? How to generate only numbers smaller than 10? How to generate only numbers smalle...
asked by 28.10.2015 / 23:40
1
answer

I want to compare start date and end date. The start date always needs to be smaller than the end date. CompareTo () I encountered an error

When the end date is with the 00:00 time, it identifies that the start date is longer than the end date but it is not, the start date is still shorter. When I put the end date using 14/01/2017 23:45 the method returns me -1 . But...
asked by 15.01.2017 / 01:13
1
answer

How to initialize objects already declaring values?

For example in this code: public class Main { public static void main(String[] args) { Point p = new Point(); } } class Point { int x; int y; } Is there a way to declare values to x and y alread...
asked by 14.01.2017 / 19:40
2
answers

How to expand the window when you click a button?

Is it possible to expand a window with more information when the user clicks a "Details" button? The behavior is similar to some error screens, which show the data of an error, as shown in the image below: My window has a JButton...
asked by 03.03.2015 / 19:26
2
answers

How to resolve this 'java.lang.IllegalArgumentException: Unknown entity' when running this simple application?

I'm new to the Hibernate world and when I run this application, I get the following exception: java.lang.IllegalArgumentException: Unknown entity: com.nataniel.api.domain.User at org.hibernate.ejb.AbstractEntityManagerImpl.persist(Abstrac...
asked by 27.11.2016 / 02:42
2
answers

Functioning of variables by reference

I know that the reference variables in java serve to provide a memory location for a certain object. However, how does this mechanism work? Is it the same as the C language, where referenced types store exactly the memory address you want to fin...
asked by 07.12.2015 / 15:19