Changing the titles of all frames in a running application

Hi All,
I've got a 50+ frame application. I have realized that I need to update the frame titles for all the frames based upon some event that can be initiated by any of the frames. Each frame title will be different but will incorporate a bit of knowledge about the event. (Note that when I use the term "event", I'm using it in the normal English language sense, not a Java language sense!)
I've been considering a few approaches and most look either stupid or a whole lotta' work! I'm looking for how to do this the "right way." ...I don't have a broad enough experience to know what's "common" regarding application architecture, but here's what I've got:
A "Master" class kicks things off. It instantiates a few things like a database connection and so forth, and then it starts a MainFrame that appears on the users screen. The MainFrame, and all of its children, are actually of a class that's an extension of JFrame.
It's my supposition that I'd like to create some kind of frame pointer holder in the Master, and all frames "register" themselves. When an event occurrs that warrants changing the frame titles, the Master walks the collected frame pointers and directs the titles be changed, as appropriate. ...OR... Is there already a collection of "children" of the master? How would I get that list and how would I walk it looking for a frame?
Another idea is to be able to send some kind of notification to each frame and say, "Go Update Your Title!"
Example code GREATLY appreciated!
Thanks much,
Richard

... While looking into doing this EventObject thing, I noticed that EventObjects are a heavyweight version of what I want... What it really boils down to is:
Master defines:
private static Master M = null;
Vector myChildren = new Vector();
Then in the constructor:
M = this;
Then in a method:
Vector v = (Vector)myChildren.clone;
for (int i=0; i<v.size(); i++;)
((JFrame)v.elementAt(i)).updateTitle();
In each JFrame (in my case, in the class that extends JFrame):
M.addElement(this);
and in the right place
M.removeElement(this);
Oh yeah, and don't forget a method to set the frame title!...
public void updateTitle()
this.setTitle("whatever");
...That's it! WAY easier than all that foolishness with declairing your own event listeners and everything... For my needs, this was the way to go!
Regards,
Richard

Similar Messages

  • How can I change the year of an album in itunes11 without changing the years of all titles?

    How can I change the year of an album in itunes11 without changing the years of all titles. For example: the reissues of an 1982 album has a 1995 bonus track, but I want it to be sorted as an '82 album? In earlier versions, when itunes sorted my album "by year", it took the year of the first title as the album's year (which makes a lot of sense). In itunes 11, however, the /highest/ year of any title in an album is taken to be the album's year. This upsets my entire catalogue. Can this be changed, will this be changed?

    Highlight all of the songs,File>Get Info, change the genre

  • How to change the template of all my title pages

    ok i made a film using cs4
    with 20 seperate title pages all the title
    pages started from the same title template
    what i want to know is :-
    is it possable to change the properties of all the title pages at the same time
    for instance change the font / or font colour of all titles with one or two clicks
    rather than me go through each title page separately
    cheers

    ok
    so are you saying that in the future
    if i was to make all my titles from THE SAME template AND using the "based on current" function
    i would then be able to make adjustments to the first title in the project panel and the adjustments would be reflected on all titles  throughout the timeline

  • Change the title of a TitledBorder

    I have a titledBorder and set an initial title.
    JPanel         panel = new JPanel();
    Border         etched = BorderFactory.createEtchedBorder();
    TitledBorder   title  = BorderFactory.createTitledBorder(etched, "myPanelNameEnglish");
    title.setTitleJustification(TitledBorder.LEFT);
    panel.setBorder(title);If the user change the language I also want change the title of the TitledBoarder:
    TitledBorder tb = (TitledBorder) panel.getBorder();
    tb.setTitle("myPanelNameInFrench");I realize it for all buttons, labels etc. but the title of the TitledBoarder.
    Is it possible to change it's title? And how? Please help me :)

    Sure you can change the title on the fly.
    Here's some code that shows how it is done:
    final JFrame f = new JFrame( "Test Frame" );
    final JPanel p = new JPanel();
    p.setBorder( BorderFactory.createTitledBorder( "This is a title" ) );
    p.setPreferredSize( new Dimension( 400, 400 ) );
    JButton b = new JButton ( "Click me" );
    b.addActionListener( new ActionListener(){
         @Override
         public void actionPerformed(ActionEvent e) {                    
              ((javax.swing.border.TitledBorder)p.getBorder()).setTitle( "Nother title" );
              p.revalidate();
              p.repaint();
    p.add( b );
    f.getContentPane().add( p );
    f.setSize( 500, 500 );
    f.setVisible( true );
    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );     

  • Renaming the title of a frame from a panel

    Hi,
    I've searched the forum but I could not find anything that help me...
    I want to change the title of Main(a class that extends JFrame) from MainPanel(a class that extends JPanel)
    somewhere in my MainPanel I use:
    ((Main)getParent()).setTitle("A new Title...");Idont have any compiling error, but I get an exception
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JPanel
            at mw_recipebook.MainPanel.actionPerformed(MainPanel.java:173)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
            ...I've used succesfully the method:((aClass)getParent()).aMethode();before, when using from a childPanel to call a methode in it's parentPanel, but from panel to frame it does not work.... help! How do I do that?
    Thank's

    ... or else you can try this:
    ( (JFrame)getRootPane().getParent()
    ).setTitle("Title");
    thank's allot
    I tought of getRootPane(), but not getRootPane().getParent()

  • Is it possible to change the title of a webpart using client object model/c#/sharepoint online

    Hi folks!
    I have been busted my butt trying to Write a program changing the title of an existing webpart on on of our subsites on SharePoint online. But I keep getting an error in the very last context.executequery. Tried a bunch of different approaches, but I can't
    make it work. Before I start posting code; I Wonder if anyone have ever done this?
    Its a plain Windows form application, using Visual studio Express and the Client Object model. (Listsing the titles of the webparts Works but changing titles seem impossible. Thought it might be a checkin/out problem but it doesn't make a difference).
    Any help would be highle appreciated.
    Lars

    It depends: are you using the default style for Text Captions? In that case you can change the default style in the Object Style Manager and have it applied to all Captions.
    Or you can change one text caption, and in its Properties panel choose the option 'Save Changes to existing style' from the menu top right (see screenshot). Both methods will work if you didn't override the default Caption Style for those captions. Beware: Quizzing objects can use another style.

  • Can I universally change the title styles in my iMovie? I don't want to retype everything in the new style!

    Can I universally change the title styles in my iMovie? They're all set in "Lower Third" and I need to change all of them to "Gradient White" and I don't want to retype everything in the new style! It'll take forever, as I have many titles in this movie.

    Interesting.  http://help.apple.com/imovie/mac/10.0/#mov9c5e9641f  describes how to change a title.  I tried selecting 2 titles then chaging the style but it didn't work for either.  So it seems the answer is no (though it should be yes).
    Geoff.

  • Changing the title of the Command Window

    How do i change the title of the command window form "C:\Programs\jdk1.2.1\bin..." etc to something more useful like "MyProgram"?
    Many thanks
    Cath

    What I amproposing is that if we all merge on the same chapter and examples then we can ask each other specific questions and all have the same benchmarrk and reference points!!
    I plan to advertize this on other lists and if we all use the same text then we are all the much further ahead instead of having questions from all sorts of text and nobody knowing what the other is doing and having completely different code and examples!!
    What do yu guys think?
    Personally, I am in chapter 8 just staring SWING. But I don't mind going back to the first part to help othere newbies (as long as we have the same text and the examples are from the text).
    For example, I have modified example 8-1, so that instead of just showing colors in the background, the buttons show a photo with text, shows text and changes the background, and will do something else ( don't know what yet)! But the whole thing is still based on the example code on page 323.
    I had some problems trying to figure how to do this... but if we all work on projects that are based on the code examples for the same text, we stand a better chance of all learning faster...
    So Yes, it is a study group using emails or chats...forum.
    The main difference is that if a person needs help we can all share code with them (NOT NECESSARILY DOING THE PROJECT...unless you wan to) but with the same book {Core Java2-Fundamentals or Core Java2- Advanced Programming} and with the help of at least one senior programmer that we have on the thread already ... with the otheres like you that want to join...all using the same book....Then no matter what project you are working on (from the book or work or school) we all have the same text to help each other and to reger each other to.
    Moreover, there never need to be another instance where the answer comes back: "read the tutorial" or check the docuemtation.... Those are good answers if you know what you are lloking for...but sometimes a person may need an example in working code.... and the tutorials don't answer specific questions where a person may not quite understand.
    So,
    why not stop by the New Study group that is going?...you can find us in forum New To Java Technology
    under the thread of "is anyone learning Java using the Sun Microsystems book...."
    In the meantime.... the person that was asking for hel here has not posted anything ... So I wonder if she realy wanted help?
    I will hang out here fopr another day or so and see if she answers my questions to her .. If nt then i will assume that this is a dead thread and I will no longer be here. You know where you can find me....
    phil

  • Changing the title of multipel documents

    Hi there Apple fans.
    I was wondering if there is a way -- with Applescript (or some other tool) -- to change the title of multiple documents.
    You see I have about 800 "songs" from and Audiobook. And they are called *"The Dark Tower VII - The Dark Tower 001..002..003.. (all the way too 800)"*. It's like this, The Dark Tower is a series, and this is the seventh book, which is also called The Dark Tower.
    And what I want to do is to have them called just *"The Dark Tower 001..002..003"*.
    This is annoying because when I am viewing the files in my iPod, only half the name is shown, *"The Dark Tower VII"* not the file number. So it is a hard time trying to find where you are, which file you are on.
    For Finder documents this is easily done with Automator. Just rename and then use sequence. But there is no such option for iTunes.
    I am almost positive that there should be some way to do this with a rather simple Applescript script. Unfortunatly, I have almost no knowledge of scripting.
    If anyone has any idea please post them here.
    Thanks.

    Maybe you did not understand.
    I want to go from this:
    My Audiobook - Track nr 1
    My Audiobook - Track nr 2
    My Audiobook - Track nr 3
    My Audiobook - Track nr 4
    My Audiobook - Track nr 5
    My Audiobook - Track nr 6
    To this:
    Track 1
    Track 2
    Track 3
    Track 4
    Track 5
    Track 6
    Understand? Please help.

  • Why can I not change the title of the album name after updated ipod to ios 5?

    After updated my ipod to ios 5.0.1 i lost my music, so I got it back but I want to change the titles, artists, or album name.  So I right-click a song and then I click on get info and do all my changes, but whne I press ok, I look on my ipod and it didn't change.  What is wrong?  What do I do?

    Have you tried unsyncing the music and then resyncing?  You problem is very commom after iOS 5

  • Change the title of a report dynamically

    Hi all,
    I have a report which does both download and upload activities.
    Then we have two TCODES based on which download and upload happen.
    My requirement is based on the two TCODES, I need to change the title of the report dynamically.
    Thanks and regards,
    Anishur

    Hi ,
    Set your title bars based on the condition.
    Created 2 title bars and use it
    INITIALIZATION.
      IF tcode = 'TCODE1'.
        SET TITLEBAR 'TCODE1'.
      ELSE.
        SET TITLEBAR 'TCODE2'.
      ENDIF.
    reward if usefull.
    Taher

  • Working with a projector file. How can center it, not allow scaling and change the title bar?

    I've tried using:
    import flash.system.fscommand;
    fscommand("allowscale", "false");
    fscommand("showmenu", "false");
    fscommand("fullscreen", "false");
    on frame 1, but they don't seem to work.  I'm going to be putting this project on a CD and the client wants to make sure it will open centered on the user's screen, which has not been the case so far.  It seems to open at different spots on different computers.
    They also want the title bar changed from "Adobe Flash Player 10" to their own title.
    Thanks in advance for the help.

    hkunz219 wrote:
    You can use: stage.scaleMode = StageScaleMode.NO_SCALE; As for the title bar change, you can change the title bar string using Resource Hacker. But i am not sure if that is legal. You will find the strings under the strings table.
    What did you mean by, "You will find the strings under the strings table."?  Were you talking about Resource Hacker?

  • How do I change the title FAQ to Knowledgebase?

    We've widened the use of the FAQ (module) to be a knowledgebase.  But, we have not been able to change the title on the detail page from FAQ.
    Is there a way to change the title?

    Batch renaming is not yet implemented in Photos. As a work-around for now you can search for Automator scripts that will do it.
    Sort order of Album list, Album contents and Folder contents can be changed by checking or unchecking the Keep Sorted By... option under the View menu. I know, very limited options...
    You can request features, point out bugs, etc, at Apple Feedback pages: 
      http://www.apple.com/feedback/
    Or directly for Photos:
    https://www.apple.com/feedback/photos.html

  • How can i change the title and image of  published exe

    Hi ,
    I have published a fla file in exe format .
    how can i change the title and image of this exe? do I ve to
    use some of the available softwares in the market? cant i do the
    customised setting in the flash player itself?

    On Fri, 4 Apr 2008 06:21:15 +0000 (UTC), "mFlexDev"
    <[email protected]> wrote:
    > I have published a fla file in exe format .
    > how can i change the title and image of this exe?
    I beleave the easiest way is to use PEResourceExplorer,
    Resource
    Hacker or similar software to modify EXE resources, such as
    window
    title and window icon.

  • How to change the title of a block/form/table in the WebIC CRM 2007 ?

    Hi,
    We want to change the title of a block in the work area for example from 'Account details' to 'Partner details'.
    After investigation we think that we have to change the text in SOTR_EDIT transaction by editing the Alias or defining a new one with the desired title.
    The problem is that when we search for the alias in the OTR maintain initial screen , we get a list and we don't know which one is the alias associated to the title of our view..
    Is it the right way to proceed or is there any other solution ?
    Your help is highly appreciated.
    Regards
    Nabil.

    Hi Nabil,
    Its so simple,
    Go to the Component/ View : BP_HEAD/BPHEADOverview
    Click on the CONFIGURATION tab.
    Alt+Click on the BP_HEAD : AccountViewSet : Account Details
    Juss Change the Title Account Details to Partner Details.
    That's it. Your block title is changed now from Account Details to Partner Details.
    Best Regards,
    Shiven

Maybe you are looking for

  • Cannot copy file from desktop to media card

    Whenever I try to copy a file from my desktop to my media card I get an error. When I use the desktop manager software I get the message 'one or more files cannot be copied: FILE_NAME'. When I use Windows Explorer to try the same thing I get the mess

  • Open And Edit Word File In SharePoint Site Programmatically (Without Save On Local system)

    Hi Sir ,          I am working as sharepoint developer. I have face some problem in Edit and open document file in sharepoint site programmatically. I want to open file and edit directly in sahrepoint site without save in local system,      Issue:  

  • Windows 7 Ultimate (64-bit) Create a System Image Failure (error code: 0x80780119)

    Hello, I recently bought a new 1 TB hard drive, and I want to move everything from my original 250 GB to the new one. I have read from numerous sources that Creating a System Image through Windows 7, and then restoring that system image using the Win

  • OCR search in scanned PDF files

    Hi, i have some PDF files created by scanning using Adobe 5.0 ME with Arabic support. when i did OCR in those documents, English search is OK and Arabic is not OK. Also when i copy paste Arabcic text, it shows junk characters. if any one have same su

  • Adding content from a database

    Hi there, I'm looking for a way to add content to a JComboBox from a database. I have the code to connect the database to my application working fine but am struggling to find the appropriate way to make my JComboBox display data from my database. I'