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
votes2
answers629
viewsDecrease space between two Jpanel in the netbeans prototyper
Good afternoon, everyone. I am using netbeans 7.4 to create a simple screen. It turns out that on this screen (frame0 by default), I added two panels (Jpanel). One to be the header and one to be the…
-
-1
votes1
answer1510
views -
-1
votes1
answer1014
viewsHow to call a Jframe from another Jframe with different classes
I’m creating a little game of rock paper and scissors and would like to know what I call a JFrame other’s JFrame, only from different classes. Or maybe I should do it in different methods? I tried…
-
-1
votes1
answer458
viewsDifference of dates with Legend in a Textfield
I am developing a hotel system and would like to automate some features in the system. I would like that when you select two dates being the dataEntrada and dataSaida using Calendar, make that when…
-
-1
votes3
answers1018
viewsCall another class (Java)
How do I call a "class" of type jFrame for example from my main class? My jFrame has its own main that gives the true setVisible for it to appear, but I wanted to access this main of it from my main…
-
-1
votes1
answer461
viewsHow to assign action to Image or Button
I am developing the home page of a simple game, what I wish is to add a button on the screen where when clicking the game start, follows below my code of how I am mounting the menu and bringing the…
-
-1
votes1
answer94
viewsError accessing Jtable line
In my system is giving error in the line of code ModelUsuario modelUsuario = new ModelUsuario(); ControllerUsuario controllerUsuario = new ControllerUsuario(); //recebe a linha selecionada int linha…
-
-1
votes1
answer279
viewsCopy a Jtextfield date to a Jdatechooser
Currently I mirror the JDateChooser for a JTextField, but now I need to mirror a JTextField for a JDateChooser. How to copy and convert a date from a text field to Jdatechooser? I use it this way to…
-
-1
votes1
answer173
viewsVector for Jtextfield
I have to add 43 text fields that the user will fill the ones that will be used to have a total and this total will be used in my formula and I could not find a solution to reduce these lines that I…
-
-1
votes1
answer110
viewsHow to add to Abstracttablemodel a combobox populated by database information?
I would like to know if it is possible to implement a combobox in a AbstractTableModel so that it receives information directly from the database for filling. if possible someone could give me an…
-
-1
votes1
answer118
viewsHelp with Java Pointer Error
I’m doing a Bank Queue project with priority, I did everything the way I learned, but this giving some null pointer error that I’m not able to understand, could someone please help me understand…
-
-1
votes1
answer94
viewsOrganize items within Jtexarea
How do I pick up items from a combobox and place in a jTextArea, one below the other? Follows my code: public class PW_XML extends javax.swing.JFrame { int Grade; int Frequencia; int AttackRN; int…
-
-1
votes1
answer53
viewsHow can I display a string provided with an arraylist in a combobox?
Good morning. I have a record of films, which are found in an arraylist. These films have a name, director etc. Since this array is public, I would like to display, in another interface, the name of…
-
-1
votes2
answers27
viewsI have a variable set by parameter. How do I use it on buttons (Action Performed)?
I received this variable (per parameter) from another Jframe: public App(int id) { System.out.println("teste: "+id); /* codigo aqui... */ } and wanted to use inside that 'action performed button':…
-
-1
votes1
answer53
viewsDynamicreports Dynamic Graphics Generation
Hi, I made some reports with the DynamicReports http://www.dynamicreports.org/, when searching about how to make graphs I found several examples, but none with the data (shown in the graph) being…
-
-1
votes1
answer41
viewsHow to view the latest record stored in the mysql database in a Java Swing interface?
I want to display in the java swing graphical interface the total number of users registered there in my database Look what I tried He of error null public void restt() { String sql = "select…
-
-1
votes2
answers878
viewshow to press the button using code, using the same effect as when the user presses
I’m making the game for java and when starting the machine will give a random sequence of clicks on 4 buttons and then the user has to press the same machine, but I do not know how to make the…
-
-1
votes1
answer279
viewsSimulate the operation of a processor using java swing
I need to simulate the workings of a processor using queue concepts. This processor will be color, where the user adds the color they want to be processed and its run time, this color needs to enter…
-
-1
votes1
answer265
viewsHow to run an application on multiple Threads?
I’m developing an interface application by Swing. The application aims to simulate a computer network in which I will monitor using the implementation InetAddress. Well, I created my interface,…
-
-1
votes1
answer157
viewsError setting model in Jtable
So people, I was developing a frame that received a table from the database, I used the same scope of the function several times and it worked perfectly, I just modified the necessary to generate…
-
-1
votes1
answer316
viewsHow to import a csv file to a Jtable?
Does anyone know how to move from a csv file to a jtable? Currently but lists everything in the first column. private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your…
-
-1
votes1
answer410
viewsHow to access another class member?
I have a JPanel which contains all graphic elements, input text fields etc. This is a different class, which needs to know all the attributes of the Jpanel. The problem is that you are not accessing…
-
-1
votes1
answer267
viewsJtable only accept float numbers in your cell
I’m using this code to accept only numbers in the jtable cell, but I’d like to know how to accept . too. Someone can help me? I’m using Java Language on the netbeans platform. TableColumn col =…
-
-1
votes1
answer547
viewsFormat measurement field with Jformattedtextfield
I’m trying to create a field to take measurements, I wanted to apply a mask so that it would look like this: The field already starts with 0.00, then if you type value it keeps formatting. And when…
-
-1
votes1
answer171
viewsError converting value to Jtable
I have an error when passing formatted value to the JTable, if anyone can help, I really appreciate. This error only happens when I format the number, I wonder how I do to fix it. Code: private void…
-
-1
votes1
answer85
viewsJtable search does not return as expected
I have a bug I don’t understand. The idea is simple, I should type a value in a field and it returns me in the table, this happens, but when I click on the value found in the search it selects me…
-
-1
votes1
answer455
viewsTo show database query result within a jtextarea
How do I display the data of a query in a database, within a Jtextarea? I did all my list method (which is in the Carrodao class), and I want it to show the data inside the textarea (which is in the…
-
-1
votes1
answer496
viewsAdd element in Jlist
This one-button action serves to add the path of a file into a JList: private void bArquivoActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser();…
-
-1
votes1
answer64
viewsDisplay a string in a text field that is locked for editing
I have developed a client-server chat and I am incrementing some functions to make it more presentable and complete. One thing I still don’t know how to do is display a string within a text field.…
-
-1
votes1
answer167
viewsI can’t put picture in a Jbutton
I tried to put the image but it’s just enough NullPointerException, I have tried creating a folder called img inside the briefcase src and point there however unsuccessfully too. I don’t know what I…
-
-1
votes1
answer660
viewsHow to close jframe from an actionPerformed?
I created a java login application, but I can’t close the screen during ActionPerformed of the button with the this.dispose(); What to do to make it work? Code: import java.awt.EventQueue; import…
-
-1
votes2
answers198
viewsJAVA - Swing-free timer with MVC
I’m studying java and I saw myself in a situation that I don’t know how to solve... I have a timer where I intend to do it following the rules of MVC, but I can’t update Jlabel when I separate the…
-
-1
votes1
answer40
viewserror: ")" expected } <
Guys, I’m trying to make a program that by clicking the confirm button, open another Jframe, but keeps giving the error error: ")" expected } ^ and error "teladelogin.java:48: error: class,…
-
-1
votes1
answer70
viewsReal Time File Search
I’m trying to make a program that provides real-time file search feature. As the user type the name of a directory in the text box, the program should search and display in the text area the names…
-
-1
votes1
answer94
viewsSwing - Include images in JAR file
I have a project in JAVA, which has a graphical interface with a screen, developed with the Swing. I have 2 images, background and favicon, which are in the package: [code]br with drsolutions…
-
-1
votes1
answer76
viewsHow to update Jtextarea in each loop iteration with Swingworker?
I have a class that inherits from SwingWorker and I’m getting information from a file .txt and playing for the JTextArea, and would like to go running update of JTextArea while the loop is running,…
-
-1
votes1
answer40
viewsfill arraylist with arraylist attribute information of another class
I have an Event class with an attribute arraylist<string>lista. I fill this attribute in a Telalista Jframe and use a evento.setLista("informaçao"); to add the textField string to the…
-
-1
votes0
answers24
viewsUpdate Mysql Java Problem | Error: Exception in thread "AWT-Eventqueue-0" java.lang.Nullpointerexception
Hello, I am Java developer, I am developing a program with mysql and java swing. And in my update code, is showing the following error: Exception in thread "AWT-Eventqueue-0"…
-
-1
votes0
answers26
viewsHow to resize swing and javafx "blocks" sizes in Intellij?
Hello, I’m learning Java and there are some classes that ask for swing and javafx, until then ok. But on the teacher’s screen, videos on Youtube that I saw, they add a button for example, and manage…
-
-2
votes1
answer74
viewsHow to trap a Jmenubar on top of the Jframe?
I forgot how to do this, I remember I have to put one BorderLayout(... NORTH);. How do I put a JMenuBar in a JFrame?
-
-2
votes1
answer2480
viewsCan you program in java by creating frame by VS code?
I’m learning java swing and wanted to know if there’s a way to do a Jframe and run vs code, because I want to start using just one ide for everything and netbeans takes too long to start, and how to…
-
-2
votes2
answers156
viewsjava.lang.nullException error
I am developing software for a video rental company with Pattern MVC (Model-view-controller) design with the Java Persistent Api Framework and the XML (Generic Markup Extensible Language). My…
-
-2
votes1
answer134
viewsBufferedimage does not appear on the screen
I’m learning Java and I needed to use Bufferedimage, but for some reason this doesn’t seem to work Error is that the drawing does not appear in the panel, I followed several tutorials but still not…
-
-2
votes1
answer110
viewsProblem with showing Bufferedimage in Java Jpanel
I’m learning Java and I needed to use Bufferedimage, but for some reason this doesn’t seem to work Error is that the drawing does not appear in the panel, I followed several tutorials but still not…
-
-3
votes2
answers522
viewsHow to query a bank from a thread?
A teacher asked to develop a project (a CRUD of cars). I’ve done the part of inserting, removing, listing and changing. But the listing part should be done by a thread (teacher requirement), in…
-
-4
votes1
answer291
viewsCalculate time average in Java
I would like to know how to calculate the time average through a table in java? What I want to do is that when the user searches a client, it will appear in the table only the information of the…
-
-4
votes1
answer697
viewsJava calculator
I have a creation lock here pfvr help me, I would like to put a "AC" to reset the result anyone can give me an idea? My code is like this: private JButton numero0; private JButton numero1; private…
-
-4
votes1
answer70
viewsAdd one more check, how to proceed?
I would like to know how to add 1 more check. I would like to have row 31 checked as well. Example: Object obj2 = modelo.getValueAt(linha, 31); In this code here. else if…
-
-4
votes1
answer187
viewsI need help with a method
I have a problem related to a game that I’m creating where the character drops a bomb in the position that he is in. In the first execution of the method bomba() execution goes as ordered. However,…