Cornelius Flavius wrote:@CareyBrown Thanks for the form, but I don't understand any of these.
So, once again, this was my routine. For example, I have a main program, and want to calculate the area of hexagon, so I make a separate class with all methods needed in it, and when needed:
So I can use another class and it's methods no problem. Why can't I use JFrame's methods once I've instantiated a JFrame object? Why do I have to extend main class with JFrame, when it is obvious that main class sees SWING library and it'components, cause otherwise it would not let me use the JFrame class in the first place?
Cornelius Flavius wrote:It doesn't have to have too much with Swing. I just started learning Swing and encountered this phenomena.
Before this I was using working with input and output from the keyboard and I used:
import java.util.Scanner;
and I could use it's methods without having to extend my classes with:
Carey Brown wrote:That's because Swing is a "framework". A framework is an abstraction whereby the framework classes own the process and invokes the classes and methods you provide. JFrame, for example, owns the process and calls your classes and methods. This is why you have to extend JFrame whereas with Scanner you don't.
luck, db
There are no new questions, but there may be new answers.
Darryl Burke wrote:
Carey Brown wrote:That's because Swing is a "framework". A framework is an abstraction whereby the framework classes own the process and invokes the classes and methods you provide. JFrame, for example, owns the process and calls your classes and methods. This is why you have to extend JFrame whereas with Scanner you don't.
No, it isn't. No, it doesn't. No, you don't.
And all else aside, Scanner is a final class.
Carey Brown wrote:From Wikipedia
The Swing Application Framework (JSR 296) is a Java specification for a simple application framework for Swing applications, with a graphical user interface (GUI) in computer software. It defines infrastructure common to most desktop applications, making Swing applications easier to create. It has now been withdrawn.
luck, db
There are no new questions, but there may be new answers.
luck, db
There are no new questions, but there may be new answers.
luck, db
There are no new questions, but there may be new answers.
luck, db
There are no new questions, but there may be new answers.