Questions tagged as 'java'

2
answers

Release only the last line for writing

How do I allow the user to be able to write only the last line of a JTextArea , that is, without being able to make modifications in the upper rows? (such as CMD or Terminal, for example).     
asked by 30.06.2016 / 03:02
2
answers

How do I know which ArrayList objects are being modified or deleted?

I have a ArrayList that is preloaded with some objects of the type of my Person class, see: ArrayList<Pessoa> listaDePessoas = new ArrayList<>(); listaDePessoas.add(new Pessoa("Joao", 29)); listaDePessoas.add(new Pessoa("Ana...
asked by 20.10.2016 / 23:22
2
answers

Constructor with a String and a String array is not working

I created these lines of code in a Java exercise ... public class Pizza { ... public Pizza (String nomeDestaPizza, String[] arrayIngredientes) { ... } } public static void main(String[] args) { ... Pizza pizza1 = n...
asked by 10.07.2016 / 13:08
2
answers

Do threads share the same memory address as a method of an object?

I looked here in the OS only that I did not find anything like the doubt I have. I have a Java program that uses Threads . public class Objeto { int i; public Objeto() { i = 0; } public void Foo() { i++; Sy...
asked by 20.06.2016 / 17:21
2
answers

How do I work with a String with parameters?

The question seems to be simple and naive, but I never had to use it, I have a String and inside it I want to put parameters to be filled later, as in php $string = "o meu nome é $nome"; or as in c, but in c is to display on the scr...
asked by 02.01.2016 / 22:35
2
answers

BigDecimal Comparison Returns Unexpected Result

In one of my methods I make the following comparison, as in the example below: public static void main(String[] args) { BigDecimal valor = new BigDecimal("100"); exemplo(valor); } public static void exemplo(BigDecimal valor) { i...
asked by 27.03.2016 / 01:09
2
answers

Remove duplicate objects from ListMinhaClass

Galera is as follows, I have a model class with attributes that store data returned from the database. For example: public class RelacaoTransformacao { /** ID do registro no banco de dados. */ private long id; /** Indica se o teste...
asked by 30.05.2014 / 20:50
2
answers

Using the JPA repository

Last Saturday I presented my CBT in college and saw that I need to improve the project presented. The system receives invoices in XML format and handles them. I took as a base the system in the company where I do internship. It uses Prime...
asked by 04.02.2014 / 16:29
2
answers

How to do every time you pass "true", does it print the entire instantiated object?

import java.util.ArrayList; public class Loja { private ArrayList<Produto> ListaDeProdutos = new ArrayList<>(); /* private ArrayList<Livro> ListaDeLivros = new ArrayList<>(); private ArrayList<Disco> Li...
asked by 14.09.2018 / 14:48
2
answers

How to change the color of StatusBar?

How do I change the color of this part of the app? I wanted everything from the same green color like this one down.     
asked by 07.07.2017 / 14:47