Re: Open new JPanel (JFrame, ...) by clicking JButton



On 2006-01-09, snuffie_456@xxxxxxxxx penned:
> Hello everybody,
>
> I'm writing a program in Java, in which I want to use more than one
> window. Can anyone tell me how I can open a new JPanel (or perhaps
> I'd better choose "extends JFrame"?) by clicking a JButton in the
> main program? eg. clicking on "Find" will open a "Find-window", in
> wich the user can type and do things (more than a regular aboutbox
> or so...) I am a newbie in Java and I've been searching for a whole
> day on something that maybe the most of you wil find ridiculous, but
> I really can't find or realise it...
>
> I hope someone can help me!
>
> Thanks in advance, Greetings, Tari

You'll need an ActionListener for the JButton. In that
ActionListener, you will need to create or show a new JFrame or
similar.

Have you gotten to the point of using ActionListeners yet?

--
monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
.



Relevant Pages

  • Re: Focus on JFrame
    ... > And how can I set focus on my JFrame, instead of as it is now my JButton? ... > requestFocusInWindow(); ... > and run my Java program again, the JButton is visible, but has focus too ...
    (comp.lang.java.gui)
  • Focus on JFrame
    ... How does focus work in Java? ... And how can I set focus on my JFrame, instead of as it is now my JButton? ... requestFocusInWindow(); ...
    (comp.lang.java.gui)
  • Re: Distinguish Timer (in Swing) event among the others
    ... In Java, it's not that way. ... of behavior (that is, ActionListener), and you've got one. ... the specific implementation is of very isolated importance. ... especially when that class doesn't present a top-level API ...
    (comp.lang.java.programmer)
  • Re: Distinguish Timer (in Swing) event among the others
    ... > secondButton.addActionListener(new ActionListener() { ... > In Java, it's not that way. ... > implementation class doesn't need a name, because all you need to know ... > single object for listening to all kinds of events and then sorting them ...
    (comp.lang.java.programmer)
  • Re: Manipulating a Third-Party Java Application from another Java Application
    ... Then you can probably locate the JFrame from within ... Based on the configuration file I found on the wrapper, ... own code as you suggest (my Java experience is limited, ... since Swing doesn't use the Win32 API for much. ...
    (comp.lang.java.programmer)