Category "swing"

How to fix scaling of a java-based application on a high dpi display in linux?

I just switched to java 11 (AdaptOpenJDK) so that my java Swing application looks ok on high dpi displays at different system scaling settings. It works ok on

How do I use the same variable between buttons?

I've created a rock paper scissors game in java, but I don't know how I could use the same variable to work between 3 different buttons (rock, paper scissors).

Issue on label and panel's transparency

Here there is my frame: As you can see, there are some components (JLabel, JPanel, JTable, JScrollPane) on which I called the metod setBackgroundColor(new Colo

Make JTable cells in specific column scrollable

I'm creating GUI in java using swing. I use JTable that looks like this. I need to make cells of last column("Popis") to be scrollable as there will be descript

Why does my for loop to disable buttons not work, but the same loop works for setting colors in JFrame?

I am programming a TicTacToe game and I want to use a for loop with my JButton components inside them like this: private void clearField(){ for (int i = 0;

JInternalFrame Issue

I could not use JInternalFrameForm in Netbeans. I did right click on my package and go new but I did not see JInternalFrameForm option.

Converting from Swing to JavaFX? (Migration Guide)

When converting a Swing project to a JavaFx project, which classes from JavaFx match up to the Swing classes? A 1-1 matchup is best. I am not looking for inte

Debugging java swing application in eclipse

I have a large application made in java swing. Its a children drawing app. I need to put some restrictions, for example, if they draw a rectangle, then they can

Adding Material effects to java swing

I am trying to make a Java Swing application using NetBeans 8, and I was wondering if there is any possible way I could apply materialize effects to my Java Swi

Java Swing - Maskformatter digits from Right to Left

I would like to enter in a JFormattedTextfield with a Maskformatter digits for inserting time units (min:sec with mask ##:##) from Right to the Left. I used Set

How to update chart after selecting item from JComboBox?

I'm trying to change the values of bar chart depending on the selected item from the combobox list. The code below is a short example. The method for creating/u

How to get the whole row of a JTable to save it into another table?

I am trying to validate that when the column step is equal to 2 the row is copied to another JTable. But the jtable_step2 I have not initialized correctly, that

Do I need synchronization if I reference objects from other thread to AWT thread?

Does SwingUtilities.invokeLater provides synchronization? Example: public class Threads { public static void main(String[] args) { new Thread(new Ru

The best layout for this image?

I don't know which is the best layout to use for this image, I think maybe grid layout (5*1) may be helpful but I can't add multiple components in one grid layo

Fixing WindowBuilder UI

The bug is hard to explain so I will add images to show my problem. As you can see in the provided picture the interface is completely empty. Does anyone know h

Open JFrame from JDialog and it shows on top of JDialog

This is the scenario, My JFrame has a button it will open a JDialog when click it and it is a model dialog. JDialog has another button and i want to open anoth

JOptionPane with switch cases

Well, this code actually run but ended up with wrong output (specifically in "Randoms" cases) Note: it has a random generator for a random result or output I

How to add an ImageIcon in java? this code is not working

I want to add an ImageIcon to the Panel, but I got this Exception ( java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "locat

Adding a JScrollPane to a JMenu

I have a JMenu which will include JMenuItems that are generated on start-up from a database. As such, it's quite likely that the menu will be too large and run

Reading from a .txt file into a JFrame

I'm stuck trying to figure out how to read from a Java file into a JFrame. I need to make a frame and read in the names of cars and how much they cost. From the