Scroll Up list and Scroll Down list buttons

I want to be able to scroll a list without using the scrollbars, but want to use buttons to do this, how can i do this. I don't want any scrollbars, but want to be able to scroll through my JList using the two buttons up and down.
Thanks

additional code needed for numpad arrows (if required)
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing extends JFrame
  public Testing()
    setLocation(400,300);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JPanel scrollPanel = new JPanel(new GridLayout(50,1));
    for(int x = 0;x < 50; x++) scrollPanel.add(new JLabel(""+(x+1)));
    JScrollPane sp = new JScrollPane(scrollPanel,JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sp.setPreferredSize(new Dimension(100,150));
    getContentPane().add(sp);
    pack();
    final JScrollBar sBar = sp.getVerticalScrollBar();
    KeyboardFocusManager.getCurrentKeyboardFocusManager()
     .addKeyEventDispatcher (new KeyEventDispatcher(){
        public boolean dispatchKeyEvent(KeyEvent ke){
          if(ke.getID() == KeyEvent.KEY_PRESSED)
            if(ke.getKeyCode() == KeyEvent.VK_UP) sBar.setValue(sBar.getValue()-5);
            if(ke.getKeyCode() == KeyEvent.VK_DOWN) sBar.setValue(sBar.getValue()+5);
          return false;}});
  public static void main(String args[]){new Testing().setVisible(true);}
}

Similar Messages

  • Sort up and sort Down push buttons in module pool with table control wizard

    hi,
    i have created 2 buttons for Sort up and sort Down push buttons in module pool with table control wizard
    please any one can help me.
    regards

    Hi
    Following code is to enable and disable the tbl control using two buttons. Just alter the code and for each button write the sort code.
    REPORT  YJAN27_SCREEN                                               .
    TABLES: SFLIGHT, YFLIGHT_28.
    TYPES: BEGIN OF struct1,
          carrid like sflight-carrid,
          connid like sflight-connid,
          fldate like sflight-fldate,
           END OF struct1.
    CONTROLS TBL1 TYPE TABLEVIEW USING SCREEN 2700.
    DATA: OK_CODE LIKE SY-UCOMM,
          CARRID LIKE SFLIGHT-CARRID,                                    "cols in tbl ctrl
          CONNID LIKE SFLIGHT-CONNID,
          FLDATE LIKE SFLIGHT-FLDATE,
          itab TYPE TABLE OF STRUCT1 WITH HEADER LINE,
          cols like line of TBL1-COLS,
          FLAG TYPE I.
    FLAG = 1.
    CALL SCREEN 2700.
    *&      Module  STATUS_2700  OUTPUT
    *       text
    MODULE STATUS_2700 OUTPUT.
      SET PF-STATUS 'BACK'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_2700  OUTPUT
    *&      Module  USER_COMMAND_2700  INPUT
    *       text
    MODULE USER_COMMAND_2700 INPUT.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
      WHEN 'BACK'.
        LEAVE PROGRAM.
      WHEN 'DIS'.                                                         "write code for sort up
        loop AT TBL1-COLS INTO COLS.
           COLS-SCREEN-INPUT = 0.
            MODIFY TBL1-COLS FROM COLS.
        ENDLOOP.
        FLAG = 2.
      WHEN 'ENA'.                                                       "write code for sort down
        loop AT TBL1-COLS INTO COLS.
            COLS-SCREEN-INPUT = 1.
            MODIFY TBL1-COLS FROM COLS.
        ENDLOOP.
        FLAG = 1.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_2700  INPUT
    *&      Module  GET_DATA  OUTPUT
    *       text
    MODULE GET_DATA OUTPUT.
      select carrid connid fldate from SFLIGHT into table itab.
    ENDMODULE.                 " GET_DATA  OUTPUT
    *&      Module  POPULATE_TBL  OUTPUT
    *       text
    MODULE POPULATE_TBL OUTPUT.
        MOVE-CORRESPONDING ITAB TO SFLIGHT.
    ENDMODULE.                 " POPULATE_TBL  OUTPUT
    *&      Module  CHANGE_SCREEN  OUTPUT
    *       text
    MODULE CHANGE_SCREEN OUTPUT.    " use this module if you want to hide the other button
    CASE FLAG.
      WHEN 1.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_ENA'.
            SCREEN-INVISIBLE = 1.
             MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_DIS'.
            SCREEN-INVISIBLE = 0.
             MODIFY SCREEN.
          ENDIF.
       ENDLOOP.
      WHEN 2.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_DIS'.
            SCREEN-INVISIBLE = 1.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_ENA'.
            SCREEN-INVISIBLE = 0.
             MODIFY SCREEN.
          ENDIF.
       ENDLOOP.
    ENDCASE.
    ENDMODULE.                 " CHANGE_SCREEN  OUTPUT
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_2700.
    MODULE CHANGE_SCREEN.     " use this if you want to display one button at a time
    MODULE GET_DATA.
    loop at itab WITH control TBL1.
        MODULE POPULATE_TBL.       " populate tbl ctrl
    endloop.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_2700.    " do the sort operations
    loop at itab.
      endloop.
    Hope this helps
    Regards,
    Jayanthi.K

  • I have an iPod Nano 6th Generation for just over three months and the down volume button is sticking.  Does anyone have a recommendation for resolving?

    I have an iPod Nano 6th Generation for just over three months and the down volume button is sticking.  Does anyone have a recommendation for resolving?

    Dont buy this model again, this is the most common problem and i have gone through 4 of these 6th gen nanos all with the same problem.  You can find youtube videos that show you how to fix it yourself but you run the risk of breaking your ipod, also opening the ipod voids any warrently.

  • How do I get data off  my phone? when I plug phone into the wall and hold down the button i can get into photos and messages etc but when I plug into laptop it goes to recovery mode........therefore the data is not yet wiped? HELP!

    how do I get data off  my phone? when I plug phone into the wall and hold down the button i can get into photos and messages etc but when I plug into laptop it goes to recovery mode........therefore the data is not yet wiped? HELP! I got married last week on holidays and have not had a chance to save photos yet.

    Hello there stidhambr15,
    I was researching the issue you are having and recommend a couple of things. First it might be a good idea to reset the device following iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting found here http://support.apple.com/kb/ht1430
    Resetting your device
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    If that doesn't quite get the device going again, I recommend restoring the device.
    iTunes: Restoring iOS software
    http://support.apple.com/kb/ht1414
    Might even be a good idea to turn off the phone, reseat the SIM card, and turn it back on.
    iPhone and iPad: How to remove the SIM card
    http://support.apple.com/kb/ht5163
    iPhone 4 (GSM model)
    iPhone 4S
    Cheers,
    Sterling

  • ListSelectionEvent and Up/Down arrow buttons

    Hi,
    I am using JDK 1.3.1 and having a wierd problem with changing list selection using the Up and Down arrow buttons.
    Normally, when changing a list or table selection using the mouse, two events will be fired in sequence. The first one is the deselect event of the old selection and the second one will be the select event of the new selection. But when I change the selection using the Up and Down arrow buttons, only the second event is fired.
    I installed an extend ListSelectionListener on my DefaultListSelectionModel as following:
    public void valueChanged(ListSelectionEvent e){
    if (e.getValueIsAdjusting()) {
    // Do something to the old selection when leaving it
    else {
    //Do something to the new selection
    As described earlier, when changing seleciton with the mouse, the valueChanged() method will be invoked twice with the e.getValueIsAdjusting() returning true then false. But when changing the selection with a Up or Down key, the method will only be invoked once with the e.getValueIsAdjusting() returning false.
    Did anyone have this problem too? Is this a JDK specific problem? Your help will be really appreciated.
    Thanks very much.

    If this behavior is expected for the JList, I am wondering if there is anyway that I could disable the Up/Down arrow buttons in the list box.
    Thanks.

  • Does anyone know how to select text in Appleworks, click on the font button and then be able to scroll thru all the font so that one can see the text change as you scroll down the list, at present  I have to do it one font style at a time and then repeat

    does anyone know how to view text in Appleworks, to be able to click on the font button and then be able to scroll thru all the font so that one can see it change as you scroll down the list, at present  I have to do it one font style at a time and then repeat? Thanks jl

    Welcome to the Apple forums
    Your question really belongs in the AppleWorks community/forum.
    You can turn on fonts in actual type in the AppleWorks preferences.

  • Is it possible to move the "Add.." button at contacts on top of the custom label list? I add a lot of custom lables and tired of scrolling down every time.

    Is it possible to move the "Add.." button at contacts on top of the custom label list? I add a lot of custom lables and tired of scrolling down every time.

    No way to move any buttons in iOS devices.

  • When I play games in Mozilla on fb..some setting changed and now the pop up window that appears to send gifts to my friends only lists 3 ppl at a time some games i have a scroll down button others i dont..can u help m fix this please?

    When I play games in Mozilla on fb..some setting changed and now the pop up window that appears to send gifts to my friends only lists 3 ppl at a time some games i have a scroll down button others i dont..can u help m fix this please?

    Hi Winnie
    Unfortunately I have been sick and did not read the message before. I apologize.
    I have not received help beyond what is on the page. But when I get I tell you.
    I hope you can get answers. If you receive, I ask that you share with me.
    thank you very much
    best regards
    AC
    Date: Mon, 27 Feb 2012 09:33:10 -0700
    From: [email protected]
    To: [email protected]
    Subject: Pop up Window before saving remembering the need (forcing) to fill required fields in a form
        Re: Pop up Window before saving remembering the need (forcing) to fill required fields in a form
        created by Win_Form in Forms - View the full discussion
    Hi ACI wonder if you can share any responses on to your question above?I too have never used a script but, I have the same problems as you in regards to building a form. And wants to have the same 'protection' and message reminders for the end users. Any information, including a script and/or a contact email of experts you can share with me will help tremendously. Thank you so much in advance. Winnie
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4232307#4232307
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4232307#4232307. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Forms by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • How do I scroll down to see list of selected audiobooks and albums to sync with my iPhone in iTunes 11?

    I am running Windows 7 and using iTunes 11. I have an iPhone 4.
    In the past I have been able to sync selected albums and audiobooks with my iPhone using iTunes with no problems, but today when I tried to add an audiobook from my computer to my iPhone, I could not see it (or the audiobooks previously added to my iPhone) listed as a choice under Books --> Sync Audiiobooks --> Selected Audiobooks.
    I connected my iPhone to my laptop via USB. iTunes 11 comes up. My iPhone syncs automatically.
    I click the iPhone device in the sidebar and the list of choices (Summary, Info, Apps, Tones, Music, Movies, TV Shows, Books, and Photos) appears across the top of the main part of iTunes to the right of the sidebar.
    When I click on Music from this list of choices, I have selected Sync Music and Selected playlists, artists, albums, and genres.
    Under this I see my list of Playlists and the ones I have checked. I also see my list of Artists and the ones I have checked.
    Under these two items, I see the words Genres and Albums, but I cannot scroll down to see them (not even to see the ones I have previously selected to be synched with my iPhone).
    When I click on Books I see that Sync Audiobooks is checked and Selected audiobooks is selected, but I cannot see the list of audiobooks from which I can choose the ones I want to add to my iPhone and I cannot see the audiobooks that I previously selected and that are currently on my iPhone. I see the words Audiobooks and Parts, but I cannot scroll below these words to see the list of audiobooks that are on my laptop.
    Any help in resolving these issues would be greatly appreciated.
    Thanks.
    Eddie

    http://www.technipages.com/iphone-ipad-ipod-touch-enable-disable-shuffle-mode.ht ml
    I think you've tried that though.
    I had similar issue a few months ago - I think it didn't work unless I did it when the music was actually playing in the now playing section.

  • How can I scroll down the top menu list and then the sub-menu lists when the iPod click wheel is broken?

    I have an iPod Classic 4th Generation and my click wheel connection is broken and so does not work. I can still play music on my Bose dock station but I cannot choose which album I want to play because I cannot scroll down the playlists.  I can just play the first tune in the list or from where I last paused a tune. Is there a way to scroill down the list, including the top menu list, without using the click wheel?

    Index Values, I think, is the property you are looking for.  Set the index to 0 to be at the top.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • I have a problem choosing artist from my artist list when I will put music on my iPad from my iMac. I can only see the 25 first artis and it is not possible to scroll down the list

    have a problem choosing artist from my artist list when I will put music on my iPad from my iMac. I can only see the 25 first artis and it is not possible to scroll down the list

    Hi stig68,
    If you are having grouping issues with compilation albums in iTunes, you may find the following article helpful:
    Apple Support: Why aren't songs with the same album art grouped together?
    http://support.apple.com/kb/TS1468
    Regards,
    - Brenden

  • Select List with Submit refreshes page to top force users to scroll down

    Hello All,
    I have Dependent Select List where this functionality driving select list submit values to a subsequent select list.
    The "Select List with Submit" refreshes page where the unintended by-product is page refresh, which returns to top of page and therefore force users to scroll back down.
    In other words: I have a long form page where I have a Dependent Select List. So when you change the value of the 1st select list it refreshes the 2nd. This is all fine, but when the refresh occurs, the Form-focus returns to the top of page. This makes the users scroll back down to the lower end of the Form where they left off. This would make usability problems for users.
    Anyway we can make the Form return where to the area(Item or Region) where the user was during the selection of the Select List?
    Thanks in advance,
    Konstantine

    HURRAY!! I got it to work perfectly using anchors. I am adding this message to help future ApEx developers.
    I have been searching the Forum for 3 days and have read numerous postings. There was a lot of good discussion on anchors and linking from page to page. But, nothing exactly like my situation.
    Situation: Have a page, PG4, with a button, PG4_BUTTON, that redirects to a different page, PG7. PG4_BUTTON has its 'Display In Region' field set to PG4_REGION. When PG4 is run and the form displays, the PG4_BUTTON is located at the bottom. When the user would click PG4_BUTTON, the user would be taken to PG7. (this is good) The user enters some data in PG7 fields and then clicks a create button, PG7_BUTTON. PG7_BUTTON would submit data. An After Processing, Go To Page, Branch would be activated when this button was pressed and then the user would be returned to a refreshed PG4, at the top. This forces the user each time to have to scroll down to the bottom of PG4 to continue. (this is NOT good)
    Solution: On PG4, I edited the region, PG4_REGION. For the region 'Title' I added an anchor before the actual name. So it looked like this:
    {a name="REGION_TO_RETURN_TO"></a}PG4_REGION
    please note: where I have the curly braces above '{' '}' you need to put < the pointed and '>'
    Next, on PG7, I edited the Branch. On the 'Edit Branch' page, in the 'Action' region, I changed the 'Target type' field from 'Page in this Application' to 'URL'.
    To the 'URL Target' text area field I added this:
    f?p=&APP_ID.:4:&SESSION.::::::#REGION_TO_RETURN_TO
    So, there you have it. If you still need to read other postings, here are a couple of the sites I read:
    Re: Lists that go to items
    Re: URL target on a button.  What is the syntax??
    How to use <a name="top">Hello I'm at the top </a> tags in apex url ?
    Re: anchor or go to item from a branch
    http://www.oracle.com/technology/products/database/application_express/howtos/howto_navigate_in_a_page-1.6.html
    http://www.echoecho.com/htmllinks.htm
    http://www.htmlcodetutorial.com/linking/linking.html
    http://www.w3schools.com/HTML/html_links.asp
    Thanks,
    Maggie

  • E52 contact list lag when scroll down the list

    e52 contact list lag when scroll down the list, but when i remove my 2gb card ( provided within the box ) the scrolling is smooth. my firmware is latest...ALSO there is not lag problem in other menus and listings...i have no other issues with the fone...anyone with a solution ?

    you could have a corrupt card or its memory is just full
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • Scrolling down album list in iPhoto causes iPhoto crash

    Scrolling down to bottom of the album list in the sidebar in iPhoto causes iPhoto to lock-up with the spinning ball or crash altogether, any suggestions?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter the name of the crashed application or process in the Filter text field. Select the messages from the time of the last crash, if any. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V).
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    Still in the Console window, look under User Diagnostic Reports for crash reports related to the process. The report name starts with the name of the crashed process, and ends with ".crash". Select the most recent report and post the entire contents — again, the text, not a screenshot. In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.) Please don’t post shutdownStall, spin, or hang logs — they're very long and not helpful.

  • Scrolling Down in Movie List Slow - before & after 2.0 update

    I have an issue where scrolling down in a movie list is slow, yet going up is fine.
    Pressing down takes as much as 10 seconds before it will move to the next movie. Sometimes I only have 3 or 4 movies, and still the same issue.
    Doesn't seem to affect other lists, and if you hit the remote twice, it will go down twice, but with the 10 second pause in-between. It almost seems like it is waiting for the thumbnail view of the movie, and once that appears, it seems to behave.
    Have 10+ gigs free, have hard reset and downloaded all new updates again. I have Gigabit hardwire throughout (even though this only connects at 100Mbps), so I do not think it is a LAN issue.
    This is happening with 1.1 and 2.0.
    Most movies are 720P AVI or MKV files that I run through VisualHub 1.30, using AppleTV settings, Go Nuts, and x.264 - sorry I can't be more specific in this area.
    I am thinking something is either wrong with one or all of the videos, or the TV itself.
    I searched, and could not find anything quite like this (actually one thread that had no answer). So I am stumped...

    I had the same problem with music videos that I download then converted myself. The wait on the way down is caused by your aTV taking time togenerate a thumbnail to display for your movie. For reasons unknon to me, some movies are harder to generatethumbnails for than others. It even happens when I open itunes and highlight a video, and wait for the thumbnail to appear in the lower left corner....some take much longer than others.
    A fix I've figured out is to simply add your own artwork to all of your movies. You can make an image yourself, or just download any picture (relatively small) from the internet, and change the artwork for every movie to one picture (or you can put a different one for each movie...just google pic search a picture for your movie and drag it into the artwork window).
    If you do this for all of your movies, scrolling will be very simple...

  • ITunes 10.4.1.10 how to stop downloads of free news pods?  (right click delete doesn't work) also can't scroll down list of downloads!

    (ITunes 10.4.1.10) How to stop downloads of free news pods?  (right click delete doesn't work)
    Also can't scroll down list of downloads so as to pause them.  Would like to delete them as ISP has download limit.
    Thanks in advance!  (this seems to be a dumb problem of the software having a life of its own!)

    I have been talking to Apple support about this very problem. So far they have asked me to disable both Firewall and Anti Virus software (Windows Firewall and ESAT NOD32 anti virus) - this didn't work. Rebuild my library - this didn't work. Un-install all Apple applications and re-install - this didn't work. I have created a second user account on my PC and from that account (both accounts set as Administrator) I can activate Genius. This suggests to me that the problem is possibly linked to my original User Account, which is the one I always use. I am waiting for the next update from Apple and will post an update if/when the problem is resolved.
    What I also notice is about 2 seconds in to Step 2 of the Genius activation, the progress diagonal lines bar stops, and then starts again. As soon as I see this short freeze I know that the activation will fail.

Maybe you are looking for

  • Issue with variables and white space in powershell script that calls a command line command

    Guys, I have a question regarding this script. Each time I run it, it creates the share, but with a space after it. Also I need help figuring out how to put in the variable for the folder path. Below is the code $Users=Import-Csv C:\users2.csv foreac

  • Re:Primary Key in the UDO Table

    Hi All, In the UDO  table by default code is set as the primary key. How to set primary key for another field also?. Thanks in Advance. Regards, Madhavi

  • Reading Attributes using ABAP DOm

    Dear Collegues,                     I have source message given below PO --- element   Header     --- element      ID  --- element         SchemaID --- Attribute         SchemaAgencyID---  attribute Can any one provide code snippets using ABAp DOm fo

  • Services needed for PORTAL

    Hi, Can anybody please give a list of all services which must be up, and the order of starting them, needed for PORTAL. I have tried different services but i cannot find the good combination. Regards, Joshua

  • Firefox 10.0 now creates a new icon on Windows 7 Taskbar whn launched. Why?

    With prior versions of Firefox on Win 7 I had 1 Taskbar icon and I would go back to that icon to go to the program. Now when launching Firefox, it spawns a separate icon on the Taskbar and it is confusing, because I am used to going back to the origi