All Questions
Tagged with swing user-interface
6,477
questions
-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 =...
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);
...
-1
votes
0
answers
44
views
paintMethod not working as intended. Draw method will never call even when manually tried [duplicate]
I am just trying to get the paintComponent method from the LocateMap class to run. currently it never runs.
I am trying to draw a set number of images within a jpanel based on the dimensions given ...
0
votes
0
answers
27
views
Icon-only JButtons layering the icon of the most recently clicked JButton when clicked [duplicate]
I'm using java swing components to build up a goofy, very simple RPG java app, and I've run into this weird behavior where when I click on a JButton, it duplicates the icon of JButtons I've pressed ...
-1
votes
1
answer
48
views
How do I scale or set the the size of an ImageIcon in Java?
I can not find a way to set the size of an ImageIcon placed in a JLabel. I i.e. want to load image with size 32x32, but paint in size of 16x16 pixel (or 144 dpi).
I can no where find a way to set the ...
-1
votes
0
answers
40
views
Transparent JToolTip background outside frame in Linux
I'm working on a Java swing application (I'm using JDK 22) where I customize basically every GUI component.
The problem I'm facing is that I've made a custom tooltip UI class where I paint it as a ...
0
votes
1
answer
51
views
Remove top left drop down button when JInternalFrameMinimize
Problem image:
No problem image:
I am using JInternalFrame and to remove the dropdown list at the top left of the frame, since it serves no purpose, I use this code (the result is in the image):
...
0
votes
1
answer
62
views
Java/Swing: Can't get JScrollPane to show entire element
The goal is to draw a bunch of circles (each a separate JComponent instance) onto a JPanel, and to be able to scroll far enough in any direction to see all of them.
Here is the "main" code:
...
1
vote
1
answer
31
views
why Java swing UI doesnt print my diagram?
public class Main extends JFrame{
public static void main(String[] args) {
JFrame jp1 = new JFrame();
jp1.setTitle("Diagram");
Print m = new Print();
jp1....
0
votes
0
answers
29
views
JPanel within a JPanel will not resize using setSize()? No active layout managers being used either
What I am currently trying to make are 3 panels in a frame that is laid out via GridLayout(), and each of the 3 panels would have their own panels within them that would be containing text. The top-...
1
vote
1
answer
38
views
how to fill Jlables character by character in Java Swing?
I'm developing a Wordle game in Java using Swing. I have an on-screen keyboard and a text field (like in the screenshot), and I want to output the entered words from the text field into JLabels ...
1
vote
0
answers
42
views
How to set Bengla SutonnyMJ font in JTextArea in Java Swing?
"In my Java Swing project, I have a JTextArea which is jafAddress. In this JTextArea field, I set the font to SutonnyMJ Bangla font. However, when I write Bangla text into the JTextArea, Bangla ...
-2
votes
1
answer
64
views
EventListner not wokring in Swing
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
class ...
0
votes
1
answer
24
views
Java/Swing: How to combine both - fixed size and ability to scroll - for JScrollPane including JTextArea
So I have created a JTextArea (in my case TextArea - to override append and setText methods that include line breaks), to visualise end user what is going on at what time.
I have:
limited space
...
0
votes
0
answers
49
views
GUI window is not appearing
I'm trying to learn to use gui in java using eclipse ide.
When I run this code
import javax.swing.JOptionPane;
public class GUI {
public static void main(String[] args) {
String ...