gpt4 book ai didi

java - JPanel 中新的不可见层

转载 作者:行者123 更新时间:2023-12-01 14:45:46 26 4
gpt4 key购买 nike

我想寻求帮助。我想要这样的东西:http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html#glasspane

enter image description here

我有这个带有 map 的应用程序,我想在新的不可见图层中有一张小图片。小图片可以通过JSliders上下移动。该层应该仅位于“标签”上方。有这样的代码:

 private JPanel mujPanel5() {
JSlider [] posuvniky = new JSlider[2];
posuvniky[0] = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 30);
posuvniky[1] = new JSlider(SwingConstants.VERTICAL, 0, 100, 60);
for (int i = 0; i < posuvniky.length; i++) {
posuvniky[i].addChangeListener(new ZmenaPosuvniku5()); //Listener do nothing
}

URL umisteniMapy = this.getClass().getResource("map.jpg");
Icon obrazek = new ImageIcon(umisteniMapy);
JLabel label = new JLabel(obrazek, SwingConstants.CENTER);
label.setOpaque(true);
label.setBackground(Color.white);

JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(posuvniky[0], BorderLayout.NORTH);
panel.add(posuvniky[1], BorderLayout.WEST);
panel.add(label, BorderLayout.CENTER);
return panel;
}

谢谢大家。

嗯...

最佳答案

I do not know how to create described invisible layer

参见How to Use Layered Panes .

关于java - JPanel 中新的不可见层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15450159/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com