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
-
0
votes0
answers85
viewsHow to access a method of an Arraylist in another frame?
Classe Pessoa : public class Pessoa { private String nome; private int idade; public Pessoa(String nome, int idade) { this.nome = nome; this.idade = idade; } public String getNome() { return nome; }…
-
0
votes1
answer264
viewsHow to update text in jTextArea?
How do I update the jTextArea? I try to update it with the click of a button, but I can’t. I want to add new texts along with the previous ones, but so far without success. I performed the…
-
0
votes1
answer138
viewsNumberformatexception in GUI
I have a program that simulates a pizzeria system, where the prices of the products are stored in enums as double. The JLabel from the window take these price values and present it on the screen in…
-
0
votes1
answer323
viewsHow to take a char type die by Joptionpane?
char cadastrar; cadastrar = JOptionPane.showInputDialog("cadastrar: A-aluno P-professor M-medico");
-
0
votes0
answers82
viewsIs it possible to create fields in Jasperreports report without setting them beforehand?
Hi, I have a jTable where the user defines which fields will appear on it, this way I would need several reports JasperReports, one for each possible combination (chosen by jRadioButtons). There is…
-
0
votes0
answers738
viewsHow to make a simple timer using Timeunit.Sleep
I am beginner in Java and was trying to make a mathematical game whose theme was to add the random numbers of the buttons (of course the person would have the help of the numbers 1, 2 and 5) until…
-
0
votes1
answer177
viewsProblem displaying results in java label
package cursoemvideo; /** * * @author DANIEL */ public class TelaCalculadora extends javax.swing.JFrame { /** * Creates new form TelaCalculadora */ public TelaCalculadora() { initComponents();…
-
0
votes1
answer277
viewsProblems with paging on Jtable
I am creating an application where I fill the data of a table through the database, but there are many so I wanted to organize better. However, the results shown in the table are not constant. The…
-
0
votes2
answers65
viewsHow do I remove a band by its name?
I’m not getting the bands inside the arraylist. For this, I read the.txt file where the information(name,country,nrointegrantes) is stored. I made a split to access the name, but when I try to…
-
0
votes1
answer74
views -
0
votes1
answer14
viewsLike implying Mouselisteners on a Gridlayout?
I created a GUI for a Board of a game with an 8x8 Gridlayout. In this Grid I need to have a mouse Listener in each of the containers. How do I get that? I’ve tried many ways and I’m not getting it.…
-
0
votes2
answers63
viewsWhy don’t my labels show up in the swing?
Can anyone help me? It’s a pretty rookie mistake because my Abels aren’t showing up in the swing? import javax.swing.*; public class first{ public static void main(String[] args){ JFrame f = new…
-
0
votes1
answer116
viewsUnexpected result when triggering equal calculator knob
I created a calculator by netbeans, which is working if only one operation is performed. But if the user clicks again on =(equal button) the result adds the first entered value. Example: I typed 1+2…
-
0
votes0
answers131
viewsJPA Hibernate two entities with the same name, always saving in the same entity
I have a jCombobox where all the entidades students. It happens to have two entities with the same name (two students Rodrigo Silva for example). Both are loaded on combo. To the gravar the data in…
-
0
votes0
answers229
viewsAdd Jcomponents to a Jdialog/Jframe
So I have three JLabel and JTextField to add in one panel, and two JButton and a JTable to add in another panel, so that one stays below the other. I create a more generic panel (pnlPrincipal) to…
-
0
votes1
answer544
viewsWhat’s the Actionlistener for?
I’m starting to study Java. Can someone explain to me, in detail, in the most complete and simple way possible, what good is the method actionListener java (da lib swing). 'Cause I’m having a little…
-
0
votes1
answer68
viewsData acquisition by Jtable
I’m trying to get JButtonGuardar(panelInserir) pass user input(local time text) of the JPanelInserir to the JPanelEventos(where is Jtable) At the moment, I am not succeeding, if you have any…
-
0
votes1
answer481
viewsHow to create an event for a button in Swing/Java
Guys, I wanted to ask a favor, I wanted someone to show me how to create an event of a Jbutton, like, a q button when you click on it it opens another Jframe and closes the old one use this code as…
-
0
votes1
answer69
viewsShould I use Swingutilities.invokeLater if I don’t directly extend Jframe?
Hello. I understand that people use the method invokeLater of SwingUtilities when extending directly the class JFrame and initialize it in the method main. But what if I happen to have one JFrame as…
-
0
votes2
answers101
viewsMVC desktop - where is the Controller?
I modified it this example of MVC to try to make it more like my MVC vision (in which the role of the Controller is not very clear). I ended up with a program that only has Views and Model, without…
-
0
votes1
answer34
viewsHow to call a Jlabel with its content from another Class?
In a certain class I have a Jlabel thus: public class Links { private JLabel link; lblLink.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent arg0) {…
-
0
votes0
answers63
viewsHow popular is Jtable?
I have to fill out a table with bank data. But nothing appears at all. My Class Inserting information in the table: DefaultTableModel dtm = new DefaultTableModel(); String sql = "select * from…
-
0
votes0
answers115
viewsInvalidate characters from a Maskformatter
So guys, I have a window where I need to go through a validation of null fields of several JTextField and a JFormattedTextField, where the latter has a mask for phone numbers "(##)####-####". The…
-
0
votes2
answers52
viewsSelect from empty data
My code returns all users, checking if they paid the last month, however I connect two tables, one of all customers with the registered payments table, I want to print on jTable even if you have no…
-
0
votes0
answers15
viewsHow to Disable Jframe X
How to disable X from a frame? The below option I found just doesn’t perform close action: frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); I need the X button of the frame to be disabled…
-
0
votes0
answers60
viewshow to pass data from a Double Chained List to a graphical interface?
I am very beginner in programming and I am coding this program for a job. I have a "Filmoteca", I need to navigate through a list chained with a graphical interface. I don’t know how I can navigate…
-
0
votes0
answers209
viewsTaking textarea data from a Jtable
I know how to use the DefaultTableModel is not the best way to make the tables, however I have not mastered anything of AbstractTableModel, i have a table that is edited as Jtextarea, but when I…
-
0
votes0
answers551
viewsLogin and password verification
I need help checking a login and password. If the login and password I type in JTextField are the same as I have in the bank, can not allow registration, what I am looking for is not a validation…
-
0
votes1
answer1748
viewsHow to add scrollbar in Jpanel?
I would like to add a scroll bar to a Jpanel that uses Absolute Layout. package Default; import javax.swing.JFrame; import javax.swing.border.EmptyBorder; import java.awt.Dimension; import…
-
0
votes1
answer228
viewsHow to use Jprogressbar in Arraylist comparison classes?
I have a class that compares two ArrayList, one with information added by the user and the other with database query. After the query is done, I send this object to another class that performs the…
-
0
votes1
answer1056
viewsHow do you resize a Jpanel inside a Jscrollpane automatically?
After adding a greater amount of buttons than the JPanel support, I would like to update(increase the JPanel) automatically, how can I do this? private JPanel contentPane; private static int tamanho…
-
0
votes1
answer69
viewsText changes on the label with switch
You know that initial Pokemon conversation? "Welcome to the world Pokemon" - ENTER "Are you a girl or a boy?" -Enter CONTINUES.... So, I’m trying to do a Java swing, at the moment it’s like this:…
-
0
votes1
answer234
viewsHow to open a Jframe passed as parameter?
My idea is to open this window passed as parameter without it losing any attribute, for example, I have the class : public class Teste { JFrame janela = new JFrame; public…
-
0
votes2
answers1217
viewsUpdate Jtable using Defaulttablemodel
I understand that the use of Defaulttablemodel is almost abhorrent, however, I used this model and now I have no time to change to a Tablemodel (which I haven’t learned to use yet), is there any way…
-
0
votes1
answer124
viewsHow to add Jspinners values?
I want to make a simple program where the user puts a number on a JSpinner and, at the click of a button, will appear in another JSpinner, the value of the first summed by 2. However, I cannot sum…
-
0
votes1
answer395
viewsPerform an action when a button is first clicked and another otherwise
I would like to know how to make an if when the button is clicked. For example: private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) { ProdutosDAO produtoDAO = new ProdutosDAO();…
-
0
votes1
answer89
viewsClick on the screen and change the values of the variables
I need to implement in the code functionalities so that when I click on the screen, changes the values of some variables that are in the code. However, when I click it stays the same. My main class:…
-
0
votes0
answers587
viewsConstructing a java table from a vector as parameter
Hello! I’m having trouble constructing a table. Here’s the thing, the user defines a series of variables that are stored in an array. I would like the variables stored in this vector to constitute…
-
0
votes0
answers94
viewsHow to draw on a Jdialog
Hello. I have a window in Jdialog, where I put several components, which is like this: And I had to do something kind of like this: as this screen is very large, I will post only part of her code:…
-
0
votes2
answers821
viewsJcombobox inside a Joptionpane
Good morning, I have a list of some reasons private List<Motivo> motivos; And I need to fill a jComboBox with this list and get the selected option. Currently I did with Messagedialog where I…
-
0
votes2
answers172
viewsSum mm:ss of a jtable column
Good afternoon, I know that the way I’m going to explain it is difficult to help me. I have a jTable that contains a column where times are shown, those times in mm:ss. I need to average between…
-
0
votes1
answer731
viewsLeave only one editable Jtable column
I have my data model that I made for tests as shown in the code below: public class ModeloDados { private String nome; private String sobreNome; private String telefone; public ModeloDados(String…
-
0
votes0
answers310
viewsIdentify empty columns of a jTable and paint the entire row red
I am importing a file in Excel and playing inside a jTable, so far so good. What happens is that there is user inserting spreadsheet with empty fields. I would like to leave the whole Lina in red…
-
0
votes0
answers298
viewsShow Jprogressbar while connecting to database
I have a java desktop application with netbeans connecting via JDBC, and I have a class that connects to a database and returns some items that are stored there. I’d like to exhibit a progressBar As…
-
0
votes1
answer854
viewsAdd functions in graphical application buttons
I’m having trouble putting functions for java buttons. Can anyone help? Follows the code: import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Insets; import…
-
0
votes1
answer356
viewsHow to validate jcomboBox before saving
I have the following problem, I am trying to validate these jcombobox, I want that if the user does not select an item from the movie jcombobox, a message appears: "Select Movie", if it is the…
-
0
votes1
answer108
viewsJava java.lang.Nullpointerexception in a Jpanel constructor
I’m trying to compile a memory game in java, but gives the following error: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:217) at…
-
0
votes1
answer1159
viewsSearch box in Java
I am creating a Java system using Netbeans. I would like to create a search box that shows the results in a list (of variable size) below the box as the user enters the text to be searched. It would…
-
0
votes1
answer425
viewsHow to validate if a String already exists in the Jcombobox list?
It follows the code that I am locked, I wonder how do I validate if a directory that I will add, already exists in JComboBox? package view; import java.awt.BorderLayout; import java.awt.EventQueue;…
-
0
votes0
answers200
viewsHow to make Jframe with Jmenubar by calling another Jframe?
Hello, I have a main class that is working but when you click on the menu Register and then client it does not call the other screen Jframe Register clienteui. Here is the snippet that was to call…