Most voted "swing" questions
Swing is a Toolkit widget for use with Java, compatible with the Abstract Window Toolkit (AWT). Use this tag for questions regarding components or classes related to the development of graphic applications using this API.
Learn more…749 questions
Sort by count of
-
1
votes1
answer153
viewsManage or customize user session in Spring-managed Javase app
I would like to know how to manage or customize the user session in the Javase application (GUI / Desktop / SWING / thinClient) managed by Springsecurity?! For example, how could I set up Timeout in…
-
1
votes1
answer58
viewsScreen stops responding after clicking one of the buttons
I’m doing a simple program of the old game next to Swing. I wanted to know why, when shooting an event click by the method ActionPerfomed, my program freezes. I did some research and found that…
-
1
votes1
answer176
viewsKeylistener for various Jtextfields
I created a KeyListener for verification of a String typed, if it is in the bank. If it does, it sends an alert. The question now is that I have about 50 jTextFields. It is possible to create a…
-
1
votes1
answer185
viewsMy Jlabel does not appear
I’ve used several commands to make this label appear, but I can’t, in this object I’m using Paint and ActionPerformed, but no Drawing this overlapping this label and even then it does not appear,…
-
1
votes1
answer163
viewsApplication delay in switching between screens
When I change the screen, there is always a small delay from one screen to another and it is annoying. You see clearly that one screen closes to open another. you know that java symbol you get when…
-
1
votes1
answer443
viewsEnter edit mode when typing something when Jtable’s cell is focused
I have a celleditor in the format of textarea, and when you’re focused, I squeeze some word to type in celula. It opens the edit mode, but does not write anything, which may be wrong? working class…
-
1
votes2
answers433
viewsPut a name depending on the array number
Let’s say I have four variables: - Porto = 1 - Benfica = 2 - Sporting = 3 - Braga = 4 I have this code that makes me a shuffle of numbers of an array called "arr". Integer[] arr = {1,2,3,4};…
-
1
votes1
answer606
viewsHow to change the focus between tabs on a Jtabbedpane?
I am trying to do the following routine. On my "main" screen, I own a JTabbedPane with two tabs, in which the focus is on the first tab. I need to open one JInernalFrame and, by closing it, make the…
-
1
votes1
answer143
viewsCaptures what the user types and writes to a . TXT
I made a little program in Jframe, basically it captures what the user types and writes to a txt, but when I see the contents of the file is written, the following "null". What might be going on?…
-
1
votes1
answer224
viewsView Jtable on multiple panels
How do I make mine JTable is displayed on all tabs inside the panels? I’m only able to display in the "Day 5 tab". import java.awt.Container; import java.sql.ResultSet; import…
-
1
votes1
answer115
viewsProblem in the setListData
I did the example of the book "Java How to program". I’m having trouble on the line copyJList.setListData(colorJList.getSelectedValue()); Could someone help. package…
-
1
votes1
answer150
viewsDetect overlay of figures after dragging with the mouse
I drew four figures with Graphics 2D (two large and two medium triangles), being two fixed (1 medium triangle and 1 large triangle) and 2 for movement (1 medium triangle and 1 large triangle). When…
-
1
votes1
answer190
viewsClose System after Dialog Close
How can I make a login screen when it is closed, also close the whole system? In the code below I have a main screen with the button "change user", when clicking, the system opens a Dialog for the…
-
1
votes1
answer468
viewsFill table with data entered in Jtextfield, separated by comma
I have the code under a JTextField, where you wanted to type numbers separated by comma, and that by clicking on JButton, data were added in a table column. public class Dados extends…
-
1
votes1
answer112
viewsHow to remove add/remove dashboard as you select from checkbox?
I’m adding a panel at the bottom of a JFrame, when a checkbox this selected, and when I uncheck it, remove the panel, and leave only the checkbox, however, I’m not getting, I think the layout…
-
1
votes1
answer141
viewsHow to show only folders in Jfilechooser?
I have a JFileChooser and I need it to show only folders, but I can only show at least one type of file or show all types. Follow example code where I restrict to a file type: package NewClass;…
-
1
votes0
answers202
viewsDraw a Jpanel inside a Jframe
I’d like to know how to draw a line inside a JPanel which sits within a JFrame, by pressing a button. The layout of the button and the JPanel within the JFrame is shown in the image below: When the…
-
1
votes0
answers22
viewsJscrollpane producing glitches on the screen
I have little experience with Java Swing and am getting beat up with one simple thing. The code below produces glitches (artifacts/dirt) on the screen when the scroll bar is dragged repeatedly and I…
-
1
votes1
answer140
viewsDistribution of components in Grouplayout
The example below has a GroupLayout which contains two elements, a custom search and filter bar (JPanelSearchAndFilter) and a JScrollPane. When it runs and then the window is maximized you can…
-
1
votes1
answer227
viewsHow to reduce the spacing between items in Boxlayout?
In my example, the class Teste is a JPanel with BorderLayout. Within the central region of this layout there is a JScrollPane containing another JPanel with BoxLayout vertically. The intention is…
-
1
votes0
answers71
viewsVBA Getobject using variable in Windows 10 registry Swing Project
Hello. I have a problem with a component here in the company. The application is built in Swing with java 6. We use a framework called Jintegra. We have a feature where the user clicks on the button…
-
1
votes0
answers29
viewsJasperreports - Is it possible to work with datasource with dynamic (non-static) method?
I am trying to generate a report powered by a web service. The idea is that when the user calls the report generation command he (the command) calls a method that will bring back Java Beans from a…
-
1
votes0
answers49
viewsHow to display histogram in a Jpanel?
The main program, whose code I didn’t put here, has a button that opens this frame, whose code is down here. I want to display a histogram within that frame. import java.awt.BorderLayout; import…
-
1
votes2
answers51
viewsTablecellrenderer, problem in color display in table
Here’s the thing, I want to change the font color a specific part of my table when the user’s payment is up to date to blue. Otherwise, I want it to change to red. I want only the "situation" column…
-
1
votes1
answer139
viewsException in thread "main" java.awt.Illegalcomponentstateexception: The frame is Decorated
Guys I came back, I started studying AWT I made a simple program that just opened a window with a green background, but I try to create an event to the program window close and is giving the title…
-
1
votes1
answer58
viewsSpecial Character with Scanner and Filereader
I have a.txt file with the following values: TESTE 17,00% 01/01/2014 25,55 AÇAILANDIA When importing this txt in my Java application the special character Ç is not imported and the result is like…
-
1
votes1
answer620
viewsDirect Print to Non-standard Printer with Jasperprintmanager
In my system a txt file is imported read and printed on the standard printer, the report is done in ireport and I use the printPage method of Jasperprintmanager to print on the standard printer,…
-
1
votes0
answers75
viewsCreate a dynamic Java screen
I created a software in Java to make comparisons, the idea is to register objects as cell phones and create criteria to define the best according to their weight. Problem: I want to register an…
-
1
votes1
answer84
viewsHow to delete data from Jtable and insert it again?
Through a button that has Coo function update the table I want the data to be removed and then come back, my code until then this so: public class atualizando implements ActionListener { @Override…
-
1
votes1
answer97
viewsJdesktoppane does not remove closed screen rendering, how to proceed?
I created a basic screen with Netbeans that has a menu and a JDesktopPane that opens the JInternalFrame menu-referenced: As well as a function to open these JInternalFrame: private void…
-
0
votes2
answers653
viewsHow to increase the width of a Jcombobox?
How do I increase the width of a JComboBox in Java? The layout I’m using is as follows:: setLayout(new FlowLayout(FlowLayout.LEFT));
-
0
votes1
answer1030
viewsAutocomplete Jcombobox
I have a JComboBox that the autocomplete is only searching for the beginning of the word and need that when the user type search for any occurrence within the word, which is the way that the…
-
0
votes1
answer2623
viewsMoving circle on the screen with thread and jFrame’s Paint method
Studying the design method of JFrame in case the paint and wanted to make a circle move on the screen using threads, but the circle does not move right. Perhaps you would need a method movimenta to…
-
0
votes1
answer869
viewsHow to do basic mathematical operations?
I’m developing a Java calculator for a college job where it’s possible to do the four basic operations (addition, subtraction, multiplication and division), plus square root and square number, but…
-
0
votes0
answers888
viewsWhat is the best way to show the External Quicksort simulation
I have to make one External quickSort simulator, showing for example the step by step of the same. Showing modifications to variables lower bound, upper bound, the main vector, the area vector(would…
-
0
votes1
answer299
viewsHow to record multiple information in multiple classes using only one save class?
My problem is this, I’m developing a program that has several buttons that correspond to certain students, within each student I have personal information about and only this Student, I have a class…
-
0
votes1
answer300
viewsHandling components of a container
I added a frame with several components to one container. In another class I add to jPanel the data from container. In this class, is there any way I can get access to the components of this…
-
0
votes0
answers68
viewsAccess to the checkbox of each Ode from a Jtree
How can I access the checkbox of each Ode of a JTree? TreePath[] checkedPaths = checkTreeManager.getSelectionModel().getSelectionPaths(); The previous code returns me all the selected paths. When I…
-
0
votes1
answer35
viewsSwingdialog Error Fatal
I am studying Swing with the Java Programmer’s Guide book, and this code does not validate. import javax.swing.*; @SuppressWarnings("serial") public class Main extends JFrame{ public Main() {…
-
0
votes0
answers399
viewsHow to save the selected line of a Jtable in the BD?
I have a JTable which fills the database, where I can select several lines at the same time with the Boolean field that has been added. I need that when you click the "record" button on mine form…
-
0
votes1
answer159
viewsJtextfield validation
I’m trying to validate the field txtServicoValor who gets a guy BigDecimal, follows my code, the validation is barring both the correct form of the digits and the incorrect, I appreciate the help.…
-
0
votes2
answers671
viewsIn java, how to make only one Jframe window close when clicking on the x instead of all?
I’m making a program in Java with multiple windows JFrame, and wanted that when I pressed the x of one of the windows only this one closed, instead of all of them.
-
0
votes1
answer264
viewsError 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…
-
0
votes0
answers257
viewsPrint selected nodes of a Jtree
I got this Jtree: I have this code that returns to me all the nodes of JTree: public void print() { recurse((TreeNode) jTree2.getModel().getRoot()); } public void recurse(TreeNode theNode) {…
-
0
votes1
answer133
viewsRetrieving data from an object
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 in it, the problem is that as…
-
0
votes1
answer748
viewsAre there other GUI libraries besides awt, swing and javafx?
I wanted details and what are these libraries for to help me develop my video rental software.
-
0
votes1
answer1665
viewsPrint Arraylist, Java Swing
I am starting my studies in Java applications with Swing, and I have doubts about how to print my Arraylist. How best to print or list an Arraylist within a window? In my case we have an agenda, we…
-
0
votes2
answers120
views(Business rule) -Repeated registration
How do I make this business rule that prevents the user from registering an account with the same number and agency ? Main class public class Main { public static void main(String[] args) { menu();…
-
0
votes1
answer121
viewsHow to change the size of a Jfilechooser?
Hello, I wonder if anyone knows any way to increase the size of a Jfilechooser like this : I would like it to fill up all the space left on the screen, to make it easier to locate the files. Thanks…
-
0
votes0
answers270
views(Business rule) - Update balance
I am developing a business rule in which the user when typing the number and agency from the bank account, he has two options: 1-Credit: The user will type char 'c' through Jtextfield credit…