I have created a Jframe and included 10labels and 10 textfields in it
when i try to run the program, it does not show all the labels and textfields..
sometimes all are visible if i run again then few disappear..

at times they r visible for a few secs and then disappear...

can i get any help???

Recommended Answers

All 3 Replies

you might want to show us some code, if you would like us to figure out what's wrong with it
and if you do.. please don't forget to pot code brackets

without the ' around your code

private void j_actionPerformed(ActionEvent e) {
        setVisible(false);
        JFrame frme = new JFrame();


       JLabel cls_load = new JLabel();
       JLabel cls_unload= new JLabel();
       JLabel thrd_cnt = new JLabel();
       JLabel peak_thrd_cnt = new JLabel();
       JLabel demon_thrd_cnt = new JLabel();
       JLabel os_nme = new JLabel();
       JLabel os_vr = new JLabel();
       JLabel no_proc = new JLabel();
       JLabel gc_cnt = new JLabel();
       JLabel gc_tme = new JLabel();
       JLabel hp_usge = new JLabel();
       JLabel nhp_usge = new JLabel();

       JTextField cls_ld = new JTextField();
       JTextField cls_unld = new JTextField();
       JTextField thrd_ct = new JTextField();
        JTextField pk_thrd_ct = new JTextField();
       JTextField demon_thrd_ct = new JTextField();
       JTextField os_n = new JTextField();
        JTextField os_v = new JTextField();
       JTextField no_prc = new JTextField();
       JTextField gc_ct = new JTextField();
        JTextField gc_time = new JTextField();
       JTextField hp_usg = new JTextField();
       JTextField nhp_usg = new JTextField();


       cls_load.setText("Classes Loaded");
       cls_load.setBounds(100,100,200,50);
       cls_load.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       cls_unload.setText("Classes Unloaded");
       cls_unload.setBounds(100,140,200,50);
       cls_unload.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       thrd_cnt.setText("Thread Count");
       thrd_cnt.setBounds(100,180,200,50);
       thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       peak_thrd_cnt.setText("Peak Thread Count");
       peak_thrd_cnt.setBounds(100,220,250,50);
       peak_thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       demon_thrd_cnt.setText("Daemon Thread Count");
       demon_thrd_cnt.setBounds(100,260,250,50);
       demon_thrd_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       os_nme.setText("OS name");
       os_nme.setBounds(100,300,200,50);
       os_nme.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       os_vr.setText("OS version");
       os_vr.setBounds(100,340,200,50);
       os_vr.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       no_proc.setText("Number of processors");
       no_proc.setBounds(100,380,300,50);
       no_proc.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       gc_cnt.setText("Garbage Collection Count");
       gc_cnt.setBounds(100,420,350,50);
       gc_cnt.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       gc_tme.setText("Garbage Collection Time");
       gc_tme.setBounds(100,460,350,50);
       gc_tme.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       hp_usge.setText("Heap Memory Usage");
       hp_usge.setBounds(100,500,300,50);
       hp_usge.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       nhp_usge.setText("Non Heap Memory Usage");
       nhp_usge.setBounds(100,540,400,50);
       nhp_usge.setFont(new java.awt.Font("Palatino Linotype", 1, 20));

       cls_ld.setBounds(500,100,100,30);
       cls_ld.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       cls_unld.setBounds(500,140,100,30);
       cls_unld.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       thrd_ct.setBounds(500,180,100,30);
       thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       pk_thrd_ct.setBounds(500,220,100,30);
       pk_thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       demon_thrd_ct.setBounds(500,260,100,30);
       demon_thrd_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       os_n.setBounds(500,300,200,30);
       os_n.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       os_v.setBounds(500,340,100,30);
       os_v.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       no_prc.setBounds(500,380,100,30);
       no_prc.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       gc_ct.setBounds(500,420,100,30);
       gc_ct.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       gc_time.setBounds(500,460,100,30);
       gc_time.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       hp_usg.setBounds(500,500,100,30);
       hp_usg.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       nhp_usg.setBounds(500,540,100,30);
       nhp_usg.setFont(new java.awt.Font("Palatine Linotype", 1, 20));

       frme.setBackground(new Color(204, 204, 204));
       frme.getContentPane().add(cls_load); 
       frme.getContentPane().add(cls_unload);
       frme.getContentPane().add(thrd_cnt);
       frme.getContentPane().add(peak_thrd_cnt);
       frme.getContentPane().add(demon_thrd_cnt);
       frme.getContentPane().add(os_nme);
       frme.getContentPane().add(os_vr);
       frme.getContentPane().add(no_proc);
       frme.getContentPane().add(gc_cnt);
       frme.getContentPane().add(gc_tme);
       frme.getContentPane().add(hp_usge);
       frme.getContentPane().add(nhp_usge);

       frme.getContentPane().add(cls_ld); 
       frme.getContentPane().add(cls_unld);
       frme.getContentPane().add(thrd_ct);
       frme.getContentPane().add(pk_thrd_ct);
       frme.getContentPane().add(demon_thrd_ct);
       frme.getContentPane().add(os_n);
       frme.getContentPane().add(os_v);
       frme.getContentPane().add(no_prc);
       frme.getContentPane().add(gc_ct);
       frme.getContentPane().add(gc_time);
       frme.getContentPane().add(hp_usg);
       frme.getContentPane().add(nhp_usg);



        //frme.getContentPane().setSize(new Dimension(600, 400));   
        frme.setTitle("JVM Monitoring");
    frme.setLocation(new Point(0, 0));
    frme.setSize(new Dimension(1100, 800));
    frme.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frme.setResizable(false); 



        frme.setVisible(true);      


    }

This is my code...
I am nt getting the desired output...

Use the code tags without the ' in the tag:

//code

Don't put the ' in the above tags

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.