Questions tagged as 'swing'

1
answer

NumberFormatException in GUI

I have a program that simulates a pizzeria system where product prices are stored in enums as a double. The% window% takes these price values and displays it on the screen in this way: JLabel . Where "R$ "+ p.getValue; is the price....
asked by 06.04.2016 / 21:58
1
answer

Java - Swing - Timer with TimeUnit.sleep

I'm using Swing in NetBeans, creating a simple math game (I find it more viable than a calculator) whose goal is to add the random numbers of the buttons until it equals a number between 1 and 10000, which would be shown randomly. I used for...
asked by 22.03.2016 / 20:46
1
answer

ScrollBar in a JTable

I added a JTable that updates the data as the client is typing in a JTextField field. However, when the client search returns multiple rows, I would like JTable to have a scroll so that the client can see all the results....
asked by 23.04.2016 / 19:07
1
answer

Capturing exceptions in the execution of the swingworker

I'm using SwingWorker to execute a method that can throw exceptions. Even forcing, the exception is not caught by try-catch . How can I resolve this? try { (new SwingWorker < Void, Void > () { @Override protec...
asked by 23.04.2016 / 01:10
1
answer

Doubt about getSource () instanceof

Instanceof is a binary operator that tests whether an object is the subtype of a given type. Ex: Object fonte = e.getSource(); if (fonte instanceof JButton){ ... } If getSource () returned information from a JButton the result of the...
asked by 09.12.2015 / 15:18
1
answer

Mark / Unmark a line in JTable by changing its color

Good morning everyone! I'm new here in the forum, I apologize if I opened this topic in the wrong place. Hi, I'm trying to create a Java Swing with the JTable component. I've tried a few things, and nothing that gives me a light! I would l...
asked by 12.01.2016 / 13:11
1
answer

Data recovery of an object [closed]

I have 2 screens in Swing, one that calls a method and registers the information in an array, and another screen that should fetch one of this information and display it, the problem is that since the objects are different, I can not get the dat...
asked by 21.02.2015 / 05:12
1
answer

Handle components in a container

I added a frame with multiple components to a container . In another class I add the container data to jPanel. In this class, is there any way I can access the components of this container ? Container ct3 = new Contai...
asked by 05.12.2014 / 13:55
1
answer

Error with ActionListener

import java.awt.Color; import java.awt.Container; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.BorderFactory; import ja...
asked by 03.12.2014 / 20:40
1
answer

Validation JTextField

I'm trying to validate the txtServicoValor field that receives a type BigDecimal , follow my code, the validation is barring both the correct digits and the incorrect form, thank you for the help. MaskFormatter mask = new MaskForm...
asked by 01.12.2014 / 21:07