1 year ago

#360922

test-img

panordo

Parameters on controller

How can I use xKoord and yKoord atributes in controller?, I want to use the cordinates to setBackground to labels near the one who calls addMouseListener

private JLabel getLblKasillaJokalari(int x, int y, Color c) {
        JLabel lblKasillaJokalari = new JLabel(" "); 
        int xKoord = x;
        int yKoord = y;
        lblKasillaJokalari.setOpaque(true);
        lblKasillaJokalari.setBackground(c);
        Border bordeBeltza = BorderFactory.createLineBorder(Color.BLACK,3);
        lblKasillaJokalari.setBorder(bordeBeltza);
        lblKasillaJokalari.addMouseListener(getControler());
        return lblKasillaJokalari;
        
    }
public void mouseEntered(MouseEvent e) {
            if (aukeratutakoOntzia == 1) {
                if (e.getComponent().getBackground() != Color.RED) {
                    e.getComponent().setBackground(Color.RED);
                    
                }
}

java

eclipse

controller

parameter-passing

windowbuilder

0 Answers

Your Answer

Accepted video resources