Questions tagged [jlayeredpane]

JLayeredPane is a Java Swing component that adds depth to a JFC/Swing container, allowing components to overlap each other when needed.

JLayeredPane is a Java Swing component that adds depth to a JFC/Swing container, allowing components to overlap each other when needed.
See How to Use a Layered Pane for more information.

272 questions
4
votes
2 answers

Multiple JPanels completely on top of each other

I am creating an program in which I can draw a map and add different roads etc to it. I have planned to add the map terrain on one jpanel, and the roads etc on another, on top of each other. But I can't get them to work. I don't know how to add…
user2632928
  • 41
  • 1
  • 2
4
votes
2 answers

JInternalFrames to listen to JDesktopPane events

Is there any easy way to have my jinternalframes be the best of both worlds embedded when I want them to act as part of jdesktoppane also movable and able to handle their own events Hopefully this picture will help out. Right now I have my code…
4
votes
1 answer

How to make the Panels on JLayeredPane transparent?

I have a JLayeredPane with 4 layers added to it. 1 base layer, which is opaque and three 'transparent' layers (setOpaque(false)). The problem is that although the panels are drawn onto, with every refresh a gray color is shown. The same thing…
chibi03
  • 121
  • 1
  • 9
4
votes
1 answer

Resize layer of JLayeredPane

I'm having a problem while trying to make my own chess game using JLayeredPane. I got this far: (Hopefully you can see block G6 has a green border on the label showing which block was selected) But when I add my 2 SidePanels to my ChessBoard panel…
David Kroukamp
  • 36,155
  • 13
  • 81
  • 138
3
votes
1 answer

Implement Drag and Drop in Java game

I am working on a board game which is a 8x8 grid with 5 images of different colors. The objects can swap as long as they are next to each other in a row or column. If the switch results in 3 or more objects being the same in a row or column, they…
newjav
  • 31
  • 2
3
votes
1 answer

When using MigLayout, how would a 3rd int parameter to `add` affect layout?

For example: layeredPane.setLayout(new MigLayout()); layeredPane.add(component, "pos 50 50, width 100, height 100", 0); The 0 in this case does affect the component's layering, but I can't seem to figure out exactly how. I would like to overlay…
rtheunissen
  • 7,347
  • 5
  • 34
  • 65
3
votes
1 answer

JScrollPane inside JLayeredPane no repaint?

This could be something very simple but I'm totally confused. I have a JScrollPane inside a JLayeredPane when I scroll in the pane the things above in the JLayeredPanedoesn’t get repainted at all. Here I got a small example notice how the blue…
larlin
  • 188
  • 1
  • 10
3
votes
1 answer

JMenuItems painting over higher components in JLayeredPane

I have a set of JMenuItems in a JPanel on one layer of a JLayeredPane, and an emulated cursor painted in a JPanel on a higher layer. When the menu items repaint, they paint over the emulated cursor (without triggering a repaint of the cursor…
Aaron Novstrup
  • 20,967
  • 7
  • 70
  • 108
3
votes
1 answer

How to set a background color on a JLayeredPane?

I'm curious why calling setBackground(Color) on a JLayeredPane doesn't seem to actually set a background color. I would guess it has something to do with the JLayeredPane having to have a transparent background for some reason? Anyways, here is some…
Hamy
  • 20,662
  • 15
  • 74
  • 102
3
votes
2 answers

Drag and Drop from JTable to JLayeredPane

How to create Drag and drop between JTable and JLayeredPane. Does anyone have any ideas how to implement this? I need transfer object by Drag and drop between JTable and JLayeredPane.
3
votes
1 answer

Java LayeredPane LayoutManager add() Method Conflict

Suppose I have a JLayeredPane called mainPanel that is using a BorderLayout. I also have a JLabel called backgroundLabel that contains an image. How would I go about adding the backgroundLabel to the bottom layer of…
user5458478
3
votes
1 answer

Why does a JButton under a JPanel still react?

I looked around for my problem, and i couldn't find an answer, so here I go: I have a JLayeredPane, and in there there are 2 JPanels. The deepest one ( furthest down ) has JButtons on there. The second one ( The one on top ) has a partially…
3
votes
4 answers

Unable to set mouse cursor JLayeredPane

I'm running into a problem that I can't seem to figure out nor find the answer anywhere on the web. I've got a JLayeredPane and when it only has one child Panel I am able to correctly set the cursor using setCursor(). The cursor shows up and…
bradforj287
  • 1,018
  • 2
  • 14
  • 23
3
votes
1 answer

Layered JLabels not working

When I attempt to layer JLabels, the end result has them appearing next to each other, with the gif overlapping the logo image even though I told it to be on the bottom layer. import java.awt.*; import java.awt.event.ActionEvent; import…
3
votes
1 answer

JLayeredPane not adding a view on top

Trying to create a translucent paint view over my application. So far, I have a few objects at play. paintView //a wrapper class of a JPane. gScrollPane // the area I'm trying to cover layeredPane // the layered pane Here's my code so…
Sam Jarman
  • 7,277
  • 15
  • 55
  • 100
1
2
3
18 19