Is there a way for java plug-in to get the browser login authentication

I have an applet that is loaded from a password protected html page. I use java plug-in with the applet.
When I try to read this page I get the browser window asking for password and username. So far so good.
Then I log in successfully and starts using the applet.
If the applet wants to access pages on the same PW protected area, I have to give the plug-in PW and UN.
My question is then:
Is there a way that java plug-in can get hold of the login information that the browser has obtained? (So that I wont have to give the same information twice)
I thought the answer would be no, but then I started experimenting with https and found out that if I use the same scenario as above, except from that I give a certificate to the browser before the first login, then the plug-in will get certificate info from the browser, and it wont promt me for UN and PW either!
When it is possible for the plug-in to obtain certificate info and login info from the browser then it should be possible just to get the login info with ordinarily http?

bump

Similar Messages

  • Is there a way for a developer to detect if the Java plugin was blocked?

    For best UX in my web application I'd like to know if Java has been blocked because of security vulnerabilities.
    If it's been blocked I'd like to show m own message that Java is out of date and they should update.
    I don't want to show it everytime Java is out of date since it's only important for me and the user if there are security vulnerabilities. If Java version is not known to have vulnerablities I don't want my users to be disturbed by additional messages or steps reguired to update Java.
    Is there a way to detect using Javascript if Firefox blocked a plugin because of security vulnerability?

    Thanks for the reply.
    I have already seen this page but my applet doesn't have a visible area. It's just for communication with external devices and it interacts with Javascript. In my case it doesn't look like in the link.
    Fortunately in new version of Firefox a large modal appears with option to update Java which is quite OK. I am only affraid that if there are no new versions of Java Firefox will display this small dropdown in the top left hand corner which our users tend to miss.

  • Is there a way for users to add products in the front-end using a Web-App?

    I am racking my brains trying to figure out a way to let users add products to the front-end on their own.
    I am building a site for a client who needs users to be able to create there own storefront, kind of like ebay. Here is exactly the functionality I want: Supplier Frontend Products Upload - Magento Connect
    There HAS to be a way to do this with a web app even if it means writing in some code...can anyone suggest a way to do this?

    In short, out of box no, but is possible.
    Solution 1: Hosted on BC, external interface that interfaces with BC API, requires external hosted server.
    Solution 2: Wait until v3 of the API comes out... no timeline from Adobe given. This would remove the need for the external API server.
    Can do both solutions for you but solution 2 wont work until adobe allows it.

  • On the Firefox drop down menu for Firefox 4, the tab for cut, copy and paste is not highlighted. Is there another way for me to include this on the Firefox start page?

    I have Firefox 4. In the Firefox drop down menu, there is an option to cut, copy and paste but it is not highlighted. Please tell me how to highlight this link. Or is there a way to have a cut copy and paste tab?

    Those links in the Edit menu are only highlighted if there is something to do:<br />
    Paste should be enabled if the clipboard has data placed on it by a previous Copy or Cut and you have set focus on a text area or field that allows to paste that data.
    Copy works if some text is selected.

  • Is there any way of storing audio- / video-elements in the browser cache in Safari in iOS?

    Hi there,
    I'm desperatly trying to find a solution for a web application that has to run on an iOS-Safari (e.g. on iPad, iPad2 and iPhone 4):
    It's a web-application I wrote some time ago which lets the user search for and listen to short music samples (MP3s, all from ~100 kB to ~1.5 MB). The audio player is Flash-based, so it doesn't work on iOS-devices at the moment and I'll have to implement an alternative either in HTML 5 or with a "direct" QuickTime-object.
    Both my HTML 5- and QuickTime-alternatives for iOS-devices work fine so far, but there's one major problem I can't find a solution to:
    Unlike Flash and most HTML 5-capable browsers on Windows Safari on my iPad 2 won't store the audiofiles in the browsercache after loading and playing them - neither with HTML 5 audio-tags nor with a QuickTime-Object. Every time I load an audio file for playback from the server (with JavaScript-Commands, so without changing or reloading the whole page) it's downloaded again completely.
    If a user listens to sample A and then to sample B, Safari forgot about having played sample A and downloads the whole MP3 again if I like to listen to it again. On a mobile device with a potentially narrow bandwith this behaviour is out of the question.
    Is there a way of storing downloaded audiofiles opened by HTML 5 or QuickTime in Safari's cache so it remembers already having downloaded them  -  like it caches usual "web-files" like HTML, CSS or JPEG-images, or like Flash stores such objects in its local cache?
    The Application Cache with a manifest-file is not an option - this only seems to work if the browser is offline, for example if the iOS-device is in "Airplane"-Mode.

    Yes, I watched it. It contains interesting stuff I have to admit I didn't know yet, but unfortunately I still can't find a solution to my problem:
    My first attempt was trying to use the Application Cache with a manifest file - although this is not really the intended purpose for my application... I don't have a static set of files that I want to have cached or "available offline"  -  I just want to cache MP3s which the user has played yet.
    It should be possible to use a "dynamic manifest": One that is parsed by the Apache PHP module and listing the files played so far from a PHP session - something like this:
    <?php
    session_start();
    header("Content-Type: text/cache-manifest, charset=UTF-8");
    echo "CACHE MANIFEST\n";
    foreach($_SESSION['playedSongs'] as $song)
        echo $song."\n";
    ?>
    So whenever a song is loaded / played, I could access the PHP session with AJAX, insert the filename of the played file and manually update the manifest by calling window.applicationCache.update().
    There are two problems with this:
    First of all: It doesn't work. And I didn't even get to the point of trying to use a dynamic manifest:
    <!DOCTYPE html>   
    <html manifest="cache.manifest">
        <head>
            <title>Test</title>
            <script type="text/javascript">
            function playStuff(id)
                if(id == 1)
                    window.document.getElementById("audio").innerHTML = '<audio controls preload="automatic" autobuffer><source src="song01.mp3" type="audio/mp3" /></audio>';
                else if(id == 2)
                    window.document.getElementById("audio").innerHTML = '<audio controls preload="automatic" autobuffer><source src="song02.mp3" type="audio/mp3" /></audio>';
            </script>
        </head>
        <body>
            <div id="audio"></div><br />
            <br />
            <input type="button" value="playStuff(1)" onclick="playStuff(1)" />
            <input type="button" value="playStuff(2)" onclick="playStuff(2)" />
        </body>
    </html>
    The cache.manifest looks like this:
    CACHE MANIFEST
    song01.mp3
    song02.mp3
    and is properly returned from Apache as "text/cache-manifest" by adding
    AddType text/cache-manifest manifest
    to the .htaccess of this directory.
    The Apache-logs clearly show that the Safari (respectively "AppleCoreMedia") doesn't care about the application cache when it comes to audio-files:
    Safari itself seems to acknowledge the manifest and indeed preload the files:
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/index2.html HTTP/1.1" 200 2619 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/cache.manifest HTTP/1.1" 200 79 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/cache.manifest?%3E HTTP/1.1" 200 79 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/song02.mp3 HTTP/1.1" 200 120525 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    192.168.0.40 - - [23/Jul/2011:12:45:46 +0200] "GET /websql/song01.mp3 HTTP/1.1" 200 120525 "-" "Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5"
    Up to this point I did nothing but opening my test-application in Safari.
    Playing song01.mp3:
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:25 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:29 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:47:29 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song2.mp3:
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 2 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:04 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:05 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:05 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song1.mp3 again:
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:38 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:40 +0200] "GET /websql/song01.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:48:40 +0200] "GET /websql/song01.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Playing song2.mp3 again:
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:12 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:13 +0200] "GET /websql/song02.mp3 HTTP/1.1" 304 - "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    192.168.0.40 - - [23/Jul/2011:12:49:13 +0200] "GET /websql/song02.mp3 HTTP/1.1" 206 120525 "-" "AppleCoreMedia/1.0.0.8J2 (iPad; U; CPU OS 4_3_3 like Mac OS X; de_de)"
    Every file is downloaded again completely when playing it. So "AppleCoreMedia" (whatever this may be exactly, the QuickTime-plugin that is triggered by the HTML 5 audio-element I suppose?) either doesn't have access to the Application Cache or simply just doesn't realize the files in it. So if I switch my iPad to "Airplane Mode" now, the Safari is unable to access / load / play the files.
    I also tried using a QuickTime-object instead of an HTML 5 audio-tag (as far as I know HTML 5 audio and video in Safari always use QuickTime?) and controlling it with something like:
    document.movie1.SetURL('song02.mp3');
    Nothing changes, it's just like using HTML 5 audio and everything gets downloaded again when loading/playing it.
    And even if this would work there'd still be a problem:
    To properly implement that I would have to load the MP3-file in the Application Cache before playing it. When doing this it seems impossible to show a "real" progress: The ProgressEvent that is fired from the Application Cache after updating it doesn't seem to provide any information about data loaded so far and the complete size of a file. It's just "File 1 from 2" and so on, and not a "real" progress where I could determine something like: "100 kB of 1.2 MB loaded" as I can with the audio-element.
    All the other storage-approaches like Web SQL / Web Database or Local Storage are no help either:
    I don't see any way of getting the MP3 data into Local Storage or Web Database or getting it out again to play it. The HTML 5 Canvas-element has a toDataURL()-function to produce a Base64-encoded representation and use it for storage  -  the Audio-element doesn't seem to have anything like this.
    My last really "dirty" approach was trying to load "manually" Base64-encoded-MP3s with a combination of AJAX and PHP: A PHP-script outputs a Base64-representation of a MP3-file and is loaded by AJAX, so I could store the Base64-representation e.g. as Local Storage or in Web Database:
    <?php
    $infile = 'song01.mp3';
    $contents = file_get_contents($infile);
    $base64 = base64_encode($contents);
    $audio = 'data:audio/mp3;base64,'.$base64.'';
    echo $audio;
    ?>
    I tried using the resulting AJAX responseText as the source-argument in an audio-source-tag. Suprise: It doesn't work in Safari on my iPad 2, the player just fails to load the "file", although this works fine in Chrome on Windows. Possibly a size limitation for Base64-URIs on Safari / iOS.
    And again: Even if this was working in iOS/Safari I don't know of a way to determine a real progress from an AJAX-query...
    The last thing I could think of is not replacing the audio- or source-tags when loading a song but leaving them in the DOM-structure, check if it's already there when a song is loaded and just add a new audio-tag if a song hasn't been loaded yet.
    This solution would be my last resort: I'd have to rewrite nearly the whole application to completely operate on JavaScript / AJAX to stay on one site in the browser - else the "cached" audio data would be lost again when changing to another site in Safari.
    Furthermore I think there'll be a small cache limit somewhere when doing this?
    Any ideas?

  • The new version has made it hard to easily view recently closed tabs. Is there a way to restore that part/function of the browser?

    In the older version (do not know which number), there was an easy way to view all the recently closed tabs from a drop-down menu, which could be accessed from the top-left of the browser.
    Now, you have to go to History>View History Sidebar. And even then, there is no view for the recently closed tabs.
    I liked the simplicity of being able to see the last tab that had been closed, and the one before that, and the one before that — all in chronological order. Now, there is no way to tell which tabs/links were closed when.
    I hope this makes sense. ... I even installed a few add-ons to help me with this issue, but they didn't do the job quickly and easily.

    That's not bad, but it does not give me control over opening the exact tab I need. I assume this opens all tabs that were closed in any given session? That could be a lot of tabs. I do miss the fine-grained control and convenience of the older version. Sorry, I sound picky, but this issue has really affected my browsing and working experience quite a bit.
    Anyway, thank you for your time and help, Philipp.
    Hopefully the developers will put it back in at some point.

  • I purchased music that is not the artist I wanted, but a cover band doing their versions of the songs.  Is there any way to return that purchase and get the original bands music.

    Is there a way to undo an Itunes purchase.  I mistakenly purchase a cover band songs not the original bands greatest hits?

    i dont think so if you comfirmed your purchase i think your stuck with it sorry!

  • Is there any way to prevent misbehaving solved by refreshing the browser?

    When I play my published Captivate 6 file in the browser (in this case Google Chrome), it sometimes gets "stuck" --- rollovers don't  work properly or buttons don't show up when they are supposed to. Sometimes I get the audio echo problem where audio from some previous slide plays on a future slide). None of these things happen during previews.
    If I refresh the browser and then continue where I left off, the problems are gone.
    What is causing this awful behavior? I am afraid I am disappointing my client, which I never want to do and have never done in the past!  We will have to publish instructions telling people that if anything goes wrong, they should just refresh their browsers. But some may not know how to do that, some may not read the instructions, etc. etc. causing support calls to my client and general dissatisfaction with the training.
    Is this just a shoddy product or did I not do something I need to do to get it to behave itself?
    Please advise! Thank you,
    Ellen

    hmm the a64 is locked so you cannot use a cpu multipier to have only cpu go faster..
    i oc with the fsb....but noticed that i may actually be over running my power, at high oc's(233)  if i unplug at least 3 hard drives, and some fans it will run microsofts memmory tester...but not with them in.
    you may be able to oc if you drop your mem speed down in bios to 333 or 200.
    so when you oc the memm will clib from there...i have seen good results from that.
    one person was able to catch my 232 results from dropping down to 200 mem speeds.

  • Is there a way for a SR Task to update the Install Base Status instance to Active

    Release 12.1.3
    When a field service install task is closed is there anyway for the Install Base instance on the SR to have its status updated to "Installed"?

    Thanks Shachar. 
    I had tried using AEGP_GetEffectParamUnionByIndex and forgot to mention that in the original post, oops!
    After you suggested it, I looked over it once again, but still couldn't find any promising/useful attributes.
    It seems that the structs returned within the union don't have a parking spot for the ui_flags.  I double checked this in AE_Effect.h, and it matches up with what I'm seeing in the xcode debugger.
    Heres one example (Checkbox rom AE_Effect.h):
    /** CheckBox -- PF_Param_CHECKBOX
    typedef struct {
      /* PARAMETER VALUE */
      PF_ParamValue value;
      /* PARAMETER DESCRIPTION */
      PF_Boolean dephault;
      A_char reserved; /* padding */
      A_short reserved1;
      union {
      const A_char *nameptr;
      } u;
    } PF_CheckBoxDef;
    So, they have a few attributes (name, default values, and current value) but no ui_flags.  Bummer!
    -Andy

  • My Telus wireless only works with WEP, but if I switch to WEP the wireless goes down on the other Windows computer being used in the same house.  Is there a way for both of us to get wireless internet or do one of us have to be connected by the ethernet?

    My Telus wireless only works with WEP, but if I switch to WEP, the wireless on the other computers in the house (which is Windows and WPA) stops working. My computer works with the ethernet cord but I want to be wireless too!  Do one of us have to sacrifice our wireless?

    For assistance in getting your MacBook to connect to a WEP-protected wireless network, please check out this Apple Support article: AirPort: Joining an encrypted WEP or WPA Wi-Fi network

  • Is there a way for me to purchase something from the Canadian store if I am a US customer?

    Has anyone found a way to make purchases from the Canadian iTunes store if a US customer? A show I watch is available from the Canadian store, but not the US store.

    The Governments will soon require people to have microchips inside their bodies to make sure they are not terrorists. To know their age, health status, where they live, where they are now, what are their displacement, etc..
    And The People will like that!
    The Future is a "WONDERFUL WORLD".

  • Is there a way to find out how to get the index of a column?

    Hello,
    I want to know the index of a column for example the column at the first position in a jtable is 0 so how can i get this index?
    for example: the column called "surname" is index 0 but the user can move the column. So the name stays the same but the index of the column changed. I search for a method like
    table.getColumnIndex("surname");

    I think it really depends on what the OP is trying to do. I think the program
    below offers up the possible choices pretty well.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TableColumnIndexDemo extends JFrame {
         private JTable table;
         private String[] names = new String[]{ "One", "Two", "Three", "Four", "Five" };
         public static void main( String args[] ) {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new TableColumnIndexDemo(); }
         public TableColumnIndexDemo() {
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              DefaultTableModel model = new DefaultTableModel( names, 1 );
              table = new JTable( model );
              JButton button = new JButton( "Print indices" );
              button.addActionListener( new ActionListener() {
                   public void actionPerformed( ActionEvent e ) {
                        printIndices();
              getContentPane().setLayout( new BorderLayout() );
              getContentPane().add( button, BorderLayout.NORTH );
              getContentPane().add( new JScrollPane( table ), BorderLayout.CENTER );
              getContentPane().add( new JLabel( "Move columns around then print indices" ), BorderLayout.SOUTH );
              setSize( 300, 150 );
              setVisible( true );
              printIndices();
         private void printIndices() {
              TableColumnModel columnModel = table.getColumnModel();
              TableModel model = table.getModel();
              StringBuffer sb = new StringBuffer();
              System.out.println( "Visible order");
              for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( k ).append( " " ).append( columnModel.getColumn( k ).getIdentifier() );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "By name using getColumnIndex(TableModel,name)" );
              for( int k = 0; k < names.length; k++) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( getColumnIndex( model, names[k] ) ).append( " " ).append( names[k] );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "By name using columnModel.getColumnIndex(name)" );
              for( int k = 0; k < names.length; k++) {
                   if ( k > 0 ) sb.append( ", " );
                   sb.append( columnModel.getColumnIndex( names[k] ) ).append( " " ).append( names[k] );
              System.out.println( sb );
              sb = new StringBuffer();
              System.out.println( "Model index by visible order");
              for ( int k = 0; k < columnModel.getColumnCount(); k++ ) {
                   if ( k > 0 ) sb.append( ", " );
                   TableColumn column = columnModel.getColumn( k );
                   sb.append( column.getModelIndex() ).append( " " ).append( column.getIdentifier() );
              System.out.println( sb );
         public static int getColumnIndex(TableModel model, String name) {
             for(int i = 0; i < model.getColumnCount(); i++) {
                 if( model.getColumnName(i).equalsIgnoreCase(name) ) {
                     return i;
             return -1;
    }

  • Is there a way for Flex to detect whether the Java Plug-In is installed?

    Hi All,
    Need your help.
    Is there a way for Flex to detect whether the Java Plug-In is
    installed? This may be require a JavaScript External-Interface. Can
    we get if the Java Plug-In is installed and if so, whether it is
    JRE 1.6.X ?
    Regards,
    Amit

    Not knowing what server your app will run on... but something
    like that can be done relatively easy serverside with for instance
    ImageMagick if you run PHP.
    Otherwise, look into Bitmap programming.

  • Is there any way for me to remove a broken audio jack stuck in my macbook?

    is there any way for me to remove a broken audio jack stuck in my macbook?

    You'll have to get a Dremel motor tool and some fine metal bits, make a jig to hold the Dremel so it's stationary, then a slider jig for the MacBook Pro so the bit can drill into the center of the stuck plug.
    Gently push the MBP against the drill bit so it drills into the stuck plug.
    Once the hole is drilled down deep enough, use some metal to metal epoxy resin to glue the bit into the drilled hole, then let it set up according to directions.
    Take a pair of vise-grips and get a good grip on the bit portion sticking out and gently pull it straight out, if you bend or twist, you can snap off the bit.

  • Is there a deconstructor for Java

    I know in C++ they use the name of the class with a tildy in front of it (~Class) for a deconstructor and VB has a method as well but I didn't see any way for Java to do this. Is there a way?

    The thing you can't invoke (in theory) is garbage
    collection. You can try with System.gc()twice
    (I'm under the impression this works), or failing
    that, you could cause an OOM exception, whichwould
    force a GC of collectable objects.That is not the same as calling delete on a
    pointer/reference. And calling System.gc to allocate
    an object should never be done. There are a bunch of
    articles that says why calling System.gc is bad.Where did I say it was good?
    You can even call the '.finalize()' methoddirectly,
    of course.That won't free the memory.
    Sorry, but you are wrong :)Sorry, you misunderstood. Read again. I never suggested anything about freeing memory. Read your own post, and consider my response...

Maybe you are looking for

  • Re. Time Capsule and WD My Book Hard Drive

    Hi, I used to have my WD My Book Hard drive connected to my IMac to run back with Time Machine. I then decided to try to change the back up to via wireless to my Time Capsule, and at the same time connect my WD My Book to the Time Capsule. Everything

  • How to make UOM as mandatory while creating PR in ME51N

    Hi all, While creating PR, UOM is not populated automatically. The PR also created without entering UOM. So, here UOM is optional. how to make this UOM as mandatory while creating PR in ME51N? Thanks pabi

  • Bug: InDesign exports completely wrong images

    Hey, when I export my EPUB, InDesign inserts wrong images into the HTML. I have a multi-artboard Illustrator file that is placed in the document. Every chapter has an image in front of it, every image is an artboard in the .ai. When I export to EPUB,

  • BI Beans catalog - other content

    is it possible for the BI Beans catalog to store other (xml) data besides presentation information. For example, can I use it deliver textual reports but use the built in permissions mechanism. Is there any code available to illustrate how this might

  • An error occurred attempting to read DynamicList

    Hi! I have a Netiq Sentinel 7.1.1.2 when I try make an dynamic list on the WEB Interface or in the control center, I see the next message error on the log: Tue Jun 03 11:45:54 CDT 2014|INFO|qtp209445166-14189476 - /SentinelRESTServices/objects/dyn-li