Questions tagged as 'java'

1
answer

How to draw lines following the mouse movement?

I need a JPanel , which draws lines following the mouse pointer while it is dragged, and when released it needs to stop drawing. It turns out that whenever you draw two or more rows in a row, they connect to the previous rows, this shou...
asked by 13.03.2017 / 15:55
1
answer

How to transform an array from one dimension to two in Java?

I have a one-dimensional array of integers, like this: int[] a = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; And I want to turn it into an array of two dimensions, for example: [1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12] How...
asked by 07.03.2017 / 17:07
3
answers

How to limit the characters of a label?

I'm in an e-commerce project, and I need to display the name of a product. I'm thinking of using a label for this. The idea is to leave x characters visible, if the title exceeds this x number of characters, display "...". I do not know how to d...
asked by 06.03.2017 / 19:58
1
answer

How to redirect page in JSF?

I have a system with a form where you can edit or remove items. There is a link to redirect another page. What form can I redirect a page to in JSF?     
asked by 29.09.2017 / 17:20
1
answer

How do I generate random numbers between 5 and 30 in Java?

I need to use the random method and store it in a distance variable, then show the distance from city A to city B, and city A to city D, that is, a different random number for each distance of THE. After creating the instances of the class City...
asked by 27.05.2017 / 18:20
2
answers

How to print the number of days of each month using Array, String and byte?

I'm trying this code, but it does not work. public class MesDias { public static void main(String[] args) { // Array String byte String Mes = {Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez}; byte[] Di...
asked by 04.01.2017 / 15:24
1
answer

How to display the time the program is running?

I wanted to know if there is a way to take the time the program is running, and display it on a label. From the moment it is run, it is "running a time", ie it shows exactly how long it is running. public class ProgramaExemplo extends JFrame {...
asked by 04.02.2017 / 20:03
1
answer

How to restrict the value of the variable with only two decimal places? [closed]

I want r with only two decimal places. double r = Math.abs ((aux5 - ((aux1*aux2)/previsoes.length))/ (Math.sqrt(Math.abs((aux3 - ((aux1 * aux1) / previsoes.length)) * (aux4 - ((aux2 * aux2) / previsoes.length))))));     
asked by 29.11.2017 / 20:07
1
answer

SELECT in SQLite - Android

I'm new to Android development, I'm using SQLite as a database. I need to do a SELECT, and return the values of three columns in my table . Then I need to set the attributes of my object with the return values of this SELECT . I have an obj...
asked by 13.11.2017 / 22:13
2
answers

Is there any way to remove all sysout from a Project?

I'm setting up a WebService and have some sysout test print variables, and as there are in several different files, I wonder if there is any way to remove all sysout on> project in Eclipse Oxygen at once.     
asked by 11.01.2018 / 17:18