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
answers19
viewsHow to change the font only of the selected text in the text area in Swing (Java)
I’m making a mini editor, but when I click on the bold button, for example, all text changes and I want you to change only the selected text. And more, how do I so that when you click on the button…
-
0
votes1
answer134
viewsHow to set a jcombobox in a Preparedstatement?
How do I make a jcombobox in this method? The Combobox would be the type the user is supposed to choose, I tried to make one but it didn’t work out very well. And this method is in my main class and…
-
0
votes1
answer1311
viewsEnable and disable Jbutton
I have two JButton in my window, btnCalcular and btnConfirmar. The btnCalcular calculates some window values, and the btnConfirmar take these values and store them elsewhere. The point is that…
-
0
votes1
answer654
views -
0
votes1
answer64
viewsHow to Return the statement of an attribute on a Jlabel?
I am beginner in programming, my question is the following: - I created an attribute public static final double Preco_Gasolina = 3.85, in an A class. - I want to return the value of Preco_Gasolina =…
-
0
votes1
answer108
viewsCapture exceptions in swingworker execution
I’m using SwingWorker to execute a method that can throw exceptions. Even forcing, the exception is not captured by Try-catch. How can I solve this case? try { (new SwingWorker < Void, Void >…
java swing exception swingworker event-dispatch-threadasked 8 years, 7 months ago Lucas Alcântara 411 -
0
votes1
answer221
viewsScrollbar in a Jtable
I added a JTable that updates the data as the customer type in a field JTextField. However, when the client search returns multiple lines, I would like the JTable had a scroll so that the customer…
-
0
votes1
answer46
viewsJpanel disappearing while getting a get on it
I am building a layered application using the Spring Framework, I am new and well be doing it the wrong way. My problem is this, as you can see in the image below I have the PrincipalFrame and the…
-
0
votes1
answer858
viewsAssign selected item to Jcombobox
I have a problem where my jComboBox values are not being returned but the values in the bank are correct. I have a vehicle registration jFrame, which when triggered the search button, calls the…
-
0
votes1
answer174
viewsNo query Executer Factory Registered for 'sql' language
In my project there are some reports and graphics, using DynamicReports which function properly in the IDE Netbeans without any mistake. But through the command line running the jar java -jar…
-
0
votes2
answers586
viewsMaskformatter leaving empty space
In my project, I have an age field, where I want to receive at most 3 number, so I did this : mskIdade = new MaskFormatter("###"); so far so good, but every time I type a number with less than 3…
-
0
votes1
answer435
viewsHow to minimize Main Frame when opening a new frame
I have a little problem, I created an application in java with a menu that calls several screens. When opening some screen, I wanted my application main screen to be minimized. I tried with…
-
0
votes2
answers130
viewsJformattedtextfield is accepting no characters
I have a window where we have a JFomattedTextField called txtQuantia, I applied a mask to him called mskQuantia, and set the valid characters, in this case, 0-9, but this field is not accepting any…
-
0
votes1
answer336
viewsStart all Checkboxes for a selected Jtree
I wonder how I could do to start the class already with all checkboxes checked, I found this class and used: package CustonComponents; import java.awt.BorderLayout; import java.awt.Component; import…
-
0
votes1
answer1321
viewsHow to identify the button that was clicked?
I have several buttons and I would like to compare the text of the button clicked with a variable of type String. That without using it: if (evento.getSource() == botaoXl) { // Fazer isto... } else…
-
0
votes0
answers613
viewsHow to fix accent problems in Strings in Jtextpane?
I have an application in Java, I made it in Netbeans. The problem is when there are strings with accents. When run by Netbeans, it shows everything perfect (the string with accents correctly), but…
-
0
votes1
answer929
viewsHow to superimpose a Jinternalframe?
The main screen of the system I’m developing opens with a JInternalFrame welcome automatically, and it contains some buttons for registration, calendar etc... However, when I click on one button to…
-
0
votes0
answers58
viewsDoubts of modularization of classes
I am developing an application for didactic purposes, end of semester college work, in this will do CRUD of the disciplines in a table in the bank already created, "DISCIPLINES", I thought about…
-
0
votes1
answer142
viewsHow to use a selection setBackground in custom Renderer?
I’m trying to use a render Cell, so when it shows monetary data, it does the formatting. However, when I apply the render in a particular column, the focus in that column does not have the…
-
0
votes1
answer38
viewsDoubt about getSource() instanceof
Instanceof is a binary operator that tests whether an object is the subtype of a certain type. Ex: Object fonte = e.getSource(); if (fonte instanceof JButton){ ... } If getSource() returned…
-
0
votes2
answers1509
viewsHow to add items in a dynamically Java combobox?
I have a project in netbeans that uses Java Swing for the interface. I have some data in MYSQL that I would like to show you as soon as the window is created. Anyway, how can I place items in a…
-
0
votes1
answer419
viewsCan I use Css within a Swing application?
It is possible to style a java application made in Swing, using css or javascript?
-
0
votes2
answers404
viewsEquivalent to C# Java Form.Showdialog()
I’m starting now in Java, has a feature that I use a lot in C# that is NomeDaTela.ShowDialog();. I wanted to know a similar code that does the same thing in Java.
-
0
votes1
answer614
viewsMark/Deselect a line in Jtable, changing its color
Good morning, everyone! I’m new to the forum, and I apologize if I opened this topic in the wrong place. Well I have a huge problem with an action that I’m trying to do in Java Swing with the Jtable…
-
0
votes1
answer197
viewsJava - Canvas flashes when redesigning the screen
I’m making a graphical application with the class Component, but every time I delete the canvas to draw a new frame, Canvas flashes! The clearBackground function: public void clearBackground() {…
-
0
votes1
answer175
viewsIllegalargumentexception: illegal value in JPA when recovering Jspinner value
I’m testing an event on a JTable of the kind tableMouseClicked(evt), only that I am having some errors when returning the values in the respective Jtextfield and in a Jspinner that I configured.…
-
0
votes0
answers204
views(JAXB) Recover XML file in the input fields of a Jswing form with Unmarshalling
I am new and I started to learn these XML days because of an implementation that should have in my application, I did some tests with Mashall and unmarshall in the main class first (see at the end)…
-
0
votes2
answers441
viewsWhat does this piece of code mean?
Recently I came across a stone in the shoe, I was going to comment on a code, but I realized I was filling sausage when commenting on it, because I do not know what is the actual use of the code…
-
0
votes0
answers33
viewsSwingworker does not enter the Propertychangelistener
I created a swingworker to display a Jdialog while the code stands still waiting for the user to put his finger in the fingerprint reader Everything worked right, I set as visible inside the…
-
0
votes0
answers152
viewsChart type
I would like to know, if there is any component or library that generates a "graph" similar to this one. I read the documentation from JFreeChart, and there are some kind of graphics, but nothing…
-
0
votes1
answer223
viewsTrigger two different events with Jbutton
I would like to know how to trigger different events using the same button. What I wanted is that, with the next click, he gave a jButton1.setText("Créditos"); and return to the…
-
0
votes1
answer657
viewsHow to check if a Jinternalframe is already open in Jdesktoppane?
How to check whether a JInternalFrame is already open in the JDesktopPane and, if so, put him in focus on others? I have tried several ways I found searching, but always opens a new frame, even if…
-
0
votes1
answer2198
views -
0
votes1
answer274
viewsJtextfield that accepts only two letters
How do I make it in a JTextField, I can just type two letters of the keyboard and not use any other letter, number or character? For example: in a field I just want it accepted either the letter T…
-
0
votes1
answer279
viewsHow to draw an image with Canvas?
I have this code and I want to draw an image: public void render(){ BufferStrategy bs = getBufferStrategy(); if(bs == null) { createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics();…
-
0
votes0
answers1549
viewsImplement action to save button
I’m new to programming and built the image GUI from an example of the college book, but the save button has no functionality. And I ask help to implement on the button save some code that saves the…
-
0
votes0
answers57
viewsHow to use Jprogressbar with audio readings in excel
I have a method that receives an Excel file, and a Jtable. This method reads the file and plays the data contained in it within jTable. import java.io.File; import java.io.FileInputStream; import…
-
0
votes1
answer238
viewsAdd a lower menu
I would like to do a lower menu in my java application, to put time and run time or even some part of configuration even. I already have one JMenuBar at the top. that’s my code. package tela; import…
-
0
votes1
answer67
views"Changing" from Jframe to Jintertalframe
I developed the first version of my entire project using Jframes, but in the upgrade I’m doing I decided to change all to one JInternalFrame. I looked through the internet and saw that it was…
-
0
votes0
answers266
viewsHelp with Exception in thread "AWT-Eventqueue-0" java.lang.Numberformatexception: For input string:
I am concluding a code in java but I came across the error above and I am not able to solve. When I check the checkbox the fields are formatted, when I uncheck I get the exception above. Can anyone…
-
0
votes1
answer140
viewsError to popular jtable with database
I have to make a client registration application in JAVA, I am using eclipse. The problem is in the method listarCli(), because when I comment on this method the error does not appear. The error is:…
-
0
votes1
answer169
viewsJava-Full screen in 16bit
How can I put a Jframe in full screen and change the screen resolution using: device.setDisplayMode(new DisplayMode(Width,Height,16,DisplayMode.REFRESH_RATE_UNKNOWN)); I must use a new library?…
-
0
votes1
answer577
viewsJava - Swing - Timeunit.Leep time counter
I’m using Swing in Netbeans, creating a simple math game (thought more feasible than a calculator) whose goal is to add up the random numbers of the buttons until it equals a number between 1 and…
-
0
votes1
answer1113
viewsSwap the contents of a panel in Jframe
In my app, I have a main screen with a menu. The contents of each menu screen should appear within a main screen panel, do not want to open a new screen for each thing. What I need then is to change…
-
0
votes1
answer1002
viewsCalling Jbuton from one Jframe to another
I’m a beginner in this area, and I’m having a little bit of a problem, so if you could help me.. I have two Frames one is main (P) and the other (B) I call through a button. On the main screen I…
-
0
votes1
answer252
viewsError while trying to place Jcheckbox in a Jtable column
I’m trying to add a column to a DefaultTableModel, but seems to be giving some problems. Follows code! JCheckBox jcheck; DefaultTableModel modelo = new DefaultTableModel(null, new String[]{"Data",…
-
0
votes0
answers73
viewsHow to create table with java swing?
I have a button, when I click on it I want a table with two columns, one will be a counter and the other an empty field. The number of rows will be according to a variable to be passed to the table.…
-
0
votes1
answer91
viewsHow to detect if the Jspinner value has been changed?
I want to carry out an action whenever the value of the JSpinner is changed. How do I do this?
-
0
votes1
answer372
viewsHow to start editing a Jframe by hand and continue the final adjustments by the Netbeans "dashboard"?
I was able to write the code or generate a new javaswing file + JFrame, but would like to do writing the code and continue editing with the "dashboard" without adding a "new file.…
-
0
votes1
answer45
viewsArrayindexoutofboundsexception when trying to fill a Jtable from a query
I am performing a query in the database to pass the information to a JTable. However, when performing a query, the following error appears: Exception in thread "AWT-EventQueue-0"…