我想请求帮助。我想要这样的事情:http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html#glasspane
我有这个应用程序与地图,我想在一个新的不可见层中有一个小图片。 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;
}
感谢大家。
MmM ......