Refresh JFrame

Ads
 

Refresh JFrame

How to refersh a JFrame and its componets

View Answers

March 29, 2011 at 4:40 PM

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

 class Show extends JFrame {
    JPanel points;
    JTextField text;
    int maxPoints;

    public Show() {
        setBackground(Color.WHITE);
        setSize(400, 300);
        getContentPane().setLayout(null);
        setDefaultLookAndFeelDecorated(true);

        JLabel lab=new JLabel("Enter number of points: ");
        lab.setBounds(10,10,150,20);

        text = new JTextField();
        text.setBounds(150,10,100,20);

        this.add(lab);
        this.add(text);

        JButton submit = new JButton("Submit");
        submit.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
            maxPoints = Integer.parseInt(text.getText()) * 2;
            points.removeAll();

            for (int i=0; i<maxPoints; i++) {
                JTextField textField = new JTextField();
                points.add(textField);
            }
            points.validate();
            points.repaint();
        }
        });
        submit.setBounds(10, 40, 100, 20);
        this.add(submit);

        points = new JPanel(new GridLayout(2,2));
        points.setBounds(10,70,265,60);
        this.add(points);
        Component[] a = points.getComponents();
        System.out.println(a.length);
        repaint();
    }
   }
public class RefreshJFrame {
        public static void main(String[] args) {
        Show show = new Show();
        show.setVisible(true);
        }
}

November 10, 2012 at 10:23 AM

its not working

Ads









Related Tutorials/Questions & Answers:
Refresh JFrame
Refresh JFrame  How to refersh a JFrame and its componets
refresh checkbox jframe
refresh checkbox jframe  How to refresh checkbox button in JFrame
Advertisements
JFrame
JFrame  write an application with a JFrame that five labels describing reasons that a customer might not buy your product(for example "Too expensive") every time the user clicks a Jbutton, remove one of the negative reasons
jframe
jframe  Create a JFrame for the Summervale Resort. Allow the user to view the information about different rooms available, dining options and activities offered. Include at least two options in each menu and display appropriate
JFrame
Jframe. How can i do it. Please help me to do it. Or what else can i have
UIBarButtonItem Refresh
, refresh button using code in iPhone application?? If yes then how?   ... the refresh button... i'm providing you the example of Navigation Refresh UIBarbuttonItem...] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
jframe
Hiding a JFrame
javax.swing.*; import java.awt.event.*; class PassData extends JFrame { JTextField... java.awt.*; import java.awt.event.*; class NextPage extends JFrame { NextPage
Hiding a JFrame
javax.swing.*; import java.awt.event.*; class PassData extends JFrame { JTextField... java.awt.*; import java.awt.event.*; class NextPage extends JFrame { NextPage
Captcha Refresh - Jquery
Captcha Refresh - Jquery  I'm looking for an example to refresh the Captcha image in Jquery ..every time the page get refresh. Thanks.   $("#refresh").click(function() { $("#captcha").attr("src","captcha.php?r
ModuleNotFoundError: No module named 'refresh'
ModuleNotFoundError: No module named 'refresh'  Hi, My Python... 'refresh' How to remove the ModuleNotFoundError: No module named 'refresh... to install padas library. You can install refresh python with following command
how to refresh my GUI page
how to refresh my GUI page  how to refresh a GUI in java
servelt refresh page
servelt refresh page   write a program in servlet that display the cricket score.the page should automatically refresh on every 5 seconds.the score... should fall down.the page should not refresh after 5 overs is completed
how to reset JFrame
how to reset JFrame  how to reset JFrame
Windows 7 refresh DNS
Windows 7 refresh DNS  Windows 7 refresh DNS How to refresh DNS... to refresh the DNS. go to the command prompt (dos prompt) and then issue the following command: ipconfig /flushdns Above command will refresh the DNS data
jframe background color not showing
jframe background color not showing  jframe background color is not showing. please suggest.   Just add the background color to JPanel and then add it to JFrame. For example .. JFrame myFrame = new JFrame(); JPanel
jumping frame jFrame to jInternalframe
jumping frame jFrame to jInternalframe  Afternoon sir, I want to ask... and sub menu(employee). in Form Login(jFrame) have username(textfield1) and password(passwordfield1), in Menu(jframe) have Menu employee(jMenu),creaby(jlabel1
Removing the Title Bar of a JFrame
Removing the Title Bar of a JFrame  How to remove the Title Bar of a JFrame in Swing Application?   Please check the tutorial Removing the Title Bar of a Frame for the source code and example description. Thanks
ModuleNotFoundError: No module named 'db_refresh'
ModuleNotFoundError: No module named 'db_refresh'  Hi, My Python... 'db_refresh' How to remove the ModuleNotFoundError: No module named 'db_refresh' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'db_refresh'
ModuleNotFoundError: No module named 'db_refresh'  Hi, My Python... 'db_refresh' How to remove the ModuleNotFoundError: No module named 'db_refresh' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'ecs-refresh'
ModuleNotFoundError: No module named 'ecs-refresh'  Hi, My Python... 'ecs-refresh' How to remove the ModuleNotFoundError: No module named 'ecs-refresh' error? Thanks   Hi, In your python environment
How to refresh Client only once by sending setHeader ("refresh" ,??? )
How to refresh Client only once by sending setHeader ("refresh" ,??? ) ... to be refreshed ?? I just want to refresh my client page only once....! Not periodically... / REFRESH ....! I want to reload Client side only once when some event occur and flag
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...("serial") public class AddPage extends JFrame { JDesktopPane pane = new
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...("serial") public class AddPage extends JFrame { JDesktopPane pane = new
Adding JTable into existing Jframe.
Adding JTable into existing Jframe.  i need to add JTable into this code pls help me.. package Com; import Com.Details; import java.awt.Color...("serial") public class AddPage extends JFrame { JDesktopPane pane = new
how to move label in jframe in java?
how to move label in jframe in java?  please any one can give me code for moving a java label in Jframe
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than
how to add scrollbar to JFrame
how to add scrollbar to JFrame  hello friends i am making a java application in which i have a frame to which i wanted to add scrollbars but when i add my panel to scrollpane and then add that scrollpane to JFrame than

Ads