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
votes1
answer698
viewsHow to align Jbutton text to the left of the icon?
I need to align the text of JButton the left of the icon as I do? I tried to use the method button.setHorizontalAlignment(SwingConstants.LEFT); but this method does not align the text the way I want…
-
0
votes1
answer85
viewsJbutton’s actionperformed does not open the Frame before finishing all events
I have the following problem: By clicking on Jbutton I want to open a Waiting Frame that asks the user to wait a few moments and meanwhile the program will process the query methods that take some…
-
0
votes0
answers38
viewsProblems with Rest Java swing consumption?
I have a java swing application where I get a list of data from a webservice. When I run this by netbeans it does it right, now when I jar to send it to the client, the application just doesn’t make…
-
0
votes2
answers49
viewsCorrect display of Radionbuttons
I’m trying to implement a JRadioButton but after entering the 2 in the form, only one is displayed, someone help please ? package com.roknauta.fasttracker.utils; import java.awt.Component; import…
-
0
votes1
answer89
viewsJava.lang.Nullpoinerexception when trying to insert database data into a Jcombobox
Today my team and I came across a problem trying to do something seemingly simple: display a clerk’s surname in a Jcombobox. The problem is that when opening the screen we receive a…
-
0
votes1
answer292
viewssetText method does not insert the text correctly within a repeat loop
I created a method that shows a loop of repetition, and inside it I keep setting the product of the variable by the counter, like a table and such. Only when it arrives in Textset, it does not show…
-
0
votes1
answer43
viewsIterate over components Swing recursively is strange
To add Listeners to all components of my Frame I’m iterating on it recursively: private void adicionarListeners(Component componente) { Stack<Component> stack = new Stack<Component>();…
-
0
votes1
answer862
viewsHow to insert column titles into a jTable?
I couldn’t display the title of the chart, could you help? Obs.: I inserted it "JScrollPane scroll = new JScrollPane(tabela);" and "contentPane.add(scroll);" or "getContentPane.add(scroll)" as I saw…
-
0
votes0
answers148
viewsSwing integrated with Javafx is possible?
I wanted to know if it is possible to call a Javafx screen through a Swing screen button. The code of the Javafx screen I want to call is the following: public class EditorHTML extends Application {…
-
0
votes0
answers40
viewsHow do you make Jtextfield behave like Combobox?
I wonder if there’s a way to turn my Jtextfield into some sort of combo box. I would like that when I type something, this data is automatically relating to some database and appear options of…
-
0
votes2
answers465
viewsHow to prevent the object to exceed the limits of the screen?
I started programming a little game where an object moves across the screen via the arrow keys on the keyboard. The difficulty I found is the fact that the object surpasses the JFrame, that is,…
-
0
votes1
answer672
viewsChange the color of the Jtable header
How do I change the header color JTable using the Nimbus Look And Fell? I tried to use: JTableHeader header = jTable2.getTableHeader(); header.setBackground(java.awt.Color.yellow); But it didn’t…
-
0
votes1
answer315
viewsHow to fire a method after editing an Integer column in Jtable
I need to call a method that shows the user any message. This method should be called at the exact moment the user finishes editing a Jtable column of type Integer and the user has not entered an…
-
0
votes2
answers833
viewsReturn search data to database in Jtable
I’m developing an interface that should return in a JTable values of a mysql table. I have developed the following method: public class Teste extends javax.swing.JFrame { private JTable table;…
-
0
votes1
answer249
viewsSelect all Jcheckboxes by clicking button
My application has a list of JCheckBox within a Box. I want to make a button to mark all of them, but my code is giving the following error when I click the button "java.lang.Runtimeexception:…
-
0
votes0
answers139
viewsCalling a jFrame from another class in java click event
I have a Jframe with two buttons, and a second class that has a Jframe with other features... I wanted to make the second window open by clicking on one of the buttons in the first window, but I…
-
0
votes1
answer497
viewsHow to get the value of a Jspinner inside a loop?
I am mounting a screen where products are displayed from a database: product title, price, button and a spinner. I try to give a jspinner getValue, but it does not return the value that the user…
-
0
votes0
answers21
viewsAdding Components to a Jframe
Hello, I’m trying to build a simple interface to implement a minefield. The end result should be something like a grid of buttons, very simple. The problem I’m having is that when I create a class…
-
0
votes1
answer122
viewsJtable with monetary value in a single column
In order to implement a monetary value formatting in a jtable, I tried to use the Rafael Chaves as a base and I managed to make the code below. import java.awt.Color; import java.awt.Component;…
-
0
votes0
answers64
viewsI can’t set in textField JAVA
I have this frame, where clicking the 'SEARCH PRODUCT' button opens another frame with the list of registered products: public class GeracaoOcamento extends javax.swing.JFrame { public…
-
0
votes2
answers1676
viewsjava.lang.Noclassdeffounderror running application
I made a java program that uses JDateChooser for the user to choose the date they want. It works normally within Eclipse but when I export the project to a .jar and try to run by cdm it shows the…
-
0
votes0
answers31
viewsI can’t show custom Jtable inside the frame
create a custom table model but do not click on my frame. Someone could help me? public class PessoaJTable extends JTable{ /** * */ private static final long serialVersionUID = 3182466937648479844L;…
-
0
votes1
answer114
viewsHow to position a browser within another Jframe interface?
I am developing a project in Java to simulate a proxy server with authentication that presents a single interface, in which several internal frames are arranged inside it. How to position a browser…
-
0
votes0
answers172
viewsConduct research in jTable
I’m conducting a survey in my jTable, but when performing the research, the jTable displayed only content similar to my search. I would like to conduct a search on jTable without inhibiting all…
-
0
votes0
answers119
viewsRun application . jar made in swing
I created a simple calculator, with just the add-on function. Running the IDE works normally. So I built and tried to run the application outside the IDE, but I was not successful. You could tell me…
-
0
votes0
answers81
viewsHow to pass data from a Jtextfield to a Postgresql Date field
I urge you to help me solve a problem of entering data type Date (SQL) to register new students in the Crud project developed by me in the code below. The method containing the INSERT INTO command…
-
0
votes1
answer83
viewsProblem when holding a button event in Java Swing
I’m having a problem doing an event on a button (using textfield to set values) and calling a method to calculate BMI (I haven’t finished this method yet). Code: (java screen.) package…
-
0
votes1
answer332
viewsDelete only lines with selected checkbox in a Jtable
How to delete from a JTable lines that are marked in a Checkbox that is in a table cell? I am using AbstractTableModel. The code I was able to create, erases only part of the selected records,…
-
0
votes1
answer592
viewsDisable Jframe Maximize Boot
I set the size to 600x600, but I wanted to know how I do so that when I click on the maximize, I don’t run out of the background or even take out the maximize button and just let it minimize and…
-
0
votes2
answers443
viewsDisplay date correctly on a Jtable
I am unable to display the sql database date type Date in Jtable, the date appears that way: I use the following method to call the table data: public ArrayList<Alunos> read(){…
-
0
votes1
answer128
viewsJscrollpane track which component is focused
I have a screen with a JSrollPane and several JTextFields. When I change textfield using the key tab, the JScrollPane does not track if the textfield that receives the focus is "below the screen". I…
-
0
votes1
answer80
viewsRead text file and copy your lines in Clipboard using Toolkit
I have a text file (txt) with 1000 lines, and I wanted to include them in the Clipboard. But from the examples I tested, only the last line is being copied to the Clipboard. I looked for something…
-
0
votes0
answers109
viewsVery slow Java SE application with remote Mysql BD, how to optimize?
Hello, people. I am developing a desktop application with Java SE and testing the software with a remote database it gets very slow, while with the local database it works normally. The following is…
-
0
votes2
answers34
viewsjTable does not add the second string I put in an array
I created an array with two values and wanted to put it in a table... with an insert button (insert several lines) 1-I declared the string line[] and the values below; 2- I thought a 'for each'…
-
0
votes1
answer80
viewsJoptionpane calling the screen Main
Good evening, I believe this doubt is simple but I can not solve, I have a method that displays a message instructing the user in the filling of a Captcha, until then ok, the "problem" is that when…
-
0
votes1
answer75
viewsWhy is it that when I put on the "Jcombobox" component of Swing, my show looks like this?
code I used import javax.swing.*; public class ComboBox extends JFrame{ JComboBox<String> combo = new JComboBox<String>(); public ComboBox(){ add(combo); combo.addItem("Brasil");…
-
0
votes1
answer160
viewsFormulario.java:28: error: cannot find Symbol Botaoaction action = new Botaoaction(t);
Ah, so I was creating a show with Swing, heunderlined text reads the name that the user puts, and then shows it to him, very simple thing, I’m still very new, but when I created the class…
-
0
votes1
answer287
viewsHow can I change the position of my Jbutton in Swing?
Hello, I’m a beginner and very layman in Java, I was creating a program, and in this program had a button, I wanted to know how I change some button of place in Swing, if someone can help me, I…
-
0
votes1
answer64
viewsJprogressbar loading in real time
It sounds silly, but I don’t know why you’re not incrementing the Jprogressbar() of my Java Swing application. Follow code below: public void executar() { JFileChooser fc = new JFileChooser("Z:\");…
-
0
votes1
answer53
viewshow do I use Actionlisten? I need an example to better understand
Guys, in a previous question I had asked a question about actionListen, but I wanted to ask an example, could someone give me an example, I created this simple code q shows a Jbutton in Swing,…
-
0
votes1
answer77
viewsJtextfield left alignment, but he won’t stay left
I’m working with Jtextfield and I’m having a problem with alignment. The field size is standard, I can’t change it. The field is also not editable, it receives the value based on a calculation…
-
0
votes0
answers70
viewsUpdate Jtexpane (display scrollbar) when inserting information
I have a JTextPane where I enter some values. Components are added directly in the Netbeans IDE, not created on run, instantiating components. What I’d like to achieve is: As the values are added,…
-
0
votes0
answers67
viewsUsing Proguard with Maven in libs in java swing
I obfuscated my jar using the proguard-Maven-plugin plugin, pom.xml and the configuration are these: <build> <plugins> <plugin> <groupId>com.github.wvengen</groupId>…
-
0
votes1
answer47
viewsDisplay in a Messagedialog the contents of List<String> message = new Arraylist<String>();
Good night, I need to display the contents of the message array in a Message Dialog: List<String> mensagem = new ArrayList<String>(); In the course of code I add some text to the array…
-
0
votes1
answer106
viewsHow popular is Jcombobox with an array of strings?
I have a class that inherits from JFrame and has a JComboBox comboBoxPorta = new JComboBox();. I would like to popular this combo with the serial ports. I have a function in another class to print…
-
0
votes1
answer69
viewsJpanel does not appear in Jdialog
I’m solving an activity with the following statement: Create an application to display eight Jpanel components in a Jdialog window. Each panel should be colored with one of the eight colors of Table…
-
0
votes1
answer97
viewsHow to remove the Header Columns border
I can’t seem to remove the white edge of the header of jTable public static JTable CMtable(String[] colunas, int width, int height) { TableColumn coluna; JTable tbl = new JTable();…
-
0
votes1
answer75
viewsShow item of an Arraylist in a Jtextfield
Good evening community, I have a problem in a Project I am working, I created a table in mysql with a few words, after that I made a Resultset of this table and saved the names of the words obtained…
-
0
votes1
answer45
viewsDynamic joptionpane in Java: combobox
Is it possible to make Joptionpane dynamic ? I’m having difficulty registering new entries in the countrys array[]. I’m using Java 1.8 sdk Code import javax.swing.JOptionPane; import…
-
0
votes0
answers21
viewsHow to expand the window by clicking a button?
I’m trying to expand the screen size using Java Swing. When I click a button I need to increase the height of the screen, consequently appearing two more buttons. I tried to do this in the method…