저는 Swing GUI에 MigLayout 라이브러리를 사용하고 있습니다.MigLayout에서 깊이를 지정할 수 있습니까?
그래서 같이 두 JPanel의 오버레이 싶습니다 :
+----+-----------------------+
| 1 | 2 |
| | |
+----+ |
| |
| |
| |
| |
+----------------------------+
을 많은 비디오 게임에 minimap처럼. 내가 WIDTH
및 HEIGHT
를 지정해야하기 때문에 그러나, 빈약,
의 JLayeredPane
JPanel main = new JPanel();
main.setBounds(0, 0, WIDTH, HEIGHT);
// ... fill it with Swing components ...
JPanel minimap = new JPanel();
minimap.setBounds(10, 10, 100, 100);
/// ... fill it with Swing components ...
JLayeredPane layer = new JLayeredPane();
layer.add(main, new Integer(0));
layer.add(minimap, new Integer(1));
이 방식 :
이것을 달성하는 방법은 두 가지가 있습니다 날 것으로 보인다. 창 크기가 조정되면이 값을 다시 계산해야하는 것처럼 보입니다.
의 JLayeredPane & MigLayout
JPanel main = new JPanel();
// ... fill it with Swing components ...
JPanel minimap = new JPanel();
/// ... fill it with Swing components ...
JLayeredPane layer = new JLayeredPane();
layer.setLayoutManager(new MigLayout());
CC positioning;
positioning = // ??? something specified in percents and z-order?
layer.add(main, positioning, new Integer(0));
positioning = // ??? something specified in percents and z-order?
layer.add(minimap, positioning, new Integer(1));
는 픽셀 해상도 WIDTH
및 HEIGHT
의 반대 나 (퍼센트 값을 지정시키는 동안 MigLayout을 사용하여 오버레이를 허용 뭔가 위치 코드를 입력 할 수 있나요 첫 번째 예)?
EDIT :
positioning = new CC().width("100%").height("100%");
// ...
positioning = new CC().pos("10", "10");
그러나 때로는 디스플레이 및 지터가 보이지 : 여기
는 부분적 작동하는 솔루션이다. 나는 이것이 불명확 한 렌더링 순서와 관련이 있다고 믿는다. (그것은 직감 일 뿐이지 만).
이 경우이지만, 그것은 어떤 영향을 미칠 것 같지 않습니다. – sdasdadas