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
11
votes
2 answers

adding JLayeredPane to JPanel

I am trying to add a JLayeredPane to a JPanel and then add an image (JLabel icon) and a button to the JLayeredPane, but neither show up. I've tested the image without the button and the layeredpane so I know that works. Here is some of the code I…
asawilliams
  • 2,908
  • 2
  • 30
  • 54
6
votes
1 answer

JLayeredPane and painting

I am writing an application which has a JLayeredPane (call it layers) containing two JPanels in different layers. I override the paintComponent method of the JPanel at the bottom (call it grid_panel) so it paints a grid, and the the paintComponent…
stackoverflower
  • 3,885
  • 10
  • 47
  • 71
6
votes
2 answers

Graphics not showing in JLayeredPane (java swing)

I'm trying to gradually build up an image based on user inputs. What I'm trying to do is create a bunch of graphics and add them as layers however I'm having some issues as they won't show up. Here is the code I'm using: public class ClassA { …
user843337
6
votes
1 answer

Drawing in JLayeredPane over exising JPanels

I am working on developing a Chess game. I want to have the board Container utilize a GridLayout to display an 8x8 grid of JPanels. (This will make functions such as highlighting selected squares and valid moves much easier.) I would then like to…
Nick
  • 101
  • 1
  • 6
6
votes
2 answers

JLayeredPane with a LayoutManager

The situation: drawing a stack of playing cards, like in the Solitaire game. Nicely stacked. To achieve this, I'm using a JLayeredPane in combination with a custom implementation of the LayoutManager interface. The reason for using a custom…
Timmos
  • 3,215
  • 2
  • 32
  • 40
5
votes
2 answers

Placing JToggleButton with JPanel within into a JTable cell

I need to have a JToggleButton (that has custom background) that contains a JPanel with several JLabels within itself. That part works. This button is placed afterwards in a JTable cell and is meant to be pressed by users. The problem is that i can…
d56
  • 825
  • 1
  • 9
  • 26
5
votes
1 answer

JTable inside JLayeredPane inside JScrollPane - how do you get it to work?

I want to put objects coming out of a JTable, layered on top of it, so using a JLayeredPane seems natural. However, getting this to paint properly, do the headers properly etc is very hard. How do I do this so that: The Row headers appear and match…
Nick Fortescue
  • 43,045
  • 26
  • 106
  • 134
5
votes
6 answers

Making JButtons overlap

I'm creating a virtual piano type program in Java Swing. My area for the piano keys right now is a JPanel with a horizontal BoxLayout containing white JButtons as white keys. I want to add black keys as well, and have them overlap the white…
aharlow
  • 267
  • 1
  • 4
  • 9
4
votes
3 answers

How can I place a component in a JLayeredPane right below an existing component?

I have a JTextField, and right below it I want to show a JLabel placed in a JLayeredPane (I will use it for autosuggestions later on). How can I place my JLabel in JLayeredPane right below the JTextField? Here is some code I have, and the current…
Jonas
  • 121,568
  • 97
  • 310
  • 388
4
votes
2 answers

Using GridBagLayout in a JLayeredPane

I am attempting to have a small floating "widget" of sorts in the top right of a JPanel. It's a fixed-size component - think of the compass in a google maps sort of view, if that helps. I realize that JLayeredPane only uses one layout manager for…
Goren
  • 129
  • 1
  • 3
  • 9
4
votes
0 answers

How do I go about implementing a tray that appears on controls?

I have a screen like so: +--------+---------------------+ |___A____| | |________| JComponent I am | |________| drawing on | |________| __ __ | |________| | | | |________| …
davidahines
  • 3,976
  • 16
  • 53
  • 87
4
votes
1 answer

JLayeredPane: what's the functional difference between depth and position?

I am working on a Connect Four game for a school Java project. I've got the 'how' of the JLayeredPane, and it is working as expected, but I'm not quite getting the 'why' behind a certain concept. Here is my understanding: JLayeredPane is a…
4
votes
1 answer

JLabel and JLayeredPane - How to display an image over another image?

I try to create a little game in java but I'm in trouble. When I draw a map, I'm not able to display the characters without overwrite the titlesets of the squares. My goal is to be able to display many pictures on the same square (like the titleset…
tirz
  • 2,041
  • 1
  • 22
  • 37
4
votes
1 answer

Use case of Glass Pane vs. Layered Pane

I've always been a little fuzzy on the difference between the glass pane and a layered pane. Is the glass pane essentially just "the very top layer of the root pane," or does it behave differently? When would you use a layered pane instead of the…
Amanda S
  • 3,266
  • 4
  • 33
  • 45
4
votes
2 answers

Java Swing JLayeredPane not showing up

I seem to be having some major issues with JLayeredPane. I have a BorderLayout() pane, and I'd like for the West-side element to contain a few JLayeredPane's on top of each other, so I can switch between them to show the right information. The west…
jdepypere
  • 3,453
  • 6
  • 54
  • 84
1
2 3
18 19