Skip to main content

All Questions

Tagged with
1 vote
2 answers
53 views

Java Swing drawing gif as background to several JButtons and JLabels

I want to draw a gif as background to the starting window of my java project (small game in Java swing for school). Here's my code so far: package graphic; import javax.swing.*; import java.awt.*; ...
shōgun's user avatar
  • 13
-1 votes
1 answer
89 views

How can I make a background image in Java Swing responsive when resizing the frame?

I tried a simple program to add an image on the background of a frame using java swing. But whenever I resize the frame the background image size remains the same. That means If I shorten my frame, ...
S. S. Mahmud Turza's user avatar
-1 votes
1 answer
35 views

JLabel.setBackground(Color.RED); Is Not Working

As you can see from the title, I can't set a background color of a JLabel. Can someone please help? package pl.maciekfruba; import javax.swing.*; import java.awt.*; public class Main { public ...
Inferno's user avatar
1 vote
1 answer
58 views

How to load a background image without hiding components on top in Swing

I have a JPanel that holds a few JLabel that display some informations. And i use another JLabel to hold a background image that I'm going to get from a URL. I have used GirdBagLayout to set this up ...
Rachid Rajjys's user avatar
0 votes
0 answers
348 views

How to add a background image in JPanel?

I did exactly according to the excellent guide but it does not work, I want to click a button that will change the background of the program. I would love to make the picture change Code Guide https://...
derey yovel's user avatar
0 votes
1 answer
62 views

setting the background of swing project to a gif java

So for my project I just wanted the backgound to have a gif play to make it look nicer, but every solution I found wouldnt work. A solution where I make the gif on a JLabel then add everything onto ...
JMangoS's user avatar
  • 11
0 votes
0 answers
167 views

How can I reset the value of the background in a jPanel to the original in Java?

I'm making a dark mode in netbeans using a toggle button, but when i try to reset the background to the original color changing the color to (240,240,240) it's different than the original one. (240,...
Angel 's user avatar
  • 35
3 votes
1 answer
181 views

Why is java background process slow?

Please have in mind i'm new to java and had only used C# for desktop applications. I just made a brand new project and want to load content as the window open, I have a JFrame with a JPanel(swing), i'...
Ezequiel's user avatar
0 votes
1 answer
2k views

Customize theme color in Flatlaf Look and Feel

I'm using the Flatlaf Look and Feel for my GUI in Java swing. There's a pre-made theme in Flatlaf which I imported, but I'd like to change one of the colors in the color scheme slightly. It's the ...
Skarpo Spells's user avatar
0 votes
0 answers
204 views

How to add a background Image on JPanel without extending?

I want to add a background image on the panel. Most of the answers here says that you should use JLabel or extend a JPanel to use the paintComponent. However in my project I used IntelliJ IDEA, with ...
benjmerales's user avatar
0 votes
1 answer
130 views

Set background in a JFrame

I waned to put a background in a JFrame, so I searched on YouTube and found a Video, but it didn't work I tried another one and this didn't work either so what is wrong with my code because all the ...
Nils Schmidt's user avatar
0 votes
0 answers
44 views

When the background of jpanel is set, its components won't get shown

I've tried to set a background image to my JPanel, that holds some other components like Jlabel,JCheckBox,JTextField.I did add the background by creating another class and extending JPanel, and so ...
Navid Nasro's user avatar
0 votes
1 answer
212 views

How to put an image over background?

I need to do a jet fighter game for my school project and I couldn't get how to put a plane image over a gif background. Here is what I try to do: photo of what I am trying to do: And here is the ...
Oğulcan's user avatar
1 vote
1 answer
37 views

Unexpected change in background of header of custome jcombobox in swing

I try to make a custom jcombobox for my menu sidebar my jcombobox has JButton as items because I found it easy to insert and align icon and text. But my problem is when I choose a item in dropdown, ...
tham nguyen's user avatar
1 vote
1 answer
41 views

Why won't the background of my JFrame become black?

I'm working on a school project and I'm having trouble changing the background colour. For some reason it keeps showing up as the default grey colour instead of black. import javax.swing.*; import ...
Kiyo 's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
18