JScrollPane bars do not show

Hi,
I add the Panel that contains a large image to a scroll pane. However, the image is large, and the scroll bars do not show.
    JScrollPane ScrollPaneScroller = new JScrollPane();
    this.getContentPane().add(ScrollPaneScroller, BorderLayout.CENTER);
    ScrollPaneScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    ScrollPaneScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    ScrollPaneScroller.getViewport().add(PanelwithImage, null);
    PanelwithImage.setCenter(this.getWidth(), this.getHeight());Also, how to display the center of the image?

Aw hell...
import java.awt.Dimension;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.*;
public class BigDukeImage {
  public static final String IMAGE_PATH = "http://"
      + "duke.kenai.com/nyanya/NyaNya.jpg";
  private static final Dimension SCROLLPANE_SIZE = new Dimension(900, 700);
  private static void createAndShowUI() {
    Image image = null;
    try {
      URL url = new URL(IMAGE_PATH);
      image = ImageIO.read(url);
      JLabel label = new JLabel(new ImageIcon(image));
      JScrollPane scrollpane = new JScrollPane(label);
      scrollpane.setPreferredSize(SCROLLPANE_SIZE);
      JFrame frame = new JFrame("Big Duke Image");
      frame.getContentPane().add(scrollpane);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.pack();
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
      JScrollBar vertSBar = scrollpane.getVerticalScrollBar();
      JScrollBar horzSBar = scrollpane.getHorizontalScrollBar();
      vertSBar.setValue(
          (vertSBar.getMaximum() - vertSBar.getVisibleAmount()) / 2);
      horzSBar.setValue(
          (horzSBar.getMaximum() - horzSBar.getVisibleAmount()) / 2);
    } catch (IOException e) {
      e.printStackTrace();
  public static void main(String[] args) {
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        createAndShowUI();
}

Similar Messages

  • Using firefox 14.0.1. Loading a link using right-click and "Open Link In New Window", results in new window opening but address bar does not show URL..

    Using firefox 14.0.1. Loading a link using right-click and "Open Link In New Window", results in new window opening but address bar does not show URL. However, if I right click on a link and select "Open Link In New Tab", the Tab shows URL in address bar. So it's working when it's a New Tab but not a New Window.

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • On windows 8.1 charms bar does not show up and the touch functionality is also degraded

    upgraded my elitepad 900 to windows 8.1 . after this the charms bar does not show up and the touch functionality is also degraded while playing games. i believe i need the latest synaptics gesture suite.  Cannot find it. Please help.

    I am sorry, but to get your issue more exposure I would suggest posting it in the commercial forums since this is a commercial product. You can do this HERE.
    HP ElitePad 900 G1 Tablet Support
    TwoPointOh
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom to say “Thanks” for helping!

  • My "awesome bar" is not showing up! How can I get it to show?

    My "awesome bar" is not showing up at the top of my page! How can I get it to turn back on? I have all of my plug-in information up to date. Help!

    If the menu bar is hidden then press the F10 key or hold down the Alt key, that should make the menu bar appear.
    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible: "View > Toolbars"
    * If items are missing then open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout"
    * If a missing item is in the toolbar palette then drag it back from the Customize window on the toolbar
    * If you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar set up.
    See also:
    * http://kb.mozillazine.org/Toolbar_customization
    * https://support.mozilla.com/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • In Photoshop Element 9, when opening the Organise section, the top bar does not show File, etc.?

    Just reinstalled Photoshop Ele,ents 9 onto Windows 7.
    In the Editt part,on opening, all is well.  This clearly show the top bar where youcan call and enter from the file to work with items on your computer.
    However, on the Organise section, this to bar does not show at all, therefoere you are unable to do any work as you cannot import items from anywhere.
    How do I get this to work now.

    You should ensure your font/text size is 100% or 96 dpi in the Windows control panel or you may need to adjust the native screen resolution of your monitor. Alternatively try keyboard shortcuts to access the menus.
    File – Alt+f
    Edit – Alt+e
    Find - Alt+i
    View – Alt+v
    Window – Alt+w
    Help – Alt+h

  • THE ADDRESS BAR IS NOT SHOWING

    THE ADDRESS BAR DOES NOT SHOW WHERE IS IT
    == This happened ==
    Every time Firefox opened
    == I DOWNLOADED IT

    Be sure that the Navigation Bar is being displayed. On the Menu Bar click View > Toolbars , if there is no check mark next to Navigation Toolbar, click on Navigation Toolbar to place a check mark next to it.
    <u>'''Can't see the Menu Bar'''</u> (File, Edit, View, History, Bookmarks, Tools, Help)?
    Turning the Menu Bar on and off is a new feature in version 3.6.
    ''(Linux & OSX see: [[Menu bar is missing]] )''
    <u>''Windows'' Method 1.</u> '''''Hold down''''' the key and press the following letters in this exact order: V T M
    <u>''Windows'' Method 2.</u> Press and release the key. The Menu Bar will be displayed; then choose ~~red:V~~iew > ~~red:T~~oolbars and click on ~~red:M~~enu Bar.
    The Menu Bar should now be displayed permanently, unless you turn it off again using View > Toolbars . Check mark = displayed, NO check mark = not displayed.
    See: http://support.mozilla.com/en-US/kb/Menu+bar+is+missing
    <u>'''Navigation Toolbar, Bookmarks Toolbar and other Toolbars'''</u> under View > Toolbars . Clicking on one of them will place a check mark (display) or remove the check mark (not displayed).
    <u>'''To display the Status Bar'''</u>, View, then click Status bar to place a check mark (display) or remove the check mark (not displayed).
    <u>'''Full Screen mode'''</u>
    http://kb.mozillazine.org/Netbooks#Full_screen
    Also see:
    ''' [[Back and forward or other toolbar buttons are missing]]'''
    '''[[Navigation Toolbar items]]'''

  • The crop tool in my tool bar is not showing up. Any ideas why this is? Please Help

    The crop tool in my tool bar is not showing up. Any ideas why this is? Please Help

    It's the 3rd one on Photoshop standard.  As Curt implies, each little icon position has several possibilities you can display, allowing you some customization of your Tools panel.  Click and hold the mouse button to see each of the choices.
    -Noel

  • Capacity bar does not show detail in itunes

    Capacity bar does not show detail in itunes 10 when iphone is connected via wifi
    when I connect via cable it corrects itself
    running os 5.01

    PLEEEEASE
    i bought Apple TV 2 days ago but i couldnt bind it to my i tune??? i tried everything , my apple TV doesnt show on my I tune ?? theu are on the sam WIFI network ( Time capsule) same account and both updated !!
    can anybody help me to solve this problem

  • The scroll bar does not show in my SaaS application.

    I have a spreadsheet application and the scroll bar does not show on FF4. I need the scroll bar to navigate the app.

    table is surround by panelStretchLayOut but I examine this and has no difference.
    scrollBar show for data under one milion records!!
    and here is my code:
    <af:popup id="t1DataPopup"
    binding="#{B1Bean.t1DataPopup}">
    <af:dialog id="d9"
    type="ok"
    affirmativeTextAndAccessKey="#{viewcontrollerBundle.okLabel}"
    title="#{bindings.R1.hints.label} : #{bindings.R1.inputValue}"
    inlineStyle="position: absolute; left: -410px; top: -200px;">
    <af:panelStretchLayout id="psl4" topHeight="30px"
    inlineStyle="width:800px; height:400.0px;">
    <f:facet name="bottom"/>
    <f:facet name="center">
    <af:table value="#{bindings.s1Graph.collectionModel}"
    var="row"
    rows="#{bindings.s1Graph.rangeSize}"
    emptyText="#{bindings.s1Graph.viewable ? viewcontrollerBundle.noDataToDisplayMessage : viewcontrollerBundle.accessDeniedMessage}"
    fetchSize="#{bindings.s1Graph.rangeSize}"
    rowBandingInterval="0"
    filterModel="#{bindings.s1GraphQuery.queryDescriptor}"
    queryListener="#{bindings.s1GraphQuery.processQuery}"
    filterVisible="true" varStatus="vs"
    selectedRowKeys="#{bindings.s1Graph.collectionModel.selectedRow}"
    rowSelection="single" id="t1"
    partialTriggers="::s1Graph ::s1BarGraph ::s1HoriBarGraph ::s1AreaGraph"
    autoHeightRows="-1">
    <af:column sortProperty="T1Stmp"
    filterable="true" sortable="true"
    headerText="#{bindings.s1Graph.hints.T1Stmp.label}"
    id="c94" align="center">
    <af:outputText value="#{row.T1Stmp}"
    id="ot139"/>
    </af:column>
    </af:table>
    </f:facet>
    <f:facet name="start"/>
    <f:facet name="end"/>
    <f:facet name="top">
    <af:panelGroupLayout id="pgl20">
    <af:commandButton text="#{viewcontrollerBundle.saveAsExcelCommandButtonLabel}"
    icon="/Images/excel.gif"
    id="cb9">
    <af:exportCollectionActionListener exportedId="t1"
    type="excelHTML"
    title="T1Data"/>
    </af:commandButton>
    </af:panelGroupLayout>
    </f:facet>
    </af:panelStretchLayout>
    </af:dialog>
    </af:popup>
    and fetchsize=25
    Edited by: Mansoor on Jul 17, 2012 8:28 AM

  • Menu bar does not show on screen?

    Menu bar does not show on screen.

    I'll assume your profile is wrong (10.4.7?) and you are using Lion in full screen mode.  If so click the double arrows in the menu bar which should appeare if you mouse into the menu bar area.
    If that isn't the case then are you zoomed in?  Contol + fingler drag on mouse (or scroll wheel) zooms in or out (see Mouse preferences, Screen Zoom, look at the little movie).

  • I have Windows 8. The address bar does not show on firefox. How do I fix this?

    The address bar does not show. How do I get it to appear?

    * If the menu bar is hidden then press and hold the Alt key down, that should make the Menu bar appear. Make sure that you have the Navigation Toolbar and other toolbars visible: View > Toolbars .
    * If items are missing then see if you can find them in the View > Toolbars > Customize window.
    * If you see the item in the Customize window then drag it back from the Customize window to the Navigation toolbar.
    * If you do not see that item then click the Restore Default Set button in the View > Toolbars > Customize window.
    See also [[Back and forward or other toolbar buttons are missing]] and [[Customize navigation buttons like back, home, bookmarks and reload]] See http://kb.mozillazine.org/Toolbar_customization

  • Horizontal Scroll Bar does not show

    I have a method which creates a table with values and displays it in a dialog. However, the horizontal scroll bars do not appear, even though there is are columns that are not seen in the view. Here is my code:
         private void setTable()
              Object columns[] = headerLST.toArray(),
                        rows[][] = new Object[rowLST.size()][headerLST.size()];     
              for(int x = 0; x < rowLST.size(); x++)
                   java.util.List list1 = (java.util.List)rowLST.get(x);
                   for(int y = 0; y < list1.size(); y++)
                        rows[x][y] = (String)list1.get(y);     
              DefaultTableModel tValues = new DefaultTableModel(rows, columns);
    JTable tableA = new JTable(tValues);
         tableA.setRowHeight(27);
                   tableA.setRowSelectionAllowed(false);
                   tableA.setColumnSelectionAllowed(false);
                   tableA.setFont(new Font("Dialog", Font.BOLD, 12));
              int minColWidth = 120, maxColWidth = 200;
              for(int y = 0; y < tableA.getColumnCount(); y++)
                   TableColumn tbc = tableA.getColumnModel().getColumn(y);
                   tbc.setPreferredWidth(minColWidth);     
                   tbc.setMinWidth(minColWidth);
                   tbc.setMaxWidth(maxColWidth);
              scrollA = new JScrollPane(tableA);
              this.getContentPane().add(scrollA, BorderLayout.CENTER);
    Can someone tell me what I am missing?
    Thanks
    Augustine

    You need this
    tableA.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    otherwise it will always try and fit the table to the space available

  • Unlock slide bars are not showing up anymore...

     I recently noticed that unlock slide bars that were originally on my DX are not showing up anymore.  When I wake the phone up it goes directly to the home screen.  Anyone know why or have this issue?

    Do you have an app called No Lock? If not try a battery pull and see if that helps.

  • Help! my scroll bar (elevator bar) is not showing up now--how can I fix it; it's driving me crazy!

    The scroll (elevator) bar has suddenly become very faint, hard, to find, and in some cases is not showing up at all. The arrows at the top and bottom show up, but not the scrolly tool itself. I have tried changing the themes/display, but it doesn't seem to matter. This is making me so mad, can someone help?

    Backup, backup, backup...
    T-21 wrote:
    Hello.
    I did not touch my computer the past week, I've only been messing with my laptop.  I had my computer off a whole day.  I turn it on, open iTunes, and everything is gone.
    Is your laptop a different computer than your computer?
    You have two computers?
    iTunes is missing everything from which one/both?
    I system restore.  Everything is gone.  None of my podcasts, apps, or music files are there.
    Do you mean you reinstalled the system from scratch?
    Yes, that tends to delete everything.
    Or you restored everything from a backup?
    Directions on where to go to download all past purchases?
    Selete Store on the left side of iTunes.
    Make sure you are signed in.
    Click on Purchased on the right side under Quick links to redownlaod your purchases.
    Then make sure to regularly backup, backup, backup all your important data .

  • My lightroom navigation bar is not showing up. How do I get it back?

    My lightroom navigation bar at the top is not showing up. How do I get it back?

    Try the F key.  You may have set Full-screen mode.

Maybe you are looking for

  • Remote logon through SM59, datbase operations in target system

    Hello,             I am logging in remotely from sys1 to sys2. In sys2 there is a userexit which triggers during the sap login i.e EXIT_SAPLSUF_001, in this exit i have written a select query by which i will check a conditions ,depending on the condi

  • Consignment Fill Up Error

    All, Please help in below mentioned problem on Consignment Fill up Doc... I have created the sales document for Consignment Fill up as CF. Created an Item Category for the Same purpose as VBN. Assigned them together using VOV4. with item group as nor

  • Why my bb9900 software is not updated

    hi ,  right now i am using bold 9900 and my device soft ware is  7.0 bundle 1315 (v7.0.0.250 , platform 5.0.0.448) i came to know that there are some updates regarding the bundle but in my case if i connect to desktop manager it doesnot show me any u

  • Spry Radio Button widget for CS3

    Hi, I can't seem to find a definitive answer if the Spry Radio Button widget for CS3 is available or not. The help menu says that it's there, but I can't find it. I've updated my Spry and checked the web and can't find an answer. Can anyone help me o

  • Why does the format change when i share a presentation?

    I develop a presentation in Keynote in my Imac.  I then place it in a flash drive and pass the presentation to my MacBook.  When I open it, all the fonts are changes, it has added bullets, the sizes have changes and many of the pictures are gone.  I