How can I "Take it from the Top" ?

I have coded a simple applet, using Buttons and the Graphics method.
The applet runs vertically longer than a single screen's height,
so the vertical scrollbar on my browser windo goes into action.
There are bottons running up and down the page.
When a button is pressed, an image is displayed at (0, 0) for a screen's width and height.
The problem arises when one of the buttons toward the bottom of the page is pressed.
The image gets "displayed" at (0, 0), but I wouldn't know it because I am looking at the bottom
part of the graphical display.
Is there a method which will reposition the display to the top of the page?
Perhaps a method regulating the main scrollbar to the browser window?
HTML would allow me to activate an anchor positioned at the top of the page.
This is the kind of functionality which would work in this case.

>
This sound more easily achieved than the one above (for me).>This comment confused me since the approach outlined in that reply, and the next one, seems to pursue neither of the ideas offered.
The first part of my idea might be expressed as..
// <applet code='BigScrollApplet' width='400' height='300' ></applet>
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class BigScrollApplet extends JApplet implements ActionListener {
    JLabel imageLabel;
    @Override
    public void init() {
        JPanel mainGui = new JPanel(new BorderLayout(3,3));
        mainGui.setBorder(new
            javax.swing.border.EmptyBorder(2,2,2,2));
        JPanel buttons = new JPanel( new GridLayout(0,1,1,1) );
        for (int ii=0; ii<500; ii++) {
            JButton button = new JButton("Image " + (ii+1));
            button.addActionListener(this);
            buttons.add( button );
        JScrollPane scrollPane = new JScrollPane(
            buttons,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
        mainGui.add( scrollPane, BorderLayout.WEST );
        imageLabel = new JLabel(
            "'Image' appears HERE!",
            JLabel.CENTER);
        // for the real applet, this label would be
        // in it's own scroll pane.
        mainGui.add( imageLabel, BorderLayout.CENTER );
        add(mainGui);
        validate();
    @Override
    public void actionPerformed(ActionEvent ae) {
        imageLabel.setText( ae.getActionCommand() );
}Have a look over this, then carefully read what I wrote, again. Let us see if you get it the second time around. (But for just 2 dukes, my patience will not last long..)
Edit 1:
Added @Override notation to init() method.
Edited by: AndrewThompson64 on Jun 27, 2009 6:13 AM
Edit 2:
Changed 'this reply' to 'that reply' in 1st sentence - so it makes sense.
Edited by: AndrewThompson64 on Jun 27, 2009 6:15 AM

Similar Messages

  • How can I delete apps from the app store? There seems to be every app I have ever downloaded and deleted since I got my phone in 2007. When I go to app store and select update apps there's a menu at the top that says purchased! I would like to delete hist

    How can I delete apps from the app store? There seems to be every app I have ever downloaded and deleted since I got my phone in 2007. When I go to app store and select update apps there's a menu at the top that says purchased and when I select it it shows every app I've ever had! I would like to delete the history please.
    Many thanks

    You cannot.
    The entire point of this is that you can redownload any and all of your past purchases.

  • Since the iPod Lightning connection is not supported, how can you take videos from your iPod 5th Gen to your tv?

    Since the iPod Lightning connection is not supported, how can you take videos from your iPod 5th Gen to your tv?

    Lightning TV out
    - Via Airplay to an Apple TV.
    or one of these cables.
    - http://store.apple.com/us/product/MD826ZM/A/lightning-digital-av-adapter?fnode=3 a
    - http://store.apple.com/us/product/MD825ZM/A/lightning-to-vga-adapter?fnode=3a

  • Lost home PC with my iTunes account on it in a home fire.  How can I take everything from my iPhone 4 and put it on my new PC?

    Lost home PC with my iTunes account on it in a small home fire.  How can I take everything from my iPhone 4 and put it on my new PC?  Is this even possible?  iPhone 4 / new PC running Win XP Pro.  I have backed up to iCloud recently so the info is out there, just need to bring it down onto my PC....
    Need HELP.............

    Copy from iPod to computer
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities
    The sync to iPhone
    iTunes: Syncing media content to iOS devices and iPod

  • How can I print stuff from the 'Help' file using my MacBook Air?

    How can I print stuff from the 'Help' file using my MacBook Air?

    Open the Help viewer, select a category then from the menu bar top of your screen, click File > Print

  • How can I take minutes from mysql date format

    how can I take minutes from mysql date format??
    example 10:30:00 is stored in my sql and I want to create 3 variables which will store hours, minutes and seconds..
    Cheers..

    "use application date format" is the choice you want.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • I have playlists on my original iPod but are not in the library.  How can I move them from the iPod to the library?

    I have playlists on my original iPod but are not in the library.  How can I move them from the iPod to the library?

    She can choose to either enable the setting on her iPod to Manually manage music and videos.  With setting enabled she can sync content to her iPod from multiple computers without it affecting whats already stored her iPod. For more information on syncing content to an iPod manually see this article. 
    http://support.apple.com/kb/ht1535
    However, I would recommend copying whats on her iPod to her iTunes library first.  There are several ways to accomplish this.  See this older post from another forum member Zevoneer discussing the different ways to do it.
    https://discussions.apple.com/thread/2452022?start=0&tstart=0
    B-rock

  • How can I get Data from the Sound cart in Labview? Does a VI exist?

    How can I get Data from the Sound cart in Labview? Does a VI exist?

    Yes, there are VIs for acquiring data from Sound cards. And examples too. If you don't have LabVIEW yet, do a search on NI's site for example VIs.
    Khalid

  • How can I transfer movies from the apple tv to the ituenes, to watch in the ipad?

    how can I transfer movies from the apple tv to the ituenes, to watch in the ipad?

    Is this a rental or a purchase?
    Rentals on ATV cannot be transferred.
    The 2nd and 3rd gen model do not have accessible storage. Some movie purchases are stored in iCloud (if you live in the US) where you can reload in iTunes on your computer)
    If you own the 1st gen aluminum model then it should be set to sync
    http://support.apple.com/kb/HT1143

  • Wanted to put a file via a drag and drop into applications on my finder sidebar.  it missed and landed in the sidebar itself.  i can not remove it.  i can not even highlight it.  how can i remove it from the sidebar.

    I wanted to put a file via a drag and drop into applications on my finder sidebar.  it missed and landed in the sidebar itself.  i can not remove it.  i can not even highlight it.  how can i remove it from the sidebar.

    Try holding down the Command key and dragging the file well off the sidebar.
    Hope this helps.

  • How can i remove comments from the "tell your frie...

    How can I remove comments from the "tell your friends how you're doing" section?

    Please do a Skype reset.
    Exit Skype : From the system tray >> right click on the skype icon and click "Quit"
    Press WinKey+R
    Type: %appdata% and press Enter.
    Rename the folder "Skype" to "Old_Skype"
    Run Skype.
    You will need your password to re-log on, and re-set any options from default
    Regards,
    Tamim
    Location - Dhaka | Bangladesh - Standard Time Zone: GMT/UTC + 06:00 hour
    If one of my replies has adequately addressed your issue, please click on the “Accept as Solution” button. If you found a post useful then please "Give Kudos" at the bottom of my post, so that this information can benefit others.

  • How can I remove items from the open a recent file menue.

    How can I remove items from the "Open a Recent File" menue. Many other applications allow the clearing of that file . Is this possible in Adobe Reader 10.1.2 ? If so how?

    See this previous topic: http://forums.adobe.com/message/3759596
    It is for Acrobat, but the registry entries are similar for Reader.

  • How can I remove things from the home screen

    How can I remove things from the iPad home screen?

    Hold down an icon until all icons start to wiggle.
    You then have two choices:
    1.  Drag the icon to the right so it goes to a different (non-home) screen.
    2.  If the icon is not supplied by Apple as part of iOS, you will see a small "X" in the upper left corner.  You can click that to delete the icon.
    Stop the wiggling by pressing the home button.

  • How can i remove something from the favourite in finder?

    how can i remove something from the favourite in finder?

    previously you solved my problem but this time my preferneces>side bar is not displaying the item which i want to remove

  • How can I remove icons from the Finder sidebar?  Were transferred when I set up laptop from my desktop computer.  Tried dragging off but that didn't work.

    How can I remove icons from the Finder sidebar?  Transferred info from my Mac Pro desktop computer (using target mode) and there were folder icons on the Mac Pro Finder sidebar that are now on the MacBook Finder sidebar, even though these folders do not exist on the MacBook.  Tried to drag them off, which is the usual way to get rid of folders that the user adds to the sidebar (as opposed to those that can be added via the Customize Toolbar dropdown menu) but was unsuccessful.  I then unchecked all of the Customize Toolbar menu items and the folder icons still remained.  What else can I do?

    Did you hold the Command (Apple) key while dragging them off the sidebar? That usually makes them go *poof*.

Maybe you are looking for

  • User exist for purchase order with account assingment

    As our org has gone with Project specific stocks. we are maintaing seprate "Z" table which conatisn datas like WBS element, material code & material price. And when we raise a P.O for a particular project with WBS element and when we enter material c

  • Outlook Connector and shared calendar

    Hi. Looking for some help troubleshooting an issue with shared calendar functionality from Outlook using the Connector. All server bits are JES-R2. Connector version is 6.0.129. Connector is working for the most part, but when I try to subscribe to a

  • Any BAPI or FM to update Goods Issue tables In SD

    Hi All, Is there any function module or BAPI which can update the tables LIKP LIPS. I am trying update the some fields in this table which are coming from legacy system. Please assist waiting for your reply Badari

  • Table Entry Insert - Java Programming Question

    I design table input/output interface with adding / deleting entry function. Table data will be saved in AbstractList by BAPI. In Controller implementation tab, I created "input" under WD_init()    Bapi_Entrysheet_Create_Input <b>input</b> = new Bapi

  • Is it possible to replace the battery of a MacBook Air?

    hello, I just want to know if I can replace the battery of my MacBook Air?