Refresh JFrame

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









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
Part refresh without a page refresh
Part refresh without a page refresh  hello, How do I submit a form or a part of a form without a page refresh?   hii,ADS_TO_REPLACE_1 Ajax can do this. You can do partial update and upon a successful AJAX
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
jframe
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
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
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
refresh jsp page - Ajax
refresh jsp page  Code for refresh a web page in jsp.  Hi friend, function refreshpage() { window.location.reload
how to refresh my GUI page
how to refresh my GUI page  how to refresh a GUI in java
Refresh the form - Struts
Refresh the form  Hi How Can i control the page that doesn't go to refresh when i am doing 1 or more action from same page and forward those action again to same page. how can i control the doesn't go to refresh in that page
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
Table refresh with ajax - Ajax
Table refresh with ajax  I am using jsp/html in my code. Is it compulsory that i have to use a servlet to implement table refresh using ajax? Or jsp also would work? Rajatha
refresh rate in ajax
refresh rate in ajax  my data is in table which is generated dynamically. i want to refresh that perticular table after some time using ajax and with jsp
Frame refresh problem - Swing AWT
Frame refresh problem  Whenever I close a child frame and reload...[] args){ JFrame frame=new JFrame(); JButton b=new JButton("Submit"); frame.add(b...(){ public void actionPerformed(ActionEvent ae){ JFrame f=new JFrame
Client side refresh
Client side refresh  What is client side refresh?   ... by all browsers. <META HTTP-EQUIV="Refresh" CONTENT="5; URL=/servlet/MyServlet/"> This will refresh the page in the browser automatically and loads
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
how to reset JFrame
how to reset JFrame  how to reset JFrame
Table refresh with ajax - Ajax
Table refresh with ajax  Hi, I want to update my table which has... or if the database is updated, i want my table to be updated automatically. For this i think i need to use ajax where a particular area in the page can
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
Servlet refresh page
Servlet refresh page In this example we will show you how you can refresh your page from setting the refresh attribute from a servlet. response.setHeader("Refresh", "10"); The refresh attribute will direct
refresh - JSP-Servlet
. Is there any other way to refresh that particular place instead of refreshing whole page
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
page refresh - JSP-Servlet
up window has to close and jsp page has to refresh. how can i solve
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
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
Hoe to refresh a table row dynamically
Hoe to refresh a table row dynamically  Want to refresh a table data when a particular link is clicked. How can i do using ajax ?   Hello... will able to refresh a particular table row?ADS_TO_REPLACE_1 Please clarify
JFRAME - Java Beginners
javax.swing.*; import java.awt.event.*; public class MenuExample extends JFrame
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
jsp dropdown refresh - JSP-Servlet
but the probleam during data extraction when i select first drop down its refresh then 2nd drop down it also refresh. so i cannot get the selected data. Please kindly give
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
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
JFrame Button click to start play
JFrame Button click to start play  i made a game and and i add a button in new jframe and i want when i click it it start to play...can anyone help me
cache refresh after 24 hours
cache refresh after 24 hours  I have developed an application which uses websphere application server 6.1 which needs to query the database(oracle) after every 24 hours periodically.But it is not getting executed properly because
Version of com.jamesward>play-auto-refresh dependency
List of Version of com.jamesward>play-auto-refresh dependency
ModuleNotFoundError: No module named 'odoo10-addon-delivery-auto-refresh'
ModuleNotFoundError: No module named 'odoo10-addon-delivery-auto-refresh' ...: ModuleNotFoundError: No module named 'odoo10-addon-delivery-auto-refresh' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-delivery-auto-refresh

Ads