Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3668784
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:09:51+00:00 2026-05-19T02:09:51+00:00

I have a GUI class in netbeans that retrieves Tweets from the twitter search

  • 0

I have a GUI class in netbeans that retrieves Tweets from the twitter search API ,it contains TextAreas, Labels and Editor panes that shows the source user, time of posting, tweet text etc…
I want the tweets ( to be saved in a file and I need to serialize the class, so I can save the whole tweet as an object in a file. Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:09:51+00:00Added an answer on May 19, 2026 at 2:09 am

    Don’t store your whole GUI object as there will be plenty of stuff associated with the controls that you don’t need. Instead create a custom serializer, sounds impressive but is actually very simple.

    take this simple example, the class has a frame that has the name of the user up top, this is not serialized as the detail to create it is simply the name so don’t need to store the rest of the JFrame object. The other details are simple properties that can be serialised.

    public class Simple implements Serializable {
    
        private transient JFrame win;
        private String username;
        private Date postTime;
        //...assume getters/setters constructors e.t.c.
        private void writeObject( ObjectOutputStream out ) throws IOException {
            out.write( this );
            out.flush();
        }
        private Object readObject( ObjectInputStream in ) throws IOException, ClassNotFoundException {
            Simple s = (Simple) in.read();
            s.setWin( new JFrame( s.getUsername() ) );
            //...any other extra setup can be done here
            return s;
        }
    
    }
    

    As you can see I’ve tried to keep things simple, note I have just written this so haven’t tried it yet it’s more of a “starter for 10” than a complete solution.
    You can customize the serialisation for example you could send a Long to the stream instead of the complete Date object i.e. the output could have been
    out.write( username );
    out.write( postTime.getTime() );
    we are of course allowing autoboxing to take care of turning our long into a Long, so there is a possibility that some sneaky jdk might box it to an Integer instead and lose some precision 🙂
    plus changes to the order objects are written to the stream should be mirrored with the order they are read from the stream.

    Anyway once this is done you can write the objects to a file like so

    ObjectOutputStream oout = new ObjectOutputStream( new FileOutputStream( “blah.bin” ) );
    Simple s = new Simple();
    //…set some values on s
    oout.writeObject( s );
    oout.flush();
    oout.close();
    ObjectInputStream oin = new ObjectInputStream( new FileInputStream( “blah.bin” ) );
    Simple simple = (Simple) oin.readObject();
    oin.close();

    obviously I’ve not included the mass of extra syntax needed for exception handling and efficient stream usage but it’s just to give a few ideas.

    If this doesn’t take your fancy then you could always try using the object graph to xml serializer, that’s quite handy. “java.beans.XMLEncoder” this was a very handy class when storing simple beans in text fields in a db 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GUI tool that manages state sequences. One component is a class
I have a GUI window that I've created using Netbeans. I then ported the
I have a java class that extends from JPanel. The basic purpose of extending
I have a Java project where I am pulling tweets from twitter using the
For example I have a class that builds the GUI, a class that handles
I have a SWING GUI class that instantiates a custom JPanel for a portion
Basically I have a method in my Gui class that prints and appends text
I have to set up a Qt development environment for my GUI class. I
I have a class like this class GUI : public QWidget, public QThread When
I have a class (simulation) which creates an instance of another class (GUI). Inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.