Tags down


JFrame Update problem

By : hello
Date : October 18 2020, 11:12 AM
I hope this helps you . You add the new components the same way you add them when you first create the gui eg.
code :

Share : facebook icon twitter icon

JFrame repaint(); How to update the JFrame with Thread info?

By : Lucifer
Date : March 29 2020, 07:55 AM
it fixes the issue I don't see anywhere you tell the UI it should update itself.
You're also going a long way out of your way to replicate what is already available within the APIs.
code :
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class LabelClock {

    public static void main(String[] args) {
        new LabelClock();

    protected static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm.ss");
    private JLabel clock;

    public LabelClock() {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {

                clock = new JLabel();

                JFrame frame = new JFrame("Testing");
                frame.setLayout(new GridBagLayout());

                Timer timer = new Timer(500, new ActionListener() {
                    public void actionPerformed(ActionEvent e) {

    protected void tick() {
        clock.setText(DATE_FORMAT.format(new Date()));


how update a JFrame with data from another JFrame?

Date : March 29 2020, 07:55 AM
should help you out your GUI should not have more than one JFrame displaying. Your problem more generally is simply how to update the state of one object from another. Often calling setter methods should work. Sure this trivializes the question, but without further information from you, that's about the most we can tell you. When to do an update of the object may be a more difficult issue to tackle, and here using a observer pattern often is helpful. Examples of this include using ActionListeners or ChangeListeners or PropertyChangeListeners.
For help in greater depth, consider giving us greater depth on your question.

Changing the value of a textfied in JFrame class1, JFrame class2,... by selecting an item from jtable in Jframe class3

By : user2760311
Date : March 29 2020, 07:55 AM
will be helpful for those in need As @AndrewThompson wisely mentioned, the use of multiple JFrame is a bad practice. In this case a (non-)modal dialog would be a better choice.
Now let's assume you choose non-modal dialogs, then you still having the same problem. There are several ways to solve it but essentially you need to keep a reference to the frame/dialog which opened the calendar's frame. Even better, you can use interfaces to define a contract to update a text field isolating the desired behavior from the actual implementation. For example:
code :
public interface IUpdateText {

    public void updateText(String text);

class Calender extends JFrame {
    private IUpdateText updateText;
    public void setIUpdateText(IUpdateText ut) {
        this.updateText = ut;
public void mouseClicked(MouseEvent me) {
    if (me.getClickCount()==2){
        int selectedRow = jTable1.getSelectedRow();
        int selectedColumn = jTable1.getSelectedColumn();
        if (selectedRow > -1 && selectedColumn > -1) {
            Object value = jTable1.getValueAt(selectedRow, selectedColumn); // ask the value to the view, not the model. Otherwise you need to convert both row and column indexes
            this.setVisible(false); // maybe this.dispose() instead ?
class SowInformation extends JFrame implements IUpdateText {
    private JTextField jTextField4;
    public void updateText(String text) {
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    Calender frmMain = new Calender();
    calender.setIUpdateText(this);  // assuming 'this' is an IUpdateText interface compliant

java JFrame update amends another JFrame

By : pdobrev
Date : March 29 2020, 07:55 AM
around this issue You could ...
Use a modal JDialog to collect the information from the user and when it's closed, you'd be able to reload the file from the current frame. Allow the first frame to register an action listen to the second frame, which when called (presumably when the user clicks the accept button), you would then reload the file and update the UI

How to update a JFrame from another JFrame in java

By : jpacanowski
Date : March 29 2020, 07:55 AM
wish of those help do you heard about the Observer pattern?
it might be the right thing for you.
Related Posts Related Posts :
  • GWT DatePicker Locale
  • How would you design a twitter like message system, how to design the messaging system?
  • Is there a robust java.util.logging handler implementation of syslog?
  • Aligning messageformat on printing a JTable
  • SXXP0003: Error reported by XML parser: Content is not allowed in prolog
  • ehcache LRU evicting recently used entries
  • java cosine similarity problem
  • Efficient way to implement a client multiple file upload service
  • Regarding Object Comparison
  • How to embed IE in Swing application?
  • Using javax.tools.ToolProvider from a custom classloader?
  • What is the difference between i++ & ++i in a for loop?
  • Match a java main class with regexp
  • Confluence Persistence
  • Is there a way for a SecurityManager in java to selectively grant ReflectPermission("suppressAccessChecks")?
  • Using the camera activity in Android
  • Is communication in java rmi secure?
  • Java - how to make "runnable" JTable?
  • How can I write a Java program to draw a box, an oval, and an arrow?
  • What is the difference between ServletRequest's getRemoteHost() and getServerName()
  • java sparse matrix problem
  • ClassCastException when using HQL
  • how to generate a csv file through java code
  • Netbeans + tomcat on Ubuntu
  • How to connect to a remote MySQL database with Java?
  • System Event Handling using Java
  • How to change Ant script with EMMA code-coverage so it can find runtime coverage data?
  • Java bytecode iconst_0 iadd sequence
  • get the size of a list in a property
  • I want to convert a resultset to a string. I have tried everything but it always gives no data found. Please provide som
  • How can i sort java JTable with an empty Row and force the Empty row always be last?
  • How can I mount network drive in Mac OS X on Java?
  • XStream: How do I map xml mixed attributes and elements to POJOs?
  • begin with java voip
  • java: Preferences API vs. Apache Commons Configuration
  • Howto distinguish Application Quit from System Shutdown
  • How to go about with real GUI development with Java Swing and MVC
  • VB support in Java 6?
  • How to use jar files without package information?
  • how to inherit Constructor from super class to sub class
  • Multidimensional arrays in Java extends which class?
  • Connect to ibm mq with jms . Specify the channel and queue manager
  • Accessing the implicit objects from a JSP EL function
  • Find current heap size with jmap
  • Why doesn't Java have compound assignment versions of the conditional-and and conditional-or operators? (&&=, ||
  • What is the best way to manage configuration data
  • commons fileUpload: specifying an upload directory within Webapplication context
  • ModelAttributes not accessible on jsp
  • Session management between thick client and server?
  • Oracle JDBC intermittent Connection Issue
  • No mapping for LONGVARCHAR in Hibernate 3.2
  • A Packet Blocker Software
  • Anyone using Django in the "Enterprise"
  • Memory leak during repeated lucene query searches?
  • First steps developing in java applet. Directions
  • java efficient de-duplication
  • Converting sequential Java to concurrent java code
  • Java variable number or arguments for a method
  • when developing locally, does it make a difference if the context is '/' or '/appname/'?
  • Problem using JUnit4TestAdapter from eclipse plugin context
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org