3 or 4 lines

Discussion in 'Java' started by Adam gimli84.o2.pl, Jul 4, 2005.

  1. I suppose there are not more than 4 lines to add hovewer I have no
    idea how they should look like, therefore I ask You for help.

    There are Two applets in two files and i want to run each fron the
    second one here is their code

    first file

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;

    plik: MojAplet2.java

    public class MojAplet2 extends JApplet
    {
    JButton przycisk;
    MojAplet2b a ;

    class ActListener implements ActionListener
    {
    public void actionPerformed(ActionEvent e)
    {
    if(e.getSource()==przycisk)
    {
    /*
    I suppose the code which runs the second applet should be here
    */
    }
    }
    }

    private ActListener ActList = new ActListener() ;

    public void init()
    {
    przycisk=new JButton("zmien");
    przycisk.addActionListener(ActList) ;
    getContentPane().setLayout(null);
    getContentPane().add(przycisk);
    przycisk.setBounds(30, 158, 300, 34);
    }
    }
    and the second file: MojAplet2.java

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;

    public class MojAplet2b extends JApplet
    {
    JButton przycisk;
    MojAplet2b a ;

    class ActListener implements ActionListener
    {
    public void actionPerformed(ActionEvent e)
    {
    if(e.getSource()==przycisk)
    {
    //something which will cause that the applet will end and return to
    the
    // parrent applet
    }
    }
    }

    private ActListener ActList = new ActListener() ;

    public void init()
    {
    przycisk=new JButton("zmien");
    przycisk.addActionListener(ActList) ;
    getContentPane().setLayout(null);
    getContentPane().add(przycisk);
    przycisk.setBounds(30, 158, 300, 34);
    }
    }

    Im really beginer and I would be gratefull for any help

    Regards,

    Adam Skrodzki
     
    Adam gimli84.o2.pl, Jul 4, 2005
    #1
    1. Advertising

  2. On 4 Jul 2005 00:54:53 -0700, Adam gimli84.o2.pl wrote:

    > Im really beginer and I would be gratefull for any help

    ...
    > I suppose there are not more than 4 lines to add hovewer I have no
    > idea how they should look like, therefore I ask You for help.


    A far better group for questions of this nature is
    comp.lang.java.help

    > //something which will cause that the applet will end and return to
    > the
    > // parrent applet


    A lot of the answer to this depends on exactly what you
    mean by 'end' and 'return'.

    Could you also explain (on your post on c.l.j.help)
    exactly what the user is seeing before they click
    any button, and what you woud like them to be seeing
    after they have clicked it.

    HTH

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Jul 4, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jack
    Replies:
    9
    Views:
    2,738
  2. Joe Wright
    Replies:
    0
    Views:
    553
    Joe Wright
    Jul 27, 2003
  3. lovecreatesbeauty

    How to know two lines are a pare parallel lines

    lovecreatesbeauty, Apr 27, 2006, in forum: C Programming
    Replies:
    11
    Views:
    693
    Old Wolf
    Apr 28, 2006
  4. Replies:
    1
    Views:
    486
    Jonathan Mcdougall
    Dec 6, 2005
  5. Murali
    Replies:
    2
    Views:
    609
    Jerry Coffin
    Mar 9, 2006
Loading...

Share This Page