CrazyEngineers
  • Need help in Java using swing tools

    kuruganti

    Member

    Updated: Oct 20, 2024
    Views: 941
    How can we build a app that has 4 boxes and on clicking them boxes can be joined to other .
    Needd urgently ...
    plz help me out
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Morningdot Hablu

    MemberJan 8, 2011

    It's a simple thing to do buddy...where you find problem in doing so....?
    try to use setVisible().
    Check this...
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    /*<Applet code="ne" height=400 width=400></applet>*/
    public class ne extends Applet implements ActionListener
    {
        Button b[]=new Button[3];
        int i;
        public void init()
        {
            for(i=0;i<=2;i++)
            {
                b[i]=new Button("mohit");
                add(b[i]);
                b[i].addActionListener(this);    
            }
        }
        public void actionPerformed(ActionEvent e)
        {
            repaint();
            b[0].setVisible(false);
            b[1].setVisible(false);
        }
        public void paint(Graphics g)
        {
            
        }
    }
    
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register