I have a question at the time of being able to use the methods from a class that inherits from JFrame, like this:
class MarcoLibre extends JFrame{
}
In the constructor, I can access the methods that inherit from JFrame (and their corresponding inheritances).
class MarcoLibre extends JFrame{
public MarcoLibre(){
setTitle("JAVA"); //funciona
}
}
However, if I do it outside of the constructor, it does not work. Why from the constructor yes that I can and from outside him no? How could it be done without being in the constructor?
class MarcoLibre extends JFrame{
setTitle("JAVA"); //no funciona
}
Then I have my main class where I create a frame.
import javax.swing.*;
public class LibreDisposicion {
public static void main(String[] args) {
// TODO Auto-generated method stub
MarcoLibre miMarco = new MarcoLibre();
miMarco.setVisible(true);
}
}