0

I'm new to Java and now am learning building GUI using AWT (not Swing!)

So, I have created:

  1. A Frame (let it call f).
  2. A class, which creates me a CheckBox in the Panel in constructor:

    public class CheckBoxing extends Component{
        public CheckBoxing( Panel p) { 
            ...
            }
    }
    

Is there a field in Frame which I can use to initialize an exemplar of CheckBoxing? I know, I can simply rewrite CheckBoxing to accept Frame instead of Panel, or use JFrame, but this will ruin the idea I'm trying to implement.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
greyxray
  • 362
  • 2
  • 12
  • 1
    1- If you're new to Java, then use the Swing API or JavaFX, you'll get better support. 2- `Frame` is an ancestor of `Container` and `Component`, so you'd have more like using those, which are a common ancestor to `Panel` – MadProgrammer May 15 '15 at 12:16
  • 1) *"or use `JFrame`,"* Wait ..what? A `Frame` can do pretty much whatever a `JFrame` can do, so that makes me aware of the fact that I don't understand what you're trying to achieve here. 2) And to echo @MadProgrammer but expand: Why use AWT? See [this answer](http://stackoverflow.com/questions/6255106/java-gui-listeners-without-awt/6255978#6255978) for many good reasons to abandon AWT using components in favor of Swing. (I can't speak for Java FX.) – Andrew Thompson May 16 '15 at 05:27

0 Answers0