Questions tagged [swing]
Swing is a user-interface toolkit in Java and is shipped with the standard Java SDK. It is contained within the package javax.swing.
swing
81,368
questions
0
votes
0
answers
16
views
How do I configure my WSL to make resizeable work for tkinter or swing?
I tried to make a window in both Java and Python, both Swing and TKinter have a method that blocks resizing but it doesn't work if I'm running in WSL. Is there any way to fix this?
I tried using ...
-1
votes
1
answer
25
views
Resize JPanel with animation
I want to make a panel that, when the mouse enters it, its height increases smoothly and when the mouse leaves it, its height decreases smoothly.
public class Main {
private static final int ...
-2
votes
0
answers
39
views
lines appears below the panel in java swing [closed]
I'm developing a snake and ladder game using Java Swing. I am trying to draw lines (representing snakes and ladders) under JPanel or JLabel components, but I'm encountering issues with setting the Z-...
-1
votes
0
answers
37
views
How to trigger ItemListener by JCheckBox setSelected(false)?
I found this answer which states that ItemListener#itemStateChanged is useful as it is invoked when pragmatically setting the JCheckBox by setSelected(true). However, this doesn't apply for the case ...
-1
votes
1
answer
34
views
How to set image size in JTextPane with HTML and CSS (Java, Swing)?
I want to insert an image (say - a formula compiled from LaTeX) into JTextPane, using HTML+CSS for text markup, manually setting it's size. I tried like here
import java.awt.Dimension;
import javax....
0
votes
1
answer
32
views
How can I make the tabs in the menu bar with rounded corners and margins in Java/Swing using FlatLaf Theme Editor?
I'm creating a Java application with Swing as the GUI. I'm using FlatLaf themes FlatLightLaf.
On the JMenuBar I want to create something like this:
VSCode Title Bar
But I end up with something like ...
-3
votes
0
answers
32
views
Java Swing application getting significantly increasingly slower with each object creation [closed]
So basically my application is a JPanel which I'm adding Jlabels to and the labels are moving around. After adding about 20 labels the app is unusably slow. The labels are set to move 60 times per ...
-1
votes
1
answer
36
views
How to use a TableCellRenderer to display an object in a table in Swing
I'm making a todolist app and I'm displaying all the tasks on a JTable(which only has one row), I also added a RowFilter to the JTable inorder to sort the tasks based on different categories. I ...
-1
votes
0
answers
31
views
Adding margin to the panel inside a JScrollPane
I have a panel with a BoxLayout layout and I want this panel to have a scrollbar, so I made a JScrollPane. But when I use JScrollPane, the emptyBorder that I add is not added to my panel
JPanel panel =...
-1
votes
0
answers
24
views
What is the purpose of `labelFor` in a view xml in Java Swing [duplicate]
So I am using the Swing UI designer for the first time and while editing JLabel for my JTextField I came by labelFor field.
After clicking the arrow on the side it indeed displayed my currently ...
-1
votes
0
answers
31
views
Java Swing: How to show icon in scrollable panel [duplicate]
I am new to Java and Swing. I want to use jlatexmath library to render latex formula. But sometimes the formula is very long and the equation goes out of the JLabel (i.e., displayArea).
JLabel ...
-1
votes
1
answer
89
views
"Flowing" JToolBar
Here's my goal: to make a toolbar with buttons that "flow" down once the window is shrunk far enough. It should not be shy about nudging the sibling below if necessary
How do I do it?
Here's ...
0
votes
0
answers
46
views
How to open a new frame when I clicked a button? Is my code a “bad” code? Java GUI Swing
I’m making a frame with numerous buttons inside.
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("Change Name")){
changeNameGUI.setVisible(true);
...
2
votes
0
answers
89
views
Black background of copied and pasted image Java Swing
I try to copy a molecule image in ChemDraw (it is like Incscape to draw molecules) and paste it to my Swing GUI. I use something like that.
import java.awt.*;
import java.awt.datatransfer.*;
import ...
-2
votes
1
answer
41
views
Why doesn't this code swap images, as intended, when I press any key?
My program is intended to display 2 panels initially with different images from file Z_pic1.png and Z_pic2.png.WHEN ANY KEY IS PRESSED the displays on the panels should interchange swap. It is not ...