Frame refresh problem

Frame refresh problem

Whenever I close a child frame and reload it using the button on parent frame controls on the child frame load twice at different positions...
i've used validate() bt it dosen't work!
Please suggest how to correct this problem....its urgent!!
thnks in adv..
View Answers

July 27, 2010 at 5:08 PM

Hi Friend,

Try the following code:

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

class FrameLocation {

public static void main(String[] args){
JFrame frame=new JFrame();
JButton b=new JButton("Submit");
frame.add(b);
frame.setVisible(true);
frame.pack();
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
JFrame f=new JFrame();
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
f.setLocation((int)d.getWidth()/2 - (int)f.getPreferredSize().getWidth()/2,
(int)d.getHeight()/2 - (int)f.getPreferredSize().getHeight()/2);
f.setVisible(true);
f.setSize(300,100);
}
});
}
}

Thanks









Related Tutorials/Questions & Answers:
Frame refresh problem - Swing AWT
Frame refresh problem  Whenever I close a child frame and reload it using the button on parent frame controls on the child frame load twice... to correct this problem....its urgent!! thnks in adv..  Hi Friend
swing frame problem
swing frame problem  Hi All, I m creating a swing/awt based window... a frame which have few buttons and Text Box to get some data from user at this time when I will click on submit button then next frame should be open with in same
Advertisements
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
problem in adding a fullscreen frame nd adding a glass pane to it
problem in adding a fullscreen frame nd adding a glass pane to it  hi , here is my code import java.awt.*; import javax.swing.*; import java.awt.ToolKit; class MyFrame extends Jframe{ Container c; JPanel glass; MyFrame
frame
frame  how to creat a frame in java   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void
Refresh JFrame
Refresh JFrame  How to refersh a JFrame and its componets
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
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
refresh checkbox jframe
refresh checkbox jframe  How to refresh checkbox button in 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
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
Image on frame
Image on frame   Hi, This is my code. In this I am unable to load the image.I want to know the problem with this code. import java.awt.*; import java.awt.event.*; public class AwtImg extends Frame { Image img; public
refresh jsp page - Ajax
refresh jsp page  Code for refresh a web page in jsp.  Hi friend, function refreshpage() { window.location.reload
page refresh - JSP-Servlet
up window has to close and jsp page has to refresh. how can i solve this problem Thanks, Lakshminarayana.   Hi friend, For read more
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
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
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
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
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
panel and frame
panel and frame  What is the difference between panel and frame
Java Frame
Java Frame  What is the difference between a Window and a Frame
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
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
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
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
Click on Page Refresh - JSP-Servlet
facing a problem whenever i click on page refresh or f5 button, the value on form... friend, Your problem related to duplicate inserting the data in database... is click". If u have more problem then give error page code. Thanks
Frame query
Frame query  Hi, I am working on Images in java. I have two JFrame displaying same image. We shall call it outerFrame and innerFrame.In innerFrame i am rotating the image.After all the rotations i need to display this image
frame generation
frame generation  Hi I wnat to genarate one frame with two tabs working ,production..and I want two radiobuttons sector ,others in the frames..based on the tab selection I want to clikc the radio button..when i ckick the radio
Frame
frame
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
how to create frame in swings
how to create frame in swings  how to create frame in swings
collection frame work
collection frame work  explain all the concept in collection frame work
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
link to other frame - Applet
link to other frame  how a button to open to another frame? and the frame can keyin the data and it can show at the previous frame
collection frame work
collection frame work  explain the hierarchy of one dimensional collection frame work classes
collection frame work
collection frame work  could you please tell me detail the concept of collection frame work
how to print JInternal frame component ?
how to print JInternal frame component ?  hello sir, i devalop a swing application .but problem is that how display report & print it. some data prefech from database & keep to jtable but how it is print with table
Restlet Frame work Related question
Restlet Frame work Related question  How to send data from client to server using Restlet framework. The main problem is i am not able to get data at server side. Can anyone post a complete program how to achieve
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

Ads