Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT Frame refresh problem
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


raman
Frame refresh problem
1 Answer(s)      4 years and 4 months ago
Posted in : Swing AWT


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..

Advertisement
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: import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void main(String[] args
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, Ajax can do this. You can do partial update and upon a successful AJAX interaction over the whole
refresh checkbox jframe
refresh checkbox jframe  How to refresh checkbox button in JFrame
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
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
refresh jsp page - Ajax
refresh jsp page  Code for refresh a web page in jsp.  Hi friend, function refreshpage() { window.location.reload
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
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
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
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
how to refresh my GUI page
how to refresh my GUI page  how to refresh a GUI in java
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
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
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
refresh - JSP-Servlet
. Is there any other way to refresh that particular place instead of refreshing whole page
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
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
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? Please clarify this. Thanks
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
Java Frame
Java Frame  What is the difference between a Window and a Frame
panel and frame
panel and frame  What is the difference between panel and frame
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
Advertisements
 

 

 

DMCA.com