我想寻求帮助。我想要这样的东西:http: //docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html#glasspane
我有这个带有地图的应用程序,我想在一个新的不可见图层中有一张小图片。小图片可以通过 JSlider 向上和向左移动。该层应该只在“标签”之上。A 有这个代码:
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;
}
谢谢大家。
嗯...