Questions tagged as 'swing'

1
answer

How to change the background of a JDateChooser?

I have a JDateChooser and would like to change the background when it won focu , however I'm not getting it. I tried to do it in some ways: dataChooser.getDateEditor().getUiComponent().setBackground(new Color(0, 0, 0)); or...
asked by 02.09.2017 / 18:08
1
answer

Doubt with JComboBox to enter data at runtime [closed]

I'm new to Swing and this is the first Java application I'm actually doing, however I'm doubtfully related to JComboBox because I'd like to do a field (JTextField) where I'd put the directory and click a button JButton) and send it to the JCombo...
asked by 13.01.2017 / 04:15
1
answer

Adjust columns according to available JTable size

I have a JTable where the user can hide and then display one or more columns again. I found a code that adjusts the column according to the size of the "value" from Camp". I call this method as soon as populo to JTable . public...
asked by 07.07.2016 / 19:20
1
answer

I can not do a click counter on a JButton

I'm developing a "game" where there is a button on the screen and the player has to click the button several times to make money. For this, I'm doing a kind of click counter, where%% is the number of clicks, and the number of clicks is equivalen...
asked by 16.06.2016 / 17:41
1
answer

JButton trigger two different events?

I have a program that simulates a game of data, where I have two "data" that, when the sum of the two gives 7, the user is a winner, if not, he loses. Well, I made a simple interface in swing , where I created two buttons, one launches t...
asked by 23.05.2016 / 03:37
1
answer

Spring boot Autowired in JFrame

When developing a Spring Boot Desktop application, can you inject a @Repository into a JFrame class? If yes how? Any alternative? Code samples: @Repository public interface ItemRepository extends CrudRepository<Item, Lon...
asked by 15.07.2016 / 02:43
1
answer

Open JFrame in maximized Java

I'm having a problem, I'm creating a JFrame and I want it to open maximized. I'm using the following code: frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setLocationRelativeTo(null); The size of the JFrame is maximized, but the button...
asked by 01.05.2016 / 17:11
1
answer

How to use the TIMER class in a method with Math.max and Math.min

I have an ambitious project to create my math game (which I found to be better than a simple calculator) in just a JFrame , with methods only, without using any other class in the package ... With the help of Swing and Netbeans...
asked by 15.04.2016 / 20:09
1
answer

Get Frame already started from the "Event Dispatch Thread"

I have a desktop application in swing , and in it, I have a single JFrame that always stays visible while the application is open. There are also some% modal_dependents dependent on this Frame , which open from certain buttons in...
asked by 05.04.2016 / 17:47
1
answer

Control java application from the outside

I created a java SE application that runs in the background, without swing or anything ... But how do I control this application? for example, in python applications we can execute commands (python something.py -c command1 -u command2), so I can...
asked by 27.05.2015 / 23:55