Questions tagged as 'swing'

1
answer

How to show only folders in JFileChooser?

I have JFileChooser and I need it to show only the folders, however I can only display at least one file type or show all types. Here is sample code where I make the restriction for a file type: package NewClass; import javax.swing.file...
asked by 11.06.2018 / 02:32
1
answer

Detect overlapping figures after dragging with the mouse

I drew four pictures with Graphics 2D (two large triangles and two medium triangles), two fixed (1 medium triangle and 1 large triangle) and 2 for movement (1 medium triangle and 1 large triangle). When you move the picture, you need to detec...
asked by 16.04.2018 / 17:24
1
answer

How to change the focus between tabs in a JTabbedPane?

I'm trying to do the following routine. On my "main" screen, I have a% w / w of% with two tabs, where the focus is on the first tab. I need to open a JTabbedPane and, when I close it, cause the focus to go to the second tab of my JI...
asked by 23.03.2018 / 19:47
1
answer

My JLabel does not appear [closed]

I've used a couple of commands to make this Label appear, but I can not, in that object I'm using paint and ActionPerformed , but no drawing is overlapping this label and even then it does not appear, p> package scenes; import java.awt.A...
asked by 11.12.2017 / 19:31
1
answer

Display a confirmation when trying to close a JInternalFrame

I am creating a program using JInternalFrame , but I would like to request a confirmation if the user clicks the close button "Closable". For this, I'm trying to overwrite the internalFrameClosed and internalFrameClosing m...
asked by 26.12.2017 / 15:35
1
answer

How to use a JComboBox from one class to another?

I want to create two screens, one registers the values of the JCombobox and in the other I use the values. I can recover the Combobox but it does not appear any value. Class of registration public class Combo extends JFrame{ private JB...
asked by 29.09.2017 / 19:41
1
answer

Line break in JButton

I am developing a complete and beautiful periodic table for the course. But at the time of implementing jbutton it lets me put just a text, no space, line break and other phrases in other lines, as would a normal table. How do I break lines in t...
asked by 08.11.2017 / 13:45
1
answer

KeyListener for multiple JTextFields

I created a KeyListener to check for a String typed, if it is in the database. If yes let it proceed, if not, issue an alert. The question now is that I have about 50 jTextFields . Is it possible to create a KeyListener...
asked by 03.12.2017 / 20:07
1
answer

How to use the BalloonTip library?

I would like to use tooltips like the balloontip library, but I did not find one way to use, it seems to be different from the conventional toolTips that to be applied use the setToolTipText method. How can I apply this...
asked by 21.10.2017 / 01:07
1
answer

Positioning components vertically with GridBagLayout

I created a java code to position objects in the window of type JComboBox and JTextField and I want them to be one underneath the other. The code I tried is this: /*Biblioteca */ import java.awt.*; import java.awt.event.*; import...
asked by 21.10.2017 / 22:46