Results 1 to 4 of 4
  1. #1
    soft is offline Member
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    0

    Unhappy i need help please

    hi

    i need code to transver from one frame to another frame by clicking the button in java language ...

    this is my question
    and i need help pleeeeeeeeeease

    :(:(:(

  2. #2
    baloda is offline Member
    Join Date
    Nov 2010
    Location
    New Delhi
    Posts
    50
    Rep Power
    0

    Default

    import java.awt.Color;
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;

    public class CustomerNew{

    CreateSlider_7 cs_7=new CreateSlider_7();

    JFrame frm;
    JPanel jp;
    JButton SMM = new JButton("SMM");
    JButton SD = new JButton("SD");


    public CustomerNew() {
    frm = new JFrame();
    frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ;
    frm.setSize(1000, 735);
    frm.setVisible(true);
    jp = new JPanel();
    jp.setBounds(10, 280, 110, 270);
    frm.add(jp);
    jp.add(SMM);
    SMM.setBounds(2, 25, 50, 20);

    SMM.addActionListener(new ButtonClicked());
    SD.addActionListener(new ButtonClicked());
    }

    class ButtonClicked implements ActionListener {

    public void actionPerformed(ActionEvent e) {
    System.out.println("button1 clicked" + e.getActionCommand());
    String btnname = e.getActionCommand();
    if (btnname.equals("SMM"))
    cs_7.callingmain();
    if (btnname.equals("SD"))
    cs_7.frame.setVisible(false);

    }
    }



    public static void main(String[] args) {
    CustomerNew a= new CustomerNew();


    }

    class CreateSlider_7 extends JPanel {
    JFrame frame;
    public void callingmain() {
    frame = new JFrame("Slider Frame");
    frame.setContentPane(cs_7);
    frame.setSize(400, 400);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_C LOSE);
    frame.add(SD);

    }

    }

    }

    i think this is what u need.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by soft View Post
    hi

    i need code to transver from one frame to another frame by clicking the button in java language ...

    this is my question
    and i need help pleeeeeeeeeease

    :(:(:(
    This is forum, not a code bank. Please show your effort and ask your questions more clearly. Then only most of other members could help you. Please take it serious.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by baloda View Post

    i think this is what u need.
    No, what you should give is a proper guide. Why you really want to write code for others, my friend it'll never help for OP, because he/she may never learn stuff from you. :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •