How to jump to dir when clicking .lnk in JFileChooser?

this java program cant do that,
who can help me to improve this code;
import javax.swing.*;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.File;
public class TestFileChooser extends JFrame{
    private JLabel pathLabel=new JLabel("path:");
    private JTextField pathTextField=new JTextField(20);
    private JButton browserButton=new JButton("browser");
    private JButton quitButton=new JButton("quit");
    private JFileChooser c=new JFileChooser();
    private TestFileChooser(){
        pathTextField.setEditable(false);
        Container cp=getContentPane();
        cp.setLayout(new FlowLayout());
        cp.add(pathLabel);
        cp.add(pathTextField);
        cp.add(browserButton);
        cp.add(quitButton);
        browserButton.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                int rVal=c.showOpenDialog(TestFileChooser.this);
                if(rVal==JFileChooser.APPROVE_OPTION){
                    File filePath=c.getSelectedFile();
                    pathTextField.setText(filePath.getAbsolutePath());
        quitButton.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                System.exit(0);
        pack();
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public static void main(String[] args){
        new TestFileChooser();
}

Subclass FileChooser and overwrite the setCurrentDirectory method with:
public void setCurrentDirectory(File dir)
File f = new File(".lnk");
ShellFolder folder = ShellFolder.getShellFolder(f);
if(folder.isLink())
dir = folder,getLinkLocation();
super.setCurrentDirectory(dir);
ShellFolder is not part of the public API, it can be found in the sun.awt.shell package, this class is availible in the Sun VMs and also the one from IBM (atleast the last time I checked it), other VMs may not have the class.

Similar Messages

  • How to aggregate the measue when click '∑' ?

    Hi Experts,
    How to aggregate the measue when click '∑' ?
    For example:
    In table view.
    A-----------A1-----------2
    A-----------A2-----------3
    ATotal-------------------5
    B-----------B1-----------2
    B-----------B2-----------3
    BTotal-------------------5
    GrTotal------------------10(It is not my expected result.)
    However, GrTotal is not my expect result, the correct result is 5 , not 10. How to implement my requrement? Thanks.

    Hi,
    If you want the result to be the average of your sub-totals (?) then I think the only way you can do is is by using a union query to give the 'illusion' of a grand-total.
    Using this mechanism you can create a grand-total using whatever logic you wish, you then just combine the result and with cunning use of headings / formatting make it look exactly like a standard functionality total.
    Helpful?
    regards,
    Robert.

  • How to make it selected when clicked and open popup

    Hi,
    I 've a form in the parent page with many form elements.
    I've 2 radio buttons with values "Yes" and "No". I am opening a modal popup when clicked on "Yes" radio button. The modal popup is opening fine.
    But when I click "Yes", it' s not selected. After modal popup is closed, when I return to parent page, the option "Yes" is still not selected.
    How to make it selected when clicked and open popup?

    Perhaps try moving the application to your preferred desktop and then right-click it's dock icon > options > Assign to This Desktop.

  • How to open an image when clicking in a word.

    Im working in a demo for an interactive book for ipad using the Digital Publishing Suite > Folio Builder and i need to be able to open a specific image when clicking in a word. I havent found any tutorial that shows how to do this can somebody please point me in that right direction?  thx so much

    Download Bob Bringhurst's DPS Tips app from the app store and/or watch my lynda.com DPS Essentials Course. If you don't have a subscription you can get a free one week trial here: lynda.com library | Trial Subscription

  • HELP! how to display an image when clicking on JLabel?

    hi. new to the forums. anyway, i need help in displaying an image.
    what i'm trying to do is when clicking on a JLabel using mouseClicked, an image will show and when the image is clicked it will disappear. i've searched and searched and have not found anything useful. thanks...

    thanks.
    searched on the setIcon, didn't find anything. btw, i know how to set the icon on the JLabel. i'm trying to figure out how i can get it that when i click on the JLabel by using the mouseClicked (or maybe even mousePressed) listener, the image pops up and when i click on the image, it closes or disappears.
    btw, i'm using the netBeans GUI builder for this. thanks again.

  • In advancedSearch , how to set retainAM=Y when click 'Go' button

    Hi,
    I created advancedSearch in page, when I click on go button, I will get the result in advancedTable ,
    in the page Address, it will be appended '....&retainAM=N&addBreadCrumb=N&oapc=3',
    Now my question is how to set 'retainAM=Y' when I click on 'Go' button

    Hi Gyan,
    In advanched search, click go button, then I will get the result in the advanchedTable,
    and the address of this page will be added the statement '...retainAM=N..'
    Then, for example, click 'about this page', it will go to 'About Page'. click 'Return to Page: ', it will go to the previous page and the address of the page
    still be '..retainAM=N..', but now the result table is blank.
    I want to retain the result we have searched when return to the previous search page.
    I think if we can change the retainAM's value to 'Y' after clicking on 'Go' button, then when we return to this page, retainAM will still be 'Y' so that the
    result will be retained .
    And I found one thing so strange, in advancedSearch criteria, there are four criteria displaying in search region by default, but when I add one new criteria, even I don't erter any value to this new crireria, and then go button, in address of this page, it will be '..retainAM=Y', then when we return this page , it will retain the result

  • In ADF Tree how to Navigate to Pages When Clicking Tree Node   (TP4)  ?

    hi
    I know how to use af:tree as master-detail tree
    by draging detail views from Data Controls and dropping in JSF
    Page but I would like to know how to call other pages when double-clicking child nodes in the tree. in JDeveloper 11 TP4 & Windows XP
    Anybody can help?
    best regards
    Forakora;

    Hi,
    if it has to be a double click then this can be done with a clientListener that calls a JavaScript function and that you set to the doubleClickEvent type e.g.
    handleTreeSelection(event){
    // do here what you need to do
    queue event to a serverListener that references a managed bean. Use managed bean to
    navigate to another page
    Out of curiousity, what is the usecase ?
    Frank

  • How to Get the value when clicking on the link

    I had a problem with when clicking on the link.
    I need get the link value to the controller when clicking on the link.
    I am displaying the database columns in jsp using repeater in links.
    I am displaying the data like this:
    RED
    BLUE
    GREEN
    these are three links.when clicking on the link RED. RED should go to the controller.
    After getting RED to the controller i will get the RED value from the database.

    my requirement is like that only
    I have just given the example of emp and dept
    emp(empno,zone_group_id,zone_id,deptno,ename,emp_p_ind,last_update_datetime);
    dept_emp(empno,dept_no,loc,dname,sal_emp,grade,last_update_datetime);
    CREATE OR REPLACE VIEW emp_zone AS
    SELECT e.empno,
          (select zone_group_id from price_zone_group where rownum = 1) zone_group_id,
           d.loc zone_id,    
           d.grade,  
           d.last_update_datetime,
      FROM dept_emp d
          emp e
    WHERE d.empno=e.empno
       AND e.emp_p_ind = 'Y'
      WITH READ ONLY;
    Now
    my requirement is to get the data of emp_zone view and needs to store those data into some other temp table
    if any of the above base table got updated deleted or inserted then the view last_updatetime also will get updated but problem is why im not using base table
    direct because it is having huge data and it performance issue .i have to get the value on the basis of view only and using some logic

  • How to hide a TextField when clicking another button

    Hello!
    I've been able to generate a TextField to appear when clicking a button, but when I click on another button, to display some more information, I still have the first TextField displayed.  I've had a look around, but not been able to find anything to help me with getting the first to disappear.  Can anyone provide any ideas for this?
    The code I'm using for displaying the TextField is:
    button10.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    var fl_TF:TextField;
    var fl_TextToDisplay:String = "Send disply to the right screen/projector";
    function fl_ClickToPosition(event:MouseEvent):void
    fl_TF = new TextField();
    fl_TF.autoSize = TextFieldAutoSize.LEFT;
    fl_TF.background = true;
    fl_TF.border = true;
    fl_TF.x = 300;
    fl_TF.y = 100;
    fl_TF.text = fl_TextToDisplay;
    addChild(fl_TF);
    Many thanks in advance

    all your buttons should call the same function. 
    because each button probably triggers different text to be displayed, you can use an object or dictionary to associate the buttons and their text:
    // execute these two lines and your function once at the start of your app
    var dictionary:Dictionary=new Dictionary(true);
    var fl_TF:TextField;
    function fl_ClickToPosition(event:MouseEvent):void
    if(fl_TF&&fl_TF.parent){  /
    fl_TF.parent.removeChild(fl_TF);
    fl_TF=null
    fl_TF = new TextField();
    fl_TF.autoSize = TextFieldAutoSize.LEFT;
    fl_TF.background = true;
    fl_TF.border = true;
    fl_TF.x = 300;
    fl_TF.y = 100;
    fl_TF.text = dictionary[e.currentTarget];
    addChild(fl_TF);
    ////////// and for each button use something like:
    button10.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    dictionary[button10] = "Send disply to the right screen/projector";

  • How to choose Mail (Mapi) when clicking "Export" in the Report Viewer

    I'm using .net 2008 and CR 2008 for reporting.
    In a form I placed the ReportViewer.
    Everything works fine.
    Here my problem: When I click "Export" in the Viewer I get the File-Dialog with Excel, Word, PDF.
    But I'm missing the Dialog where I can choose MAPI (Microsoft Mail) as destination.
    To illustrate, how I implemented the CR 2008 in our application:
        Public Sub ReportStarten()
            Dim l As Integer
            Dim Cmd As System.Data.SqlClient.SqlCommand = Nothing
            Dim Reader As System.Data.SqlClient.SqlDataReader = Nothing
            Dim ReportDataTable As System.Data.DataTable
            Dim SqlConn As New System.Data.SqlClient.SqlConnection()
            Dim ReportFenster As New ReportForm
            If Me._DruckVorschau Then
                ReportFenster.Text = Me.Reporttitel
                ReportFenster.Show()
                ReportFenster.WindowState = Windows.Forms.FormWindowState.Maximized
            End If
            'Diese Selektion wird im Report selbst berücksichtigt
            Me._ReportRpt.DataDefinition.RecordSelectionFormula = Me._RecordSelection
            l = 0
            Dim myTables As CrystalDecisions.CrystalReports.Engine.Tables = Me._ReportRpt.Database.Tables
            For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
                SqlConn.ConnectionString = Me._ConnectionString
                SqlConn.Open()
                Cmd = New System.Data.SqlClient.SqlCommand(Me._TableSource(l))
                Cmd.Connection = SqlConn
                Reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
                ReportDataTable = New System.Data.DataTable()
                ReportDataTable.Load(Reader)
                myTable.SetDataSource(ReportDataTable)
                l += 1
            Next
            If Me._DruckVorschau Then
                'Vorschau
                ReportFenster.CrystalReportViewer.ReportSource = Me._ReportRpt
            Else
                'Sofortdruck
                Me._ReportRpt.PrintOptions.PrinterName = Me._DruckerName
                Me._ReportRpt.PrintToPrinter(1, False, 0, 0)
            End If

    The wiki (http://social.technet.microsoft.com/wiki/) is probably a better place for this.
    Jason

  • UWL: Jump another role when clicking in a WI (Task)

    HI Experts!
    I tell them that I've have a problem when working with the UWL for SAP Enterprise Portal modules and SRM7.0 7.13.
    The stage on which I locate the problem is this, we have created many custom roles portal with many features (standard and own client) and much of this role have the workset that brings SRM7.0 Portal installation to the UWL to display tasks that contains the user for management.
    In this work, we find WI order approval standards, for example, which the user uses it daily and that when run, will open a document approver display mode (managed by the FPM and some dynamic parameters in the call). Inside the application for approval of orders, we have included a LINK to an custom application which we call clicking through on relative navigation (Path IVIEW), including the folder navigation role, the IVIEW Luncher for custom application.
    Now comes the problem, the situation is that when you click the LINK application does not run giving an error in JAVASCRIPT. After analysis, we found that, at the time of the click, the WI (on tasks in UWL) the IVIEW on approval so that it runs is not relevant to the role from which you accessed the UWL, but has made a jump to a standard role. I mean, being in the role A (which is a custom role), for example, when you click on the task in the UWL, the system searches the IVIEW to execute that task in another role (role B - Standard Role) . Then the problem is that the navigation then run on the PCD_LOCATION corresponds to the standard role where not, the folder navigation, the IVIEW custom application and enforcement of this fails it.
    We have reviewed all, SRM configurations for execution of tasks, XML configuration, configuration Roles, etc, but were unable to determine where and why you are running this jump in the role system.
    What has happened to anyone?, Will created the wrong of the UWL IVIEW associated with the custom role?, Do these calls can be parameterized anywhere? This is happening to us in all systems and do not know why that is.
    we really appreciate all the help we can provide
    SP levels of the portal are the following;
    Portal Version: 7.30 SP10
    VM Java Version: 1.6.0_33
    VM Runtime Version: 6.1.043 21.1-b02
    Kernel Version: 7.30.3301.348013.20130703150204
    At your disposal,
    Best Regards,

    Hi all
    I am also facing a similar problem while implementing a dialog which needs to be shared by two pages. I am also implementing it the way described in the case that does not work. i.e. dialog is in the jsff of child taskflow. I am encountering the issues described here. Is there some solution to this problem?
    Is there any other way also to implement a shared UI dialog?
    Thanks
    Arun

  • Charting Query: How to show detailed chart when clicked

    Hi , I have a flash chart that shows monthly summary values . When user clicks on a bar ( say for month of JAN), I want to show another chart based on data for JAN only. I am trying to figure out how to show my detail chart when user clicks on a summary bar.
    Can someone advise how can I pass value from parent chart to child chart?
    Thanks
    Aali
    Edited by: aali on 02-Feb-2010 00:30

    Hi Aali,
    Create 2 pages, one for summary the other for detailed (assuming P1 & P2). The query for your first chart needs to link to the second including a month value. It might look something like this:
    select 'f?p=&APP_ID.:2:'||:app_session||'::::P2_MONTH:'||MONTH||':' link, MONTH  label, SUM(SALES) value1
    from TBL_DETAILS
    group by MONTH
    -- :2: is the page you're linking to (detailed chart)
    -- P2_MONTH should be a hidden item on that page to store the month value
    -- MONTH is the value to be passed...this could be some substr(date_col, 4,6) or somethingCreate your Hidden P2_MONTH item making sure it is NOT Hidden and Protected. Page 2 query something like:
    select null link, DAY label, SUM(SALES) value1, SUM(COSTS) value2, COUNT(STAFF) value3
    from TBL_DETAILS
    where MONTH = :P2_MONTH
    group by DAYI don't have info on your tables though so hopefully this is helps.
    Mike

  • How to read row index when clicking on F4 search multiple rows

    Hi Experts,
    I would like to read index of selected row in assignation block. Please help.
    My requirement is to restrict product search base on product category available in same row of table row.
    When I select f4 search on product ID, It shows me all products available in system, however user wants product search should be based on product catagory.
    I have added following code in get_v_orderprod. Problem is when user click on f4 button on product for first time CONTROL doesnot go to get_v_orderprod method in BT111H_OPPT component btadmini contextnode firsttime pop up comes with open search of all product available in system.
    DATA:  lr_admini            TYPE REF TO cl_crm_bol_entity,
             lr_iterator         TYPE REF TO if_bol_bo_col_iterator,
             lv_ordered_prod     TYPE REF TO crmt_ordered_prod_db,
             lr_collection       TYPE REF TO if_bol_bo_col,
             current             TYPE REF TO if_bol_bo_property_access,
             dref                TYPE REF TO data,
             lv_pr_catagory      TYPE string.
      FIELD-SYMBOLS: <l_data> TYPE data.
    * if iterator is bound.
    *      current = iterator->get_current( ).
    *    else.
    *      current = collection_wrapper->get_current( ).
    *    endif.
      lr_iterator = me->collection_wrapper->get_iterator( ).
    if lr_iterator is bound.
          current = lr_iterator->get_current( ).
        else.
          current = collection_wrapper->get_current( ).
    endif.
    lr_admini ?= current.
    *   lr_admini ?= lr_iterator->get_by_index( iv_index = iv_index ).
      IF lr_admini IS BOUND.
        lr_collection = lr_admini->get_related_entities(
                     iv_relation_name = 'BTItemProductExt' ).
    *   lr_collection = current->get_related_entities(
    *                 iv_relation_name = 'BTItemProductExt' ).
        current = lr_collection->get_current( ).
    *   if lr_collection is bound.
    *      current  = lr_collection->get_current( ).
    *    else.
    *      current = me->collection_wrapper->get_current( ).
    *    endif.
        IF current IS BOUND.
          TRY.
              dref = current->get_property( 'PROD_HIERARCHY' ).
              ASSIGN dref->* TO <l_data>.
              CHECK <l_data> IS ASSIGNED.
              lv_pr_catagory = <l_data>.
            CATCH cx_sy_ref_is_initial.
              RETURN.
          ENDTRY.
          CLEAR: lv_pr_catagory.
        ENDIF.
      ENDIF.
    Is there anyway out to achieve this ?
    Thanks
    Neha

    Hi Venkat,
    <li>You are the right person to solve the problem .
    <li>What you have to get it solved is place Break-point on REUSE_ALV_GRID_DISPLAY function module and break-point inside USER_COMMAND event where u press SCREEN button which takes you to table control and another break point where DELETE function you are doing. Definitely it works out.
    Thanks
    Venkat.O

  • How to Open GUI Transaction when clicking in Hyper Link

    Hello All,
    I want to open GUI Transaction  when user will click on Hyper Link created in a particular column in a table view. For that I have created  Transaction Launcher ID using Transaction Launcher  Wizard. Then what will be the next step, i'm not getting. Can anybody help me out on this?
    Thanks in advance,
    Madhusudan

    Hi,
    Here is the sample code:
    DATA: lr_navigation TYPE REF TO if_crm_ui_navigation_service.
    lr_navigation = cl_crm_ui_navigation_service=>get_instance( me ).
    CHECK lr_navigation IS BOUND.
    lr_navigation->navigate( iv_link_id = 'ZLINKID' ).
    -ASB

  • How to increase displayed rows when clicking RESULT tab

    Hi Experts,
    How do I increase the number of rows displayed in an Analysis report when you hit the RESULT tab?
    Right now, the default rows displayed in my current development is 'Rows 1 - 25'
    I want a bigger number. :)
    Thanks,

    Hi,
    try to use <MaxVisibleRows>500</MaxVisibleRows> this will apply entire application, if you just want to set particular report edit analysis--> table/pivot view properties and increase the no of rows display.
    Refer section
    18.3.1.2 Manually Configuring Settings for Data in Views
    http://docs.oracle.com/cd/E23943_01/bi.1111/e10541/answersconfigset.htm#r9c1-t2
    Thanks
    Deva

Maybe you are looking for

  • How do i upload word docs to an ipad 2, How do i upload word docs to an ipad 2

    is there any way of getting word documents onto the ipad 2 without having to buy the app as i will only use it occassionally??

  • How to declare Dynamic table in Tables Parameters of a Function Module...

    Hi Gurus, I would like to Know how to declare a Dynamic table in Tables parameters of a Function Module. so that it should be able to hold any table data .... I have tried all possible ways of trying to assign fields-symbol like declarations which do

  • Exit button not working in exe file made with Aggregator

    Hi, I created an .exe file using Aggregator in full screen mode but the exit button on the skin doesn't work. When I click the exit button, the dislay hiccups (wobbles a bit) but the file keeps playing and doesn't close. This is especially problemati

  • About event handler

    hi i am trying to develop a event handler for all the attributes of a resource that when user is modified is attributes. he need get a notification that paritcular attribute or u r data is modified.. actually i have seen that they have return adapter

  • Oracle Standby setup for firewall

    Hi, Recently one of my client separated their primary and standby databases with Juniper firewall. After the activity, some primary database servers were unable to ship the archives whereas some of the primary databases were shipping the archives but