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



Home Answers Viewqa Swing-AWT Frame refresh problem

Have Programming Question? Ask it here!
 
 
 


raman
Frame refresh problem
1 Answer(s)      4 years 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
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
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
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
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
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
Client Auto Refresh in Servlets
Client Auto Refresh in Servlets       This section illustrates you how client gets auto refresh. We are providing...("Refresh", "15") refreshes the servlet after every 15 seconds till
collection frame work
collection frame work  explain all the concept in collection frame work
how to create frame in swings
how to create frame in swings  how to create frame in swings
Refresh a Web Page Using In Servlet
.style1 { font-weight: bold; } Refresh a Web Page Using... example we develop an application to Refresh a web Page using Servlet. We...;) and refresh this web page and print the current Date and Time after 10 sec
Creating a Frame
; Setting the Icon for a Frame    Showing a Dialog Box  ... an Icon to a JButton Component    Making a Frame Non-Resizable    Removing the Title Bar of a Frame   
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  could you please tell me detail the concept of collection frame work
collection frame work
collection frame work  explain the hierarchy of one dimensional collection frame work classes
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
Page is not getting loaded when I refresh the webpage???
Page is not getting loaded when I refresh the webpage???  **I am loading an image section(image,demo link,Zoom) in a webpage by using javascript... when I refresh the page.* Note: Header section is getting loaded always Could
How to prevent the page refresh while submitting the form??
How to prevent the page refresh while submitting the form??  Hi. Requirement: There are two drop down boxes.Dropdown2 should load corresponding to the select of Dropdown1. Im hitting a db for this every time.Hence the page loads
jsp drop down without refresh - JSP-Servlet
refresh and what change's is made in jsp of javascript to make proper data
single frame coding in java
single frame coding in java  sir, i am a beginner in java.i want to do a desktop application in java in which a single frame satisfies all needs.but i want changes in that frame only.how can i solve this?i think multiple frames
Advertisements
 

 

 

DMCA.com