All Questions
185
questions
1
vote
1
answer
608
views
How to use Flow Layout inside a Panel in Java?
Here is the code with problem:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
public ...
-1
votes
2
answers
56
views
Space Invaders generate initial Asteroids Java Failure
I have written a Space Invaders-like game, which has a rocketShip and some Asteroid objects falling, and the objective of the game is to survive and shoot as many Asteroids as possible.
I am having ...
0
votes
1
answer
49
views
Why does this program only display the last graphic?
Im using JPanel and JFrame to create a program that can draw lines and circles. The problem is that my program only redraws the last object added.
I have tried moving around the repaint. For some ...
-1
votes
1
answer
63
views
Java swing scrollpane doesn't show the scroll bar
I was working on a java swing gui project for my course. When I was doing that, I found that I had too much information in a panel and it was not able to show everything. As a result, I wanted to add ...
0
votes
1
answer
47
views
Java Swing: Why are my panels layered? I can't see my first panel
I'm trying to have one panel appear under the other (textPanel to appear under mainPanel).
But instead, textPanel is appearing overtop of mainPanel:
FlatLightLaf.setup();
FlatLightLaf....
1
vote
1
answer
265
views
How top-align side-by-side panels, Java swing
I want my dissimilar-height panels to be top-aligned within their containing panel.
I've tried BorderLayout with NORTH, I've tried panel.setAlignmentY(TOP_ALIGNMENT). No luck with any approach so far.
...
0
votes
0
answers
84
views
Loading images via JFileChooser
3 Classes - GUI, ImageLoader and Wizard
GUI is the main frame whereas Wizard is just a popup that changes settings and imageloader is image handler
What I want is to load image from wizard to Jlabel ...
0
votes
2
answers
841
views
Got on <<error javax.imageio.IIOException: Can't read input file!>> when I tried to add an image on the background of my JPanel
I am currently learning java and I have problem and can't find anything about it. I got an "javax.imageio.IIOException: Can't read input file!"
I don't understand what I did wrong :
this is ...
0
votes
1
answer
63
views
Java Panel ignores setSize
I have the same problem described here but none of the answer worked out for me.
I have a Panel with a BoxLayout with Axis = Y Axes, because I would like to stack elements one below the other, but I ...
0
votes
1
answer
66
views
How to change selected index in JComboBox when refreshing panel?
I am making a simple sudoku and when I want to start a new game, I reload the panel. I first remove it and then add it to the frame. The problem is that I can choose the difficulty for new game, but ...
0
votes
1
answer
85
views
Zoom on drawline
I have an image and on this I drew some lines. When I use zoom on this panel, only the image changes its size (if i get to the large dimension of image, in my case with width = 5550 and height = 7800 ...
0
votes
0
answers
46
views
Open a panel based on a string
A have a borderlayout panel. On the left side, I have a Jtree, where every node has his string name and the string name of a panel.
like this ...
DefaultMutableTreeNode root = new ...
-1
votes
1
answer
286
views
My panel won't scroll and my scrollpane does not have a slider
I have tried all these but my scrollpane won't scroll and it does not have a slider in it, the scroll bar displays but it has no slider in it, i have set autoscrolls and focus traveral policy but ...
0
votes
1
answer
94
views
Eclipse project wont run
I'm new to eclipse and java, I'm trying to switch between two panels with the use of a button. i want to test my project but when i try to run it it launches, gives no errors and then nothing happens.
...
0
votes
2
answers
2k
views
How to: get input from JTextField after button is pressed
I am fairly new to Java and just wanted to ask about ActionListener method.
I've created a GUI and in one panel I want to ask the user to input values of x and press submit. It looks like this:
f(x)= [...