JTree default selection?

I've tried searching for this here and there but nothing turned up...
I was wondering if it is possible to set a default selected item on a JTree.
So that if no nodes are selected - the first item is selected by default.
Any hints would be greatly appreciated, thanks.

If for "nested element" you mean "a node", you can use setSelectionPath(TreePath path) and      setSelectionPaths(TreePath[] paths).
Message was edited by: java_knight

Similar Messages

  • How can I pre-define the default selection in a SelectOneChoice?

    How can I pre-define the default selection in a SelectOneChoice?
    (1) Here's my JSF-code:
    <af:selectOneChoice label="#{res['usercreate.input.sex']}"
    value="#{bindings.Sex.inputValue}"
    binding="#{SelectListBean.sexlist}"
    readOnly="false" autoSubmit="false">
    <af:selectItem label="#{res['data.sex.women']}" value="1"/>
    <af:selectItem label="#{res['data.sex.man']}" value="2"/>
    </af:selectOneChoice>
    (2): manged bean: to set the default value to be the first in the list, my managed bean as follows:
    import oracle.adf.view.faces.component.core.input.CoreSelectOneChoice;
    public class MBSListBean {
    private CoreSelectOneChoice sexlist;
    public MBSListBean() {
    public void setSexlist(CoreSelectOneChoice sexlist) {
    this.sexlist = sexlist;
    this.sexlist.setValue(1);
    public CoreSelectOneChoice getSexlist() {
    return sexlist;
    (3) when i launch the page, it often gives me such warnings:
    WARNUNG: Could not find selected item matching value "1" in CoreSelectOneChoice[UIXEditableFacesBeanImpl, id=_id7]
    how to solve the problem ?
    Thanks,
    wzzdx

    You could also set the default on your entity or viewobject, in the properties of your attribute.

  • How to hide  some fields in default selection screen in hr abap

    Hi experts,
    I have created default selection screen,in that in the Period option I wants display only 'Today'.
    And in the selection criteria i wants to display personnel number,companycode,personnelsubarea,employee status and instead of payroll area i wants to display 'Org unit'.please tell me step by step procedure,that could be greate helpfull.
    Thanks in advance,
    mohan

    use this logic to display only today in the period option
    **Local constants
       CONSTANTS:
              c_0                   VALUE  '0'  ,
              c_089     TYPE char3  VALUE  '089',
              c_091     TYPE char3  VALUE  '091',
              c_095     TYPE char3  VALUE  '095',
              c_097     TYPE char3  VALUE  '097'.
                     At Selection Screen
    at selection-screen output.
    LOOP AT screen.
          IF
               screen-group4 = c_089 OR
               screen-group4 = c_091 OR
               screen-group4 = c_095 OR
               screen-group4 = c_097  .
          screen-active = c_0.
          MODIFY SCREEN.
         ENDIF.
      ENDLOOP.

  • How to change default selection in compensation planning

    Hi experts,
    We have upgraded our portal to EHP1 sp04.
    I need to change the default selection which it currently shows in "Employee Selection" under
    Compensation Planning-->Compensation Planning.
    When a user clicks on Compensation Planning>Compensation PLanning> he comes in an iview with 4 steps:
    There is one "Employee Selection" scroll down view, I need the default to be "Direct Reports"
    http://rapidshare.com/files/308150359/DirectReports.jpg
    The default it shows is "Employees from organizational units", I need to change it to "Direct reports". Can someone tell me how I should proceed about it.
    Please guide me
    Regards,
    Rajat Sharma

    Hi,
    I have solved this issue.
    Go into SPRO>integration with other sap system>business packages>mysaperp>organizational structure view
    group organizational structure view.
    select mss_ecm_sel and change the nos. accordingly.
    thanks,
    Rajat

  • Logical database EQI (equipment)  .. I dont want to use the default selecti

    i am using Logical database EQI (equipment)  its realated to PM module.....
    i dont want to use the default selection screen.
    instead i want to process my own selection screen inputs..
    (ie..) i want to fetch the data using the GET event using my  own selection screen  inputs.
    my selection screen inputs is   equipmentnumber (equnr)
    and  the output list : 1.equnr      "equipment number
                                  2.shtxt       "Equipment Description
                                  3.tplnr        "Functional Location
                                  4.pltxt        "Functional Location Description
                                  5.qmnum    "Notification Number 
                                  6.qmtxt      "Notification Description
                 and  so on  ..........             
    how to do this ... can any one give sample code... or logic

    Hi Victor,
    I have a simple solution for this.i think it will help you.Do u have any idea about query designer in SAP.
    by using it we can satisfy u r  reuqirement.follow the below steps.
    1)Go to SQ01
    2)In the screen click on QuickViewer option.then you will go to another screen.
    3)In that screen give any name starting with 'Z' in the QuickView box and then click on create.
    4)In the dialogbox enter title and comments and then select LogicalDatabase as the DATASOURCE and give DataSourceLogicalDatabase as EQI.check the radio button Basis Mode and then click on ok.
    5)then on the screen in the first half of leftside you will  get another screen with the columns DATAFIELDS,LISTFIELDS,SELECTIONFIELDS,TECHNICALNAME.
    6)In the DATAFIELDS column expand the tree,then u can see the fields what we have,and what you want.and also you can see the check boxes in front of the columns LISTFIELDS,SELECTIONFIELDS.
    7)LISTFIELDS means the output fields,SELECTIONFIELDS means the selection screen fields(equnr).
    check the checkboxes as per u r requirement and click on execute.
    8)then a progam will be created.to know the program name after executing the program GO TO
    SYSTEM->STATUS.then u can see the program name there.
    If u know all these,let me know so that i can try for another solution.
    Thanks,
    N.K.C

  • How to change the text in default selection screen

    Hi,
      I have created the default selection screen(using PNP Logical database) ,In that I wants to display 'Data Selection Period' instead of 'Period'.
    Please send me the related code.
    Thanks in advace
    mohan

    HR Logical Database is PNP
    Main Functions of the logical database PNP:
    Standard Selection screen
    Data Retrieval
    Authorization check
    To use logical database PNP in your program, specify in your program attributes.
    Standard Selection Screen
    Date selection
    Date selection delimits the time period for which data is evaluated. GET PERNR retrieves all records of the relevant infotypes from the database. When you enter a date selection period, the PROVIDE loop retrieves the infotype records whose validity period overlaps with at least one day of this period.
    Person selection
    Person selection is the 'true' selection of choosing a group of employees for whom the report is to run.
    Sorting Data·
    The standard sort sequence lists personnel numbers in ascending order.
    · SORT function allows you to sort the report data otherwise. All the sorting fields are from infotype 0001.
    Report Class
    · You can suppress input fields which are not used on the selection screen by assigning a report class to your program.
    · If SAP standard delivered report classes do not satisfy your requirements, you can create your own report class through the IMG.  
    regards
    vinod

  • Hiding some fields in default selection screen in hr abap created by pernr

    Hi experts,
    I have created default selection screen,in that in the Period option I wants display only 'Today'.
    And in the selection criteria i wants to display personnel number,companycode,personnelsubarea,employee status and instead of payroll area i wants to display 'Org unit'.please tell me step by step procedure,that could be greate helpfull.
    Thanks in advance,
    mohan

    hi mohan,
    try this
       **Local constants
       CONSTANTS:
              c_0                   VALUE  '0'  ,
              c_089     TYPE char3  VALUE  '089',
              c_091     TYPE char3  VALUE  '091',
              c_095     TYPE char3  VALUE  '095',
              c_097     TYPE char3  VALUE  '097'.
                     At Selection Screen
    at selection-screen output.
    LOOP AT screen.
          IF
               screen-group4 = c_089 OR
               screen-group4 = c_091 OR
               screen-group4 = c_095 OR
               screen-group4 = c_097  .
          screen-active = c_0.
          MODIFY SCREEN.
         ENDIF.
      ENDLOOP.

  • Input box on default selection screen

    Hi,
       how to create an input box on the default selection screen which will accept only 1275 characters.
      Can u please help me?
    Thanks in Advance,
    Sreekala.

    Hi Sreekala,
    You need to use the  CL_GUI_TEXTEDIT for creating the box, also you need use the dialog program for that.
    For more info on that class check this
    Usage of CL_GUI_TEXTEDIT
    Text box on selection screen
    Hope they helps you.
    Regards!

  • How to set the default selection to "Select All" in a Multi valued parameter in SSRS 2008?

    Hello Everyone,
    How to set the default selection  to "Select All" in a Multi valued parameter in SSRS 2008?
    Regards
    Gautam S
    Regards

    You need to specify "Default Values" in the report parameter property. Choose similar option used in the "Available Values" option, this will allow the parameter to check "Select All".
    Regards, RSingh

  • How to Display key/text in default selection screen?

    HI Gururs,
    I want to display key/text in variable default selection screen in BI Analyzer in Quality.
    please give me any suggestions to resolve this.
    Thanks
    vadlamudi

    hi,
    What i have done is in the cube level, in the dimensions i have made specific properties and set to key/text in development, so its working fine in development of the analyzer, but still its showing text only in quality analyzer.
    please give me the solutions if you know any.
    regards
    vadlamudi

  • How to get the default selection color from JTable

    Hi, there,
    I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
    Thanks,
    -Jenny

    The windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
    If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
    http://www.discoverteenergy.com/files/ShowUIDefaults.java
    Any of the properties can be changed for the entire application by using:
    UIManager.put( "propertyName", value );

  • How to set default selection in html:radio

    hai
    how to set default selection in <html:radio>.

    No it won't help.
    You can't set a value into an <input type="file"> control at all. The user has to put values in themselves.
    The reason behind this is security. If the programmer could put any value they liked in there, you could upload any file at all from a users computer without their intervention. eg C:\windows\system32\passwords.txt
    Bottom line: you can't put a default value into the input type="file" control.
    And a good thing too ;-)

  • PDF as default selection for Select printing cotrol (for Web)

    Hi
    Can someone point me to righ direction? What we are trying to do is, in Infoview, set PDF as default selection for "Select printing Control (for Web)", so that each user does not have to do this in preferences in infoview.
    Is it possible to do so? If yes, how?
    Thank you
    Regards
    IMS

    Take a look for a .vbs sample that synchs the ADMINISTRATOR preferences to all users on the BOE platform.
    You can schedule this as a PROGRAM OBJECT in InfoView so that it runs on a regular schedule to apply the change to new users.

  • Hiding some fields in default selection screen in hr abap

    Hi Experts,
      I am new to hr abap.I have created default selection screen by using LDB .in that i wants to display only the personnel number field.
    could any help me how to hide further selections,sort order and search helps at top of screen.
    thanks in advace,
    mohan

    use
    at slection-screen output.
    loop at screen.
    if screen-name = 'PNPBUKRS'. (example)
    screen-active = '0'.
    endif.
    modify screen.
    endloop.
    ==========================
    u can do it as group wise also.
    loop at screen.
    if screen-group1 = 'group name'.  (could be group1,2,3,4)
    screen-active = '0'.
    endif.
    modify screen.
    endloop.
    ====================
    Hi,
    Can u tell me which LDB and report category u are using so that i will send u the code as per the req.
    If the above code suits to ur req. pls reward the points.
    Regards
    eswar

  • Default Selection in Combo Box

    Hi,
    I have a query regarding combo box. I have populated combo box using UserDataSources. Is it possible to make a default selection of an Item in combo box.
    Regards
    Ronald

    Hi Ronald,
                   I  hope the following code helps
                           Dim oComboVal1 As SAPbouiCOM.ComboBox
                           Dim oCol As SAPbouiCOM.Column
                           oCol = oMatrix.Columns.Item("V_12")
                            oComboVal1 = oCol.Cells.Item(Row).Specific
                            oComboVal1.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
                            here
    Regards
    V.Rangarajan

Maybe you are looking for