class from descriptionSun, 18 Jun 2023

Create a class named Celda which extends JLabel and is intended to be in the same position as its attribute JLabel etiqueta, also has int id, num, where num is 2 to the power of id

import javax.swing.JLabel; public class Celda extends JLabel{ private JLabel etiqueta; private int id,num; public Celda(JLabel etiqueta, int id) { super(); this.etiqueta = etiqueta; = id; this.num = (int)Math.pow(2, id); } public JLabel getEtiqueta() { return etiqueta; } public void setEtiqueta(JLabel etiqueta) { this.etiqueta = etiqueta; } public int getId() { return id; } public void setId(int id) { = id; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } }

Questions about programming?Chat with your personal AI assistant