Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Rufus Williams   on Apr 21 In Java Category.

  
Question Answered By: Julia Flores   on Apr 21

First, I don't understand the panel  panel1 declaration outside the
class.
Second, why use
public panel1()?

You don't have a void return value.
Change it to public void panel1().

Don't put  numbers in you variable names.
Don't create to objects with same name in the same class.
If you don't need the objects outside the class, declare them
private. Layout objects, such as Panels, should be placed
outside a method, because it's easier to use them later from
other methods.

Then don't extend WindowAdapter and implement
WindowListener at the same time! When implementing
WindowListener, you must override all the methods in the
WindowListener interface. When extending WindowAdapter, you
don't need to override all the methods. That's the difference
between extending and implementing. You write an interface
when passing unknown objects to a function. WindowAdapter is
implementing WindowListener.

If you want to extend a Frame, you must put a
public void main(String args[ ])
The create an instance of your class, or you will never see you
window! (if you not use it from another class)

Share: 

 
 
Didn't find what you were looking for? Find more on borderlayout on a frame Or get search suggestion and latest updates.


Tagged: