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
answer167
viewsOrganization of codes generated by Windowbuilder
I’m using Windowbuilder to draw the graphical interface, but there’s one thing that’s kind of boring about it, and that’s this. When I create a Jlabel for example, it declares the Jlabel inside the…
-
1
votes1
answer412
viewsHow to manipulate Labels using a loop
How can I use these Abels using a loop instead of creating 40 lines of repeated code? jLabel1.setIcon(new ImageIcon(getClass().getResource("/cards/"+cards.get(1)+".png"))); jLabel2.setIcon(new…
-
1
votes1
answer87
viewsJava Bounceball Bubble Movement - Error
I’m doing a Bounceball game, using iteration with the mouse pointer. But I’ve come across a problem I’m having trouble solving. The general idea is that, the bubbles move around the screen, and when…
-
1
votes1
answer101
viewsHow to prevent moving the cursor on a jFormattedTextfield with a mask?
I have a field formatted as follows: '### ### ###' When I click on the field that contains that mask sometimes the cursor gets me in the middle or where I click. Example: '##|# ### ###' Is there any…
-
1
votes1
answer121
viewsUsing Napkin Lookandfeel
I’m using the Eclipse IDE and I have this code: package br.com.caelum.argentum.ui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import…
-
1
votes1
answer119
viewsReturn names of selected items from a checkboxTree
How can I check which items are selected from a checkboxTree ? I have already searched and I know that this code returns the last selected: DefaultMutableTreeNode node = (DefaultMutableTreeNode)…
-
1
votes1
answer909
viewsSwitch from Jframe to Jdialog
I created a frame of this genre: But, since it was to present that the client was having trouble connecting to a server, it was better to move to Jdialog Problem: I can’t make Jdialog visible Code:…
-
1
votes0
answers223
viewsPause Cycle until Jframe closes
I am going through a cycle with values, and in each iteration I call a Jframe to choose certain values, what happens is that all Jframes are opened without being able to complete the operation. In…
-
1
votes1
answer625
viewsHow do I send data from a Jtable to my BD?
I have a filled-in Jtable and need to store its data in a table in my database. How do I do that? I only know the reverse way (fill a table from the BD) am using Mysql
-
1
votes1
answer88
viewsResource icons Jframe
Good afternoon. I’m having trouble with my app. It executes with changing the icon on JFrame. When compiling it for: "Runnable Jar file" and compiling with: Launch4j for Inary, the application…
-
1
votes1
answer500
viewsAdapt Tooltip code to an already created jTextField
I found this code that works well for the button: public class CustomJToolTipTest { private JFrame frame; public CustomJToolTipTest() { initComponents(); } public static void main(String[] args) {…
-
1
votes1
answer241
viewsI wonder how I use Swing
I am learning Java Eclipse and would like to know how to use Swing. Need to install? How it works?
-
1
votes1
answer331
viewsInsert component without using setBounds
I’m using a free design in my project and dragging to my jFrame the components I want. However, I needed to use a jComboBox with autocomplete and guided by this site. Now I wanted to use the class…
-
1
votes1
answer1996
viewsHow to update a jTable that displays BD data after registering a new item?
I have a table (jTable) that displays all the data registered in a database. My table is filled every time the application is started through a Windowevent, but when I make a new registration in the…
-
1
votes0
answers544
viewsSize of the Jpanel screen
I had created a Jpanel with a canvas with a good size. Then I had to replace my monitor with a lower resolution. Now the screen size of Jpanel is small, making that part of the look I put does not…
-
1
votes1
answer933
viewsAlways focus on Jframe
I need that when I click on some button of my application the focus returns to the JFrame. Is there any method for this? I could call the method MeuFrame.requestFocus() in each ActionPerformed, but…
-
1
votes2
answers357
viewsHow to hide title from Jtabbedpane tabs?
I need to hide the titles of JTabbedPane because I’m creating my own buttons to access the tabs.
-
1
votes1
answer7551
viewsPick up the selected item in Jcombobox
How do I get the user selected item on this Combobox? opcaoBusca.setModel(new DefaultComboBoxModel(new String[] {"Op\u00E7\u00E3o da Busca", "N\u00FAmero do Pedido"})); entBusca = new…
-
1
votes2
answers462
viewsHow to remove the text border in a component?
I have a program in Java and would like to remove these borders that appear in the button text: (The red edges were in the issue the ones I want to remove are those dark blue ones inside the red…
-
1
votes1
answer496
viewsHow to use "drawRect" to draw on a component?
I am learning Graphics, but I can’t make a square: public static void main(String[] args) { JFrame tela = new JFrame("Snake"); tela.setSize(500, 500); tela.setVisible(true); Graphics g =…
-
1
votes1
answer1876
viewsReturning database id in a global variable. How to fix?
After command insert, i can recover the id generated by the database using a global variable public static int returnID. But I didn’t think it was very cool to leave the variable static. Is there…
-
1
votes1
answer358
viewsButton does not appear in window
My button called btnLimpar does not appear. that’s the code: import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Frame…
-
1
votes0
answers69
viewsHow do I make a Jdialog invisible when I give Dysplasia in a specific frame?
A button of my application gives dispose in the current frame and creates another different one. But the JDialog that were open when I click the button continue to exist, which should not happen.…
-
1
votes0
answers48
viewsGive more than one event to a window
So I created a java window, but I need to assign a different event to it depending on the occasion it is called. And the problem is, I can’t do it. There’s a way to do it? Window:…
-
1
votes1
answer801
viewsJtable does not display column names
I made a Jdialog that will show some statistics of the users who use the software, but I’m not able to make the columns name appear. I tried to add using the .addColumn model but not working. class…
-
1
votes1
answer61
viewsfireTableDataChanged in Abstracttreetablemodel Swingx package
I’m having doubts about how to make a Reload on the objects of a JXTreeTable using a Model > AbstractTreeTableModel. The AbstractTableModel of a JTable normal has the fireTableDataChanged, but…
-
1
votes1
answer1525
viewsUpdate (refresh) a Jdialog (swing) dynamically
I’m having some problems updating the JDialog created through the WindowsBuilder no Eclipse (would not be on account of this). Basically I have a screen Change Registrations of my financial…
-
1
votes1
answer52
viewsFailure in swing application response
I have a swing application in which verifying whether the typed word is correct or wrong. String palavra[] = new String[3]; palavra[0] = "bar"; palavra[1] = "ola"; palavra[2] = "alo"; String p =…
-
1
votes1
answer343
viewsHow to clear Jtable’s cell when starting typing?
How can I clear the cell in Jtable by starting to type in an equal cell in excel. For example, I place the cursor in a cell and when starting to type the cell enters editing mode, at this precise…
-
1
votes0
answers68
viewsJava app application
This code when pressed on button definicoes, opens a new window with an image, a line with text and also generates radio Buttons, but the problem is that it creates another new window with radio…
-
1
votes1
answer47
viewsMy Labels are abbreviated when running program
When I run my program the text that is inside my Abels are abbreviated, I even try the space needed, to solve I have to leave an absurdly large space inside the label, which gives a lot of work to…
-
1
votes0
answers62
viewsNullpointerexception error
I have a program that does biometric authentication in two versions: 1) User selects binary file via javax.swing as follows: public class Busca extends javax.swing.JFrame { ...…
-
1
votes2
answers2880
viewsHow do I popup a new Jframe?
How can I do for when to press one JMenuItem it show a window where I would have to enter, for example, a date and select from a couple of checkboxes? Briefly, as I do a "popup" a new JFrame? Thanks…
-
1
votes1
answer961
viewsHow to update Jtable used data from a database?
I created in Netbeans a customer registration and movie registration system (simulating a video rental company). I have 3 Java files: Video Rental (main), Client and Movie. In Client and Film, I…
-
1
votes0
answers50
viewseclipse database connection
btnLogIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { Connection lig = DriverManager.getConnection( "jdbc:mysql://localhost/gym", "root", "");…
-
1
votes1
answer1097
viewsRefresh Jframe
I made software to monitor servers I have a Jframe with several buttons in which these set a color (green if server is online and red otherwise). I do this test using ping. When I click the button…
-
1
votes1
answer1884
viewsHow to update a Jlabel periodically?
I would like to know how to keep updating periodically a Jlabel, since this label depends on another method. In this case it would be the lblNewLabel_1. public class MenuGFinancas extends JFrame {…
-
1
votes1
answer552
viewsContainer and swing design
What are the precise definitions of Container and Component in Swing? Why are these elements important for building the GUI?
-
1
votes1
answer764
viewsHow do I initialize the centralized Jframe?
I’ve tried the this.setLocationRelativeTo(null); only he wasn’t in the middle of the screen, I’d say he was much more right and down than in the center. public Principal() {…
-
1
votes1
answer1440
viewsHow to center a Jframe on the computer screen?
I’m using the GUI Builder Netbeans to do some things with Swing and would like to centralize the JFrame, in which is my application, on the computer screen. However, do not know where I edit this…
-
1
votes1
answer143
viewsShortcut to main panel via Jmenuitem
I’m working on eclipse Mars 2.0, where do I use the windowBuilder, and I’m having trouble turning on the shortcut: Consultar -> Dia (mntmDia) to the main page panelConsultarDia, that is, when…
-
1
votes1
answer476
viewsJdatechooser and Jcombobox picking blank values
I’m having some problems trying to capture the value of some elements of my code. 1º - Problem with Jdatechoose component The code runs smoothly but the captured value goes blank, follows code…
-
1
votes2
answers900
viewsEnable Jbutton from selection in Jtable and remove the initial focus from the table
I have a window with a JTable, where only an entire row is valid, not just one field. The point is that the window already opens with the first line selected, and I’d like to disable that. In that…
-
1
votes1
answer538
viewsHow to create a dynamic Jtable?
I have a JTable in my form, I wanted the size(number of rows and columns) of the table to be according to the number the user enters, how to do in java?
-
1
votes1
answer1738
viewsSearch using Jtextfield and Jtable
I have a question as to the research on a Jtable using Jtextfield. When the person enters the Work name in Textfield and click Search, in Jtable is to appear the search result. My question is this:…
-
1
votes1
answer135
viewsUse of Swingworker in connection with standalone bench
I have an application in java that I made in my work, to control sequence numbering of crafts, the same is in jar format in the network (I made using swing in java + HSQLDB). One problem that wasn’t…
-
1
votes1
answer1191
viewsDynamically Create Jlabels
I have to create, from a click of a button, a JLabel dynamically. So that these honeys are organized in an order, assigning a name to that JLabel. The user can create as many Abels as he wants...…
-
1
votes0
answers325
viewsConversion from String to Bigdecimal is giving error and method not saved
I’m making a system for video rental and on my category screen a field called value to save the value of my category. I was able to convert String to Bigdecimal using the following methods:…
-
1
votes1
answer1071
viewsMinimize application to system tray
I made an application as requested by a client, but at the end of the project he informed me that the application should open in Tray Icon, and when minimized continue running in Tray My application…
-
1
votes1
answer76
viewsIs it possible to decrease the startup time of my application?
I’ve seen a lot here and at Stackoverflow in English about Swing and Runnable, I still couldn’t solve my problem. I am developing a work for the college (interdisciplinary work involving Distributed…