Refresh a JPanel every time.

Hi,
How can you refresh a JPanel every time you invoke this JPanel?
I have a Swing Application with a JSplitPane: a JTree on the left and a JPanel on the right. The JTree is used as a menu to display the right JPanel on the right. At this moment, the JPanels will only be created when I start the Application, so not on every time when I click on the JTree. Is it possible to get a new instance of the JPanel every time I reach it from the JTree (or at least get a trigger so that the latest information will be shown)?
I hope someone can help. Thanks!
Tongue78.
|JTree                |  Place to show the JPanels  |
|  ShowJPanel1  |                                           |
|  ShowJPanel2  |                                           |
|  ShowJPanel3  |                                           |
|                        |                                           |
|                        |                                           |
--------------------------------------------------------------------

A problem usually becomes easier when you disregard technical specs for a moment and think about it from a functional standpoint. In this case it would be something like "when I click on a node in the tree, I want to display a specific panel", right?
For your right panel, check out the CardLayout. It allows you to put multiple panels in the same space, while only one is visible at a time.
For the JTree, check out the event listeners that are part of Swing. A MouseListener for example will allow you to listen for mouse clicks on a certain component, so the start would be to install a mouselistener in the JTree.
A google search for something like "java JTree node mouselistener" will probably get you further on this subject, for example to get sample code how to get the currently selected node.

Similar Messages

  • Have to refresh Yahoo bookmarks every time Firefox starts for it to open

    Every time I start the 4.0 Firefox I have to refresh the Yahoo bookmarks several times for it to open completely for them to
    become usable

    I dont use tabs and only use the Yahoo toolbar bookmarks(about 200)they dont show up in the Firefox or IE bookmarks.After starting Firefox from being offline
    these dont open.From the pulldown button in the toolbar I go to tools>then refresh bookmarks sometimes several times for them to open all the way for normal use.It was'nt until the more recent updates this started happening.Another thing started happening at the same time in the Yahoo mail when trying to delete mail from the spam and trash folders when you select all>delete the cursor would go right to the to the OK button.Now I have to drag
    it to the button.this only happens in Firefox in Yahoo mail.
    Thanks for your fast reply

  • Premiere Pro 6 refreshing capture device every time I change from source window to timeline.

    I have an external audio device/interface connected with a firewire. Premiere sees this as a DV/HDV capture device and everytime I flick from the source monitor to the timeline (umpteen times a minute) the audio device restarts causing a complete system freeze for 10 seconds. I can no longer edit with audio through my speakers because of this.
    I've tried changing the capture device in the preferences to None, but as soon as I go back to the preferences it has changed itself to DV/HDV.
    I'm using Premiere Pro 6.0.1 on a Mac OSX 10.6.8. The device is a PreSonus Firefox audio interface.

    Thanks Admiral Cook. Looking through your post, I played around with some settings and now my delay is only 2-3 seconds when flicking through panels. I set the audio hardware and mapping to System Default instead of my external firewire device.
    But still, a 2-3 second delay when switching back nad forth through panels? Really?

  • Same Image every time in JTextField with HTMLEditorKit and HTMLDocument

    Hi all
    I have a JTextPane with HTMLEditorKit as editorkit and HTMLDocument as document. I am trying to load an html file into the text pane. the html file contains image. When loading first time it is shown perfectly. After I change the image file with other file with the same name(overwrite it) and trying to load the html file again,the image is the first time loaded image. As i think the image is kept somewhere in "cash" or kind of that. But I need to refresh the html every time it is loaded and not to read from "cash".
    And code which i use:
    package client.temp;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextPane;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.html.HTMLEditorKit;
    public class TestPanel extends JPanel {
    public TestPanel(File htmlFile) {
    JTextPane textPane = new JTextPane();
    JScrollPane scrollPane = new JScrollPane();
    HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
    HTMLDocument htmlDocument = new HTMLDocument();
    setLayout(new BorderLayout());
    scrollPane.getViewport().add(textPane, null);
    add(scrollPane, BorderLayout.CENTER);
    URL baseUrl = null;
    try {
    baseUrl = htmlFile.getParentFile().toURL();
    } catch (MalformedURLException e) {
    e.printStackTrace();
    htmlDocument.setBase(baseUrl);
    textPane.setEditorKit(htmlEditorKit);
    try {
    FileInputStream fi = new FileInputStream(htmlFile);
    InputStreamReader isr = new InputStreamReader(fi, "UTF8");
    BufferedReader r = new BufferedReader(isr);
    htmlEditorKit.read(r, htmlDocument, 0);
    r.close();
    isr.close();
    fi.close();
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    } catch (BadLocationException e) {
    e.printStackTrace();
    textPane.setDocument(htmlDocument);
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton b = new JButton();
    b.setText("push");
    b.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    TestPanel panel = new TestPanel(new File("c:\\temp\\temp.html"));
    JFrame fShow = new JFrame();
    fShow.getContentPane().setLayout(new BorderLayout());
    fShow.getContentPane().add(panel, BorderLayout.CENTER);
    fShow.setSize(800, 600);
    fShow.setVisible(true);
    frame.getContentPane().add(b);
    frame.pack();
    frame.setVisible(true);
    and here is the html file structure of my temp.html file
    <html>
    <body>
    <p>
    <img src='image01.jpg'>
    </p>
    </body>
    </html>
    the folder in which the temp.html located (in my case c:\\temp\\) contains image01.jpg file too.
    The piece above works correctly when clicking on the button first time.i.e. shows the image01.jpg correctly. After closing the showing frame fShow(not exiting application) and replacement of the image01.jpg by other file named image01.jpg, but with other content and clicking button again shows the first image again.If I exit the application and start again the picture is shown correctly.
    I need this because I am getting images from database while the template is same always.
    Thanks in advance.

    URL baseUrl = null;
    try {
    baseUrl = htmlFile.getParentFile().toURL();
    } catch (MalformedURLException e) {
    e.printStackTrace();
    htmlDocument.setBase(baseUrl);All you want is to defeat the cache. You could do it using random number generation.
    String newURL = htmlFile.getParentFile().toURL().toString();
    String rand = "rand="+new java.utl.Random().nextLong();
    if ( newURL.indexOf("?")>=0)
    newURL +="&"+rand;
    else
    newURL +="?"+rand;
    baseURL = new URL(newURL);
    htmlDocument.setBase(baseURL);
    This will ensure that u are using different url everytime.(well mostly!)

  • Is FF clearing the cache every time it closes?

    if so, i need to stop it.
    some of the pages i regularly frequent have to re-download all the images and stuff (as if i refreshed the page) every time i go back to them, and this is a problem cuz i have a slow connection and they're pretty graphics-intensive.
    i really need to utilize the cache.
    thoughts?

    There is software like Advanced SystemCare with its Surfing Protection feature that can protect files in the Firefox profile folder against changes.
    If you have such software then check the settings or uninstall this software.
    If you do not keep changes after a restart or otherwise have problems with preferences, see:
    *http://kb.mozillazine.org/Preferences_not_saved

  • How do I make a web page that changes every time the user refreshes it? Is it possible in Muse?

    Hi, i'd like to make quite a simple website where the main text in the centre of the page changes every time the user refreshes the page in their browser. I assume i'll have to make one master, and multiple pages that are all the same except for the changes in the text, but i'm not sure how to make it so that every refresh directs to a different page and not just the home page? Is this even possible in Muse?
    This is an example of what i'm going for: :: procatinator ::
    Thanks!

    You can't do it with Muse alone. Would probably be fairly simple to do with a bit of Javascript. Check the widget directory as it is possible someone has made a widget for random content. If not, maybe I will make one this weekend. ;-)

  • N8 music player has to refresh library every time ...

    N8 music player has to refresh library every time after switching on the phone. why?

    How do you try to start the repair dialogue? By starting Aperture or by opening the Library?
    If you not already have tried it with directly opening the library: 
    reveal your Aperture Library in the Finder
    Whilst holding down Command(⌘)- option (⌥) double click on the Aperture Library.
    Select "repair library" from the dialogue.
    What about Frank Caggiano's questions above?
    It would be really helpful to know, how many libraries you have, and if this problem is restricted to one of them.

  • I need to refresh my wifi conection every time way?

    Every time i use my ipad i must refresh my wifi, wasent like that earlyer

    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    Change the channel on your wireless router. Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    Another thing to try - Go into your router security settings and change from WEP to WPA with AES.
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • How do I set the options to check for newer versions of stored pages so I get a new refreshed version every time I visit a web page?

    I can do this in IE easily but can't find any place in Firefox for this setting. Every time Firefox starts and/or I visit previously viewed pages I want Firefox to refresh the page. It used to do this before I downloaded a new version of Firefox within the past couple months. (I wish I had not installed the new version, I really don't like it as well and I lost features I used.)

    See:
    *http://kb.mozillazine.org/browser.cache.check_doc_frequency
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    *Use the Filter bar at to top of the about:config page to locate a preference more easily.
    *Preferences that have been modified show as bold(user set).
    *Preferences can be reset to the default or changed via the right-click context menu.

  • Refresh every time

    Hi Gurus,
    we recently upgraded to 11.1.1.6.1 from 10g and in one of my dashboard we have navigation to detail report it worked perfectly in 10g but after upgrade we observed that when opening the page links are coming but when pressing the link navigation not working so I refreshed the page using PAGE OPTIONS-->REFRESH then every thing is working fine...I have to do this refresh every time when opening page first time..why it is behaving like this?any solutions..or if its known issue please share bug/note ID..
    thanks in advance...

    User wrote:
    Hi Saichand,
    Thanks for ur reply..
    Is there any bug id do you have?what patch we need to apply to solve this problem.I would assume you have to apply BP1 to get rid of most of the bugs you will face in 11.1.1.6.0.
    For more information, refer to this link: ( http://www.rittmanmead.com/2012/07/applying-patches-to-obiee-11-1-1-6-2-bp1/ )
    Thanks,
    -Amith.

  • How to disable refresh every time I write code in dreamweaver

    Hi....how to disable refresh every time I write code in dreamweaver...thank very much.

    Hi.......every time I write code or content on the web, from interfce code, I get a message on the bottom of the program, with a button that says "refresh"... please look the attach picture .... thanks for helping me ....

  • Refresh UWL every time a action is done

    Hello Portals specialists,
    I've a small issue about UWL.
    I've configured refresh time to 1 minute in the personalization. But I want to have a automatic refresh, when I log in and when I manage a task.
    In fact, each time a action is done (logging, navigation, completing a task, ...) the UWL must be refresh...
    I've try to change the delta pull time, the refresh parameter in the XML definition of the UWL. Nothing works.
    Thanks for your help.
    Regards.
    Olivier.

    Hi Oliver,
    I had a smiliar requirement, where the work items has to be refreshed every time i log into Portal. Even though there was refresh button the client wanted to refresh the work items evry time he logs in.
    Please check the following link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/eb/101fa0a53244deb955f6f91929e400/frameset.htm
    Else on R/3 side you have to maintain Schedulers.
    Hope it helps.
    regards
    Anil

  • How do I make FF4 stop asking me to ok every time facebook (or any other site) 'redirects' (refreshes, in reality, but it says redirect)?

    Every time a page refreshes (particularly facebook), firefox interrupts whatever I'm doing (even if ff is minimized) and makes me 'ok' it! Are there any fixes for this? I've already told ff4 to not warn me when a page attempts to redirect, but it does it anyway.

    Do you have that problem when running in the Firefox SafeMode?<br/> ''A troubleshooting mode.''<br />
    You can open the Firefox 4.0 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut. Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut to open it again.''
    If not, see this: <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • Every time i go on net or refresh "eval test" comes up what is it and how do i get read of it?

    "eval test" comes up every time i refresh or go on the net and have to click serveal times on the ok for it to let me on the page i want go or i m on

    It places a cookie on your Mac, for what purposes who knows.
    Get rid of it: click Remove and then Done.
    Or just use the Safari menu > Reset Safari...
    Make it look like this:
    Click Reset and forget you ever saw it.

  • How can you make an image change every time you refresh a page?

    Hi.
    I've recently redone my website and was wondering how I could make the image on my main page change every time you refresh the page?
    Like is there a certain script you can use?
    Here's my website
    www.liamfawcett.com
    Thanks

    Copy & Paste the following JavaScript code between the <head> and </head> tags in your HTML document, in Code View of course.
    <script type="text/javascript">
    <!--//Random Banner image on Page Reload
    //store the images in arrays below
    images = new Array(5);
    images[0] = "<a href='http://www.example.com'><img src='some_image.gif' </a>";
    images[1] = "<a href='http://www.example.com'><img src='some_image.gif' </a>";
    images[2] = "<a href='http://www.example.com'><img src='some_image.gif' </a>";
    images[3] = "<a href='http://www.example.com'><img src='some_image.gif' </a>";
    images[4] = "<a href='http://www.example.com'><img src='some_image.gif' </a>";
    index = Math.floor(Math.random() * images.length);
    document.write(images[index]);
    //done
    // -->
    </script>
    In the array, change URLs (http://www.example.com) to your own links.  Change images (some_image.gif) to your own images.
    Save page.  Preview in browser.  Hit refresh (F5 or Ctrl+R) to see the images change.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

Maybe you are looking for