Window resize event?

I'm writing a simple painting program using java, and I want some method to be called whenever the JFrame component is resized. But I can't find any method like windowResizedListener or an event...

Value Change Listener to JTextField

I want the message box to appear immediately after the user changes the value in the textfield. Currently, I need to hit the enter key to get the message box to pop out. Is there anything wrong...

Deleting all the rows in a JTable

I need to remove all the rows in my JTable. I have tried both of the following: /** * Removes all the rows in the table */ public void clearTable() { DefaultTableModel dm =...

How to generate exceptions from RepaintManager

In connection with my question (may be), I found another exception type that I not able to catch and print-out from SwingWorker thread. How can I to generate RepaintManager exceptions? I read this...

Java Swing JtextField inset

I am working with Netbeans GUI and I would like to add 3 pixels of space at the beginning of my jTextField : I have tryied with setMargin, setInset in the GUI but it doesn't change anything. I...

Java mouse events ignored when mouse is moving?

I've been working on a 2d game in java recently, and am currently trying to get the event-handling system working right. I was trying to get a mouse click to start an animation, and it worked...

How to show URLs as clickable in JEditorpane and allow them to opened in default browser?

I have Java Desktop application that displays some information in a JTable that contains URL + text in the each cell. As I am facing difficulties to show and open URL in cell so I am planning to...

Application Window in Eclipse with WindowBuilder

I am relatively new in Java programming, I have been using Eclipse with WindowBuilder but I don't get what is the difference between using a JFrame or Application Window in Swing Designer. Can...

How do you make menu item (JMenuItem) shortcut?

So i noticed that in awt there is a MenuItem constructor for adding a CTRL + (some key) shortcut, but there is no such constructor for JMenuItem. What is the correct way to do this? I need an...

Hide a column in JTable

Possible Duplicate: How to make a columns in JTable Invisible for Swing Java How to hide a particlar column in DefaultTableModel from displaying it in table? I am trying to enter data to three...

Text wrap in JOptionPane?

I'm using following code to display error message in my swing application try { ... } catch (Exception exp) { JOptionPane.showMessageDialog(this, exp.getMessage(), "Error",...

Java Swing: Add tabs into JPanels

I have a series of tabs, but I want to then add further tabs within the panel it displays, as if to replicate a ribbon menu. I roughly know what needs to be done (changing the return type of the...

ColorPane - grab strings of different character possible?

I'm currently working on a old project that was given to me, it currently use java swing and has a basic gui. It has a ColorPane that extends Jtextpane to change colors of selected text. It uses...

Putting XML elements in JTable

I am trying to parse an XML file with sax parser in Java and then fill a JTable with the XML elements. The parsing is well done, the JTable is created, but the problem is that all the elements are...

Getting JTextArea to display fixed-width font without antialiasing

Does anybody know how to get JTextArea to display a fixed size font on all platforms? I want to make a simple code editor with save/open functionality, which is simple enough, but I would like to...

JDateChooser inside JTable cell enter key does not always work

I'm using slightly modified JDateChooserCellEditor class which allows me to put jDateChooser inside my jTable cell. Here is the code of class: public class JDateChooserCellEditor extends...

Gradient background in a JFrame

I have googled this and read a lot but did not find an answer that suits my needs, so I'll ask here: I would like to have a gradient background in my JFrame. Currently the background is a single...

How to set the Radio Button based on the value fetched from the database

I have a JTable filled with data about students (student id, name...), and when I select a row from a table, the form opens and its field need to be filled with same values (eg. if Johny Bravo was...

Error while trying to send mail from swing GUI in Jython

I've made a basic GUI with a send button that calls the function sendmail which works fine when called outside the GUI. But when the button is clicked, I get the following error : janv. 13, 2016...

Android Studio gradle can't import groovy.swing.SwingBuilder

I'm using this technique to make release builds ask for keystore passwords, but lately the Android Studio editor for build.gradle complains: Cannot resolve symbol 'groovy' for the line: import...

How do you keep track of a board game positions live? (Java)

I am creating a board game in java using a 2d array. The board is shown in a JFrame. How do you "move" pieces on the 2d array and display them live on the screen (the 2d array is shown with...

Connect two circles with a line

I'm drawing two shapes (circles) in a JPanel and I need to connect them with a line. I was doing this by just getting the middle point of the circle and connecting each other, easy. The problem is...

Zoom in on JLabel icon with netbeans GUI builder JSlider

I have a JPanel which in turn has a JLabel with an icon. I'm using this JLabel as a background image. I want to be able to zoom in this image with the help of JSlider while using the netbeans GUI...

JTextPane and undo manager style change

My situation: I have a JTextPane with its own syntax highlighting. I have it set so that when the user stops typing, it updates the style in the text using the setCharacterAttributes() method. My...

Resizing Icon in Button as big as Buttons size (+ using LayoutManager) and make Font as big as the Buttons size

Currently I am trying to add an icon which should be as big as the button (added to GridBagLayout). I want to scale the icon to the size of the button, but my button shows its size as 0. I tried...

Package javafx.embed.swing missing from JavaFX 12?

I upgraded from Java 10 to Java 12 and JavaFX 12. Now I can't compile my project anymore because javafx.embed.swingSwingFXUtils is no longer recognized. Intellij can't find any library for the...

Problem with webEngine JavaFX using with swing

I'm trying to load browser using JavaFX WebEnginge to swing as below SwingUtilities.invokeLater(() -> InitGUI()); final JFXPanel jfxPanel = new...

Design Tab is Blank in Eclipse IDE

I recently bought Macbook with an M1 processor for programming. I have installed Eclipse IDE for JAVA Programming. After Installing Window BUilder and the required Softwares from Eclipse Market...

WindowBuilder Design Tab incomplete in Eclipse

I was creating a JFrame for a project and while trying to edit it, the design tab was blank. I've created a test project with everything on default and this "error" still there. Here's the code...

How to save from JTable to CSV or Excel

Is there a way to save JTable data to excel? I would like to save the data that I input from the program, from the JTable and then to a CSV file. I would like to have it so that there is a button...