Home Answers Viewqa Swing-AWT Frame refresh problem

 
 


raman
Frame refresh problem
1 Answer(s)      2 years and 11 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..
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 Pages:
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
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
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
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
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
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
Refresh code - Java Server Faces Questions
Refresh code  Hi All, In Drop Down Box i have 5 items if i select one item it is displaying item number beside that box.after in that it is adding 5 items again.so total 10 items repeatedly.what is the problem there.what
call frame - Java Beginners
call frame   dear java, I want to ask something about call frame to another frame and back to first frame. I have FrameA and FrameB. In frameA... that, following code will help you. If you have any type problem then send me code
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
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
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
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
how can i print the selected content of a frame
to skip all the text fields shapes and all the button from the frame.. but all... solution or code for this problem
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
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
how to refresh my GUI page
how to refresh my GUI page  how to refresh a GUI in java
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
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
GUI problem
); JFrame frame = new JFrame(); frame.getContentPane().add(button
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
Swing Problem on submission of button
Swing Problem on submission of button  How to close current frame (Frame1) and open a new frame (Frame2) already created and pass the data to frame2 from frame1 on the clicking of button in swing
printout problem
{ JTableDatabase frame=new JTableDatabase(); frame.setSize(450,200
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
problem:struts code - Struts
problem:struts code  Hi, Am using struts1.2.I wrote a form... the action class,in action class i gave forward to same form,the problem is if i forward to same page the form displayed with previous fields.if i press refresh
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
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
for a problem in coading - Java Beginners
for a problem in coading  what is the problm in following coading... mywindows extends Frame { public static void mywindow() { Frame f = new Frame...(String[] args) { mywindow (); } }   Hi Friend, There is no problem
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
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
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
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
coding problem - JSP-Servlet
coding problem  Dear sir i m very new to JSP .I am using two conbobox .if any option is selected in first combobox then only its data from the database should be displayed in other combobox, means how can we refresh
Grid Problem - Java Beginners
Grid Problem  Hi Deepak Plz take seriously I m telling u detail. Steps: 1:- there r one form,this form belong to grid. and two button also one is new and other is refresh 2:- if user click new button then open