Questions tagged as 'swing'

1
answer

Position JPanels vertically

I'm trying to add 4 panels so that they stay one below the other. So I decided to use BorderLayout , along with "positioning" ( NORTH , SOUTH and etc), passing index , however, it ends up jumping the second panel. Does...
asked by 16.09.2017 / 19:53
1
answer

Item in comboBox selected, display data in jTable

Before asking this question, I looked in the forum and in several places but I could not solve ... I have a comboBox that already loads the names of the clients, there I wanted to select the client, and on a ok button to fetch that cli...
asked by 09.07.2017 / 14:46
1
answer

JTextPane Word Wrapper

I am not finding a method to organize the lines within a JTextPane, and I need to continue styling but also with a Word Wrapper, is there any method or component that makes it look like this? public class PanelTeste extends javax.swing.JFrame...
asked by 02.09.2017 / 14:09
1
answer

How do I remove listeners according to the state of the component?

I have a JLabel that receives an event, and would like to disable this event when the component is disabled (setEnable = false), and only activate it again when the component is enabled. What I did: import java.awt.Cursor; import java.awt.e...
asked by 30.07.2017 / 22:20
1
answer

As per a JScrollPane in a JTextArea?

I'm trying to create a project where I print multiple phrases in a JTextArea , but for this, I need to include a JScrollPane . I looked at some examples on the internet but none are working. public class Projeto extends JFrame {...
asked by 22.08.2017 / 14:01
1
answer

How to draw GIF with ImageIO and drawImage

I need to draw a GIF, I have the following code: public BasicBlock(String path, String name, int id, boolean gif){ this.path = path; this.name = name; this.id = id; File img = new File(path); try { image = Image...
asked by 10.07.2017 / 02:22
1
answer

Control event in the field?

I'm trying to handle a possible empty search, when the user gives enter in a field without typing anything. I've applied a keyboard event, and every time you press enter, the field performs a search. The problem is that if the message appea...
asked by 23.07.2017 / 02:00
1
answer

Control animation speed using the JSlider component

Well, I'm developing a project that simulates the controlled environment of train tracks, where I have 3 trains running clockwise, where the three pass through the same place in certain sections. I'm having trouble implementing the train speed d...
asked by 04.08.2017 / 19:21
1
answer

NullPointerException error while executing java maven project

I created a Maven Java Application project and only created a layout of a screen. When I try to run, it displays the error of NullPointer , and I have not yet implemented any code other than the ones generated by IDE itself. What could...
asked by 07.03.2017 / 22:18
1
answer

Capturing action of certain buttons in a JFrame

I created a JFrame that, when clicking the keyboard buttons: up, down, left and right, a certain action should take place (a Joption in the case). For this I am using a KeyListener , but unfortunately I click on certain buttons a...
asked by 20.06.2017 / 00:46