Skip to main content

All Questions

Tagged with
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 ...
Aman's user avatar
  • 350
-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 ...
kiwY12's user avatar
  • 9
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 ...
Cole's user avatar
  • 1
-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 ...
scaresneeze's user avatar
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....
Ran Shorowitz's user avatar
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. ...
shrimpwidget's user avatar
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 ...
Zyaan's user avatar
  • 109
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 ...
Jessica Robin's user avatar
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 ...
Alberto's user avatar
  • 12.7k
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 ...
Escape's user avatar
  • 41
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 ...
AndreeaA's user avatar
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 ...
Victor Padro's user avatar
-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 ...
Henrychuks's user avatar
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. ...
A Stephens's user avatar
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)= [...
guilt's user avatar
  • 59

15 30 50 per page
1
2 3 4 5
13