Questions tagged as 'java'

2
answers

How to put icon in JOptionPane buttons?

How do I put an icon in the "Continue" and "Cancel" Buttons that appear in the JOptionPane ?? window The case is represented below: public void metodo(){ JPanel panel = new JPanel(); JLabel label = new JLa...
asked by 19.04.2018 / 20:35
1
answer

Alternative to Observable and Observer in Java 9

For testing purposes, I'm porting an application from version 7 to version 9 of Java. This application has some features that use Observer and Observable . I noticed that both have become obsolete: @Deprecated(since="9") pub...
asked by 06.10.2017 / 16:04
2
answers

Difference between AWT and Swing in component rendering

What are the main differences between the Swing and AWT interface building libraries, regarding the way components are rendered and performance rendered?     
asked by 09.01.2017 / 21:16
4
answers

Remove element from an ArrayList in Java

I'm having trouble removing an element from my ArrayList, can anyone help me how? public String remover(Pessoa umaPessoa) { String mensagem = "\n******** Pessoa removida com Sucesso! ********\n"; listaPessoas.remove(umaPessoa)...
asked by 05.04.2014 / 01:53
1
answer

What is the underline for numeric literals?

What is the use of underline (_) in the situations below: float pi = 3.14159_26535_89793_23846; long bytes = 00101001_00100110_01100001; int n = 1____________________1;     
asked by 05.10.2017 / 22:22
4
answers

How many strings are created in the codes below?

How many String s does the JVM actually create during the runtime of the code snippets below? 1 : String s1 = "s1"; 2 : String s2 = new String("s2"); 3 : String s3 = "s3"; String s4 = s3 + "s4"; 4 : String s5 = "s5...
asked by 21.02.2017 / 18:17
3
answers

generate a json file with java

   Iterative Insertion: 7841910ns - 7ms       Iterative selection: 2677762ns - 2ms       Iterative merge: 708154ns - 0ms This algorithm was made in Java , in the java console is printed several values, being: search algorithm name t...
asked by 30.04.2015 / 00:59
1
answer

What is the difference between @Inject and @EJB in the injection of an EJB?

I have an EJB that depends on another EJB, so I'm going to use dependency injection to satisfy this dependency. My question is: what is the difference, advantage or disadvantage between @Inject and @EJB.     
asked by 29.08.2014 / 16:41
2
answers

Static Blocks, Inheritance, and Constructors in Java

Hello, during my studies in Java I came across the following doubt Given the code below: class Foo extends Goo { static { System.out.println("1"); } { System.out.println("2"); } public Foo() {...
asked by 17.12.2015 / 17:39
1
answer

How do you create a "hidden" menu?

I have a Toolbar, and I want to make a settings bar in it. However, in order not to occupy space, I would like to hide / minimize it, something like the teamviewer chat. My ToolBar (it's inside a main screen) Container contentPane = this.ge...
asked by 30.10.2016 / 20:13