Java:
public class Frame1 extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JLabel l_quickSlotBar = new JLabel(new ImageIcon("ui_texture0.png"));
private JMenuItem mi_speichern = new JMenuItem("Save");
private JMenuItem mi_speichern_als = new JMenuItem("Save as...");
private JMenuItem mi_oeffnen = new JMenuItem("Open");
private JMenuItem mi_info = new JMenuItem("Info");
private JMenuItem mi_calc = new JMenuItem("Calc");
private String[] skills = { "Klick on one Qickbarslot" };
private String[] lvls = { "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };
private JComboBox cb_select_skill = new JComboBox(skills);
private JComboBox cb_select_lvl = new JComboBox(lvls);
private JLabel l_slot1 = new JLabel();
private static final Dimension SELECTSKILL_SIZE = new Dimension(150, 30);
private static final Point SELECTSKILL_POINT = new Point(200, 5);
private static final Dimension SELECTSLVL_SIZE = new Dimension(50, 30);
private static final Point SELECTSLVL_POINT = new Point(355, 5);
private static final Dimension QUICKSLOTBAR_SIZE = new Dimension(648, 61);
private static final Point QUICKSLOTBAR_POINT = new Point(0, 40);
private static final Dimension SLOT_SIZE = new Dimension(40, 40);
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(null);
setResizable(false);
setSize(648, 150);
JMenuBar menu = new JMenuBar();
JMenu datei = new JMenu("Datei");
JMenu help = new JMenu("Help");
JMenu calc = new JMenu("Calc");
setJMenuBar(menu);
menu.add(datei);
menu.add(calc);
menu.add(help);
datei.add(mi_speichern);
datei.add(mi_speichern_als);
datei.add(mi_oeffnen);
help.add(mi_info);
calc.add(mi_calc);
setTitle("geheim! xd");
contentPane.add(l_quickSlotBar);
contentPane.add(cb_select_skill);
contentPane.add(cb_select_lvl);
contentPane.add(l_slot1);
cb_select_lvl.setLocation(SELECTSLVL_POINT);
cb_select_lvl.setSize(SELECTSLVL_SIZE);
cb_select_skill.setLocation(SELECTSKILL_POINT);
cb_select_skill.setSize(SELECTSKILL_SIZE);
l_quickSlotBar.setLocation(QUICKSLOTBAR_POINT);
l_quickSlotBar.setSize(QUICKSLOTBAR_SIZE);
l_slot1.setLocation(QUICKSLOTBAR_POINT.x + 51,QUICKSLOTBAR_POINT.y + 6);
l_slot1.setSize(SLOT_SIZE);
l_slot1.addMouseListener(new slot_ActionHandler());
/*edit:*/contentPane.setComponentZOrder(l_slot1, l_slot1.getComponentCount());
}
}
Edit:
falls jemand ein änliches Problem hatt:
contentPane.setComponentZOrder(l_slot1, l_slot1.getComponentCount());
mit dem Befehl wird das Label l_slot1 zwar hervorgehoben aber auch erst nach dem MouseEvent. komisch
Zuletzt bearbeitet: