Results 1 to 9 of 9
  1. #1
    kumar.dinesh7 is offline Member
    Join Date
    May 2012
    Location
    Yamuna Nagar,Haryana,India
    Posts
    28
    Rep Power
    0

    Default is it possible..?

    is it possible that minimizing a form will minimize another form also....??

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: is it possible..?

    If you have a reference to the other forms then it is possible to do it.

  3. #3
    kumar.dinesh7 is offline Member
    Join Date
    May 2012
    Location
    Yamuna Nagar,Haryana,India
    Posts
    28
    Rep Power
    0

    Default Re: is it possible..?

    plz tell me how it is possible??
    any example code will helps me better..

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: is it possible..?

    Plenty of example code of all sorts here: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    kumar.dinesh7 is offline Member
    Join Date
    May 2012
    Location
    Yamuna Nagar,Haryana,India
    Posts
    28
    Rep Power
    0

    Question Re: is it possible..?

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    
    
    
    
    class text extends JFrame implements KeyListener
     {
        JPanel jp;
        boolean txtChanged=false;
        JTextArea t;
        File file;
        String fname="";
        String buf="";
        Container c;
        text()
            {
            setUndecorated(true);
            setVisible(true);
            setResizable(true);
            setLocation(550,100);
            setSize(600,650);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            ImageIcon img=new ImageIcon("icon.png");
            setIconImage(img.getImage());
            jp=new JPanel();        
            jp.setLayout(null);
            t=new JTextArea();
            JScrollPane scroll=new JScrollPane(t);
            t.setBorder(BorderFactory.createLineBorder(Color.black));
            t.setFocusable(true);
            //t.setEditable(false);
            scroll.setVisible(true);
            c=getContentPane();
            c.setLayout(new BorderLayout());
            c.add(scroll, BorderLayout.CENTER);
            t.addKeyListener(this);
             try
             {
                 FileReader fr=new FileReader("intro.txt");
                 BufferedReader br=new BufferedReader(fr);
                 while ((buf=br.readLine())!=null)
                 {
                     t.append(buf); 
                     t.append("\n");
                    }
                 br.close(); 
                 fr.close();
                }
                catch (IOException evt) 
                  {
                      System.out.println("Exception: "+evt);
                }
            }
            
            
              public void keyPressed(KeyEvent e)
        {
            //System.out.println("KP");
        }
    
        public void keyReleased(KeyEvent e)
        {
            //System.out.println("KR");
        }
        public void keyTyped(KeyEvent ke)
        {
            txtChanged=true;
        }
        }
    
    
    
    
    
    
    
    public class array extends JFrame implements ActionListener
    {
        JPanel jp;
        static JButton basic,operation,user_practice,menu;
        JLabel bg,logo;
            array()
            {
            super("Array-Data Structure Tutorial");
            setVisible(true);
            setResizable(true);
            setLocation(0,0);
            setSize(1200,780);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setExtendedState(JFrame.MAXIMIZED_BOTH);
            //SetCrossPlatformLookAndFeel(true);
            //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            //setDefaultLookAndFeelDecorated(true);
            //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
            ImageIcon img=new ImageIcon("icon.png");
            setIconImage(img.getImage());
            jp=new JPanel();        
            jp.setBounds(0,0,500,800);
            jp.setLayout(null);
            basic=new JButton("Basic Terminology",new ImageIcon("basic.jpg"));
            operation=new JButton("Operations",new ImageIcon("operation.jpg"));
            menu=new JButton("",new ImageIcon("home.png"));
            user_practice=new JButton("User Practice",new ImageIcon("user.jpg"));
            bg=new JLabel(new ImageIcon("bg1.jpg"));
            logo=new JLabel(new ImageIcon("logo.png"));
            Font f2=new Font("calibri",Font.PLAIN,20);
            Font f3=new Font("Times New Roman",Font.BOLD,15);
            basic.setFont(f2);
            operation.setFont(f2);
            user_practice.setFont(f2);
            menu.setFont(f2); 
            add(jp);
            jp.add(basic);
            jp.add(operation);
            jp.add(user_practice);
            jp.add(menu);
            jp.add(bg);
            bg.add(logo);
            basic.addActionListener(this);
            operation.addActionListener(this);
            user_practice.addActionListener(this);
            menu.addActionListener(this);
            basic.setBounds(100,160,250,60);
            operation.setBounds(100,260,250,60);
            user_practice.setBounds(100,560,250,60);
            menu.setBounds(55,30,50,50);
            bg.setBounds(0,0,1300,800);
            logo.setBounds(700,1,850,80);
            new text();
        }
    
              
        public void actionPerformed(ActionEvent e) 
        {
           /* if(e.getSource()==menu)
            {
                main m1=new main();
                this.setVisible(false);
             
            }
            else if(e.getSource()==basic)
            {
                basicarray m1=new basicarray();
                this.setVisible(false);
                
            }
            else if(e.getSource()==operation)
            {
               operations m2=new operations();
                this.setVisible(false);
            }
            
            else if(e.getSource()==user_practice)
            {
                practicearray m4=new practicearray();
                this.setVisible(false);
            }*/
            
        }
        public static void main(String str[])
        {
            array x=new array();
        }
    }
    minizing the form will also minimize the textarea.

    plz review this code and plz run this code atleast once to understand what i want to say.....
    Last edited by kumar.dinesh7; 07-03-2012 at 01:23 PM.
    dk

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: is it possible..?

    Did you read wsaryada's response at #2?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    kumar.dinesh7 is offline Member
    Join Date
    May 2012
    Location
    Yamuna Nagar,Haryana,India
    Posts
    28
    Rep Power
    0

    Default Re: is it possible..?

    yes i read that but i didn't got a solution.
    dk

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: is it possible..?

    That *is* the solution. If you don't understand what a reference is, and don't know how to pass a parameter to a constructor or method, stop whatever you're doing with GUIs and learn the basics first: Passing Information to a Method or a Constructor (The Java™ Tutorials > Learning the Java Language > Classes and Objects)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    kumar.dinesh7 is offline Member
    Join Date
    May 2012
    Location
    Yamuna Nagar,Haryana,India
    Posts
    28
    Rep Power
    0

    Default Re: is it possible..?

    i well understand what a reference is.

    anyways thanx for the guidence db....
    Last edited by kumar.dinesh7; 07-04-2012 at 03:02 PM.
    dk

Posting Permissions

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