JLayeredPane with JScrollPane inside

Hi all,
I am making an applet with a fairly complex gui. The main part is a content window that has a jpanel with another jpanel and a jscrollpane inside, each of which have a bunch of components. From there I wanted to add a help window that popped up when you hit the help button. What I did is I got the JLayeredPane from the applet using getLayeredPane(), and I added the help window to the popup layer, and the content window to the default layer. I'm using a null layout and manually setting the bounds of everything. All the panels draw correctly, but when I open the help window, it displays inside the JScrollPane; i.e. it moves when I scroll, and the contents of the scroll pane are displayed on top of the help window. Here is some of my code, if I wasn't clear:
          //this grabs the applet's layered pane. The wrapper pane (with all the traces)
          //is on the default layer, and the help window (and any other popups) will go in the popup layer
          appletLayered = getLayeredPane();
          appletLayered.setLayout(null);
          //create the help window that will be displayed when someone presses help
          helpWindow = new HelpWindow(getCodeBase().toString());
          appletLayered.add(helpWindow, JLayeredPane.POPUP_LAYER);
          helpWindow.setBounds(50,50,400,450);
          appletLayered.add(wrapperPane, JLayeredPane.DEFAULT_LAYER);
          wrapperPane.setBounds(0,20,700,550);Does anyone know why it is doing this? Should I just do this whole thing a different way, or is there an easy solution that I'm missing.

Swing related questions should be posted in the Swing forum.
From there I wanted to add a help window* that popped up when you hit the help button.Then use a JDialog (or a JWindow), not a layered pane.
If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.

Similar Messages

  • HOWTO: JLayeredPane with a scrollable image background

    Hi,all
    I want to construct a JLayeredPane with a scrollable image background,
    so I do the following,but the result is: the Image displayed,but without scroll bars,but when I expand the window,the vertical scrollbar appeared,why?
    I am confusing...who can help me ?
    class ImagePanel extends Jpanel {
    public void paintComponent(Graphics g) {
    //paint the icon here
    class ImageScroller extends JScrollPane {
    public ImageScroller() {
    ImagePanel panel = new ImagePanel();
    getViewport().add(panel);
    //set horizontal and vertical scrollbar's value to the icon's value
    class MapPanel extends JLayeredPane {
    public MapPanel() {
    setLayout(new BorderLayout());
    ImageScroller is = new ImageScroller();
    setLayer(is,0,0);
    add(is,BorderLayout.center);
    }

    Hi,
    I too am confused as to why you've used getViewport().add instead of setViewportView(). with that i had no problems. try that. i'm not sure if it'll solve the problem though.
    Regards,
    Phani Kanuri

  • HT4061 good morning! I just did a software update on my phone (finally) last night and now my phone will not come on.  All it keeps showing is the charger pointing up to a blue circle with iTunes inside and will not go any further.  Can ANYone please expl

    Good Morning,
    I just did a software update on my phone (finally) last night and now my phone will not come on.  It keeps showing the charger pointing up to a blue circle with iTunes inside and will not go any further.  Can ANYONE help me please???

    The phone is in restore mode and the picture is telling you what to do. Connect the phone, by cable, to iTunes in the computer you normally use for syncing, and retore the phone.

  • I can't export my video which contains only photos, sound tracks nor play it in fullscreen iMovie it shuts down. And now my whole file won't open at all it'll open with nothing inside ??

    I can't export my video which contains only photos, sound tracks nor play it in fullscreen iMovie it shuts down. And now my whole file won't open at all it'll open with nothing inside ??

    I also have Jolly's problem. I found the iMovie 9.0.9 folder and tried to launch the older version of iMove. It would not launch. I removed all of the iMovie preferences from the Preferences folder, removed iMove 10 from the applications folder, and restarted my Mac. iMove 9.0.9 still won't launch and I can't access my videos created with the older version of iMovie. Is there a way to uninstall iMovie 10 and reinstall iMovie 9.0.9?
    I am running Yosemitie on a  iMac.
    Paul

  • I just updated to 10.8.4 and my mail program is showing a series of boxes with AAAAs inside them instead of the email addresses. Also when on Safari web pages are displaying the same AAAAAs instead of type. Firefox displays fine. Can someone help me?

    I just updated to 10.8.4 and my mail program is showing a series of boxes with AAAAs inside them instead of the email addresses. Also when on Safari web pages are displaying the same AAAAAs instead of type. Firefox displays fine. Can someone help me?

    Restart your Mac and immediately hold down the Shift key when you hear the startup chime to boot into Safe Mode. Keep holding the Shift key until you see a progress bar towards the bottom of the screen. You can let go of the Shift key at that point.
    OS X asks you to log in (you will get this screen on a Safe Mode boot even if your Mac is set to automatically log in). Let the Mac finish booting to the desktop and then restart normally. This will clear Font Book's database and the cache files of the user account you logged into in Safe Mode.
    Next, close all running applications. From an administrator account, open the Terminal app and enter the following command. You can also copy/paste it from here into the Terminal window:
    sudo atsutil databases -remove
    Terminal will then ask for your admin password. As you type, it will not show anything, so be sure to enter it correctly.
    This removes all font cache files. Both for the system and the current user font cache files. After running the command, close Terminal and immediately restart your Mac.

  • Controlling amount of rows in a jtextfield with jscrollpane

    As part of a school assignment, I we have output going to a textfield that is scrolled with JScrollPane. Part of it is for when it comes to 400 lines, and another line is added, that the first line of the output is erased, and the new one is added. Are there simple methods of the API to do this, or should I perhaps store all the output in a string, use an int to count, and then substring it to the first \n ?
    Thanks for the replies. Please dont give me direct answers, but help to find the answer, as I do not want to cheat.

    While I did not do a SSCCE, mine is not overly complicated on output. The first part of this was building a console client to connect to a server. This part is adding a GUI to it, with a bit of extra functionality. My writeMessage method of the console did a System.out.println. It now does a output.setText(output.getText() + "\n"+ date + msg); msg being the String parameter in the method. output is the JTextArea I have, and is passed to my Client object.
    The output works fine, its just trying to cut the first line out when max is reached. Just doing 20 lines for now. I tried adding this, but it started cutting more and more off the start of the text.
    if(output.getLineCount() > 20) {
         try {
              int firstRow = output.getLineEndOffset(0);
              output.setText(output.getText().substring(0, firstRow));
         catch(BadLocationException e) {
              e.printStackTrace();
    }Edited by: agm_ultimatex on Jun 29, 2009 12:35 PM

  • Unable to Load CSV file with comma inside the column(Sql Server 2008)

    Hi,
    I am not able load an CSV file with Comma inside a column. 
    Here is sample File:(First row contain the column names)
    _id,qp,c
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    When i specify the Text Qualifier as "(Double quotes) it work in SQL Server 2012, where as fail in the SQL Server 2008, complaining with error:
    TITLE: Microsoft Visual Studio
    The preview sample contains embedded text qualifiers ("). The flat file parser does not support embedding text qualifiers in data. Parsing columns that contain data with text qualifiers will fail at run time.
    BUTTONS:
    OK
    I need to do this in sql server 2008 R2 with Service pack 2, my build version is 10.50.1600.1.
    Can someone let me know it is possible in do the same way it is handle in SQL Server 2012?
    Or
    It got resolved in any successive Cumulative update after 10.50.1600.1?
    Regards Harsh

    Hello,
    If you have CSV with double quotes inside double quotes and with SSIS 2008, I suggest:
    in your data flow you use a script transformation component as Source, then define the ouput columns id signed int, Gp unicode string and C unicode string. e.g. Ouput 0 output colmuns
    Id - four-byte signed
    gp - unicode string
    cc - unicode string
    Do not use a flat file connection, but use a user variable in which you store the name of the flat file (this could be inside a for each file loop).
    The user variable is supplied as a a readonly variable argument to the script component in your dataflow.
    In the script component inMain.CreateNewOutputRows use a System.IO.Streamreader with the user variable name to read the file and use the outputbuffer addrow method to add each line to the output of the script component.
    Between the ReadLine instraction and the addrow instruction you have to add your code to extract the 3 column values.
    public override void CreateNewOutputRows()
    Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
    For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
    string line;
    System.IO.StreamReader file = new System.IO.StreamReader( Variables.CsvFilename);
    while ((line = file.ReadLine()) != null)
    System.Windows.Forms.MessageBox.Show(line);
    if (line.StartsWith("_id,qp,c") != true) //skip header line
    Output0Buffer.AddRow();
    string[] mydata = Yourlineconversionher(line);
    Output0Buffer.Id = Convert.ToInt32(mydata[0]);
    Output0Buffer.gp = mydata[1];
    Output0Buffer.cc = mydata[2];
    file.Close();
    Jan D'Hondt - SQL server BI development

  • Mouse motion listener for JTable with JScrollpane

    Hi All,
    I have added mouse motion listener for JTable which is added in JScrollPane. But if i move the mouse, over the vertical/horizontal scroll bars, mouse motion listener doesn't works.
    So it it required to add mousemotionlistener for JTable, JScrollPane, JScrollBar and etc.
    Thanks in advance.
    Regards,
    Tamizhan

    I am having one popup window which shows address information. This window contains JTable with JScrollPane and JButton components to show the details. While showing this information window, if the mouse cursor is over popupwindow, it should show the window otherwise it should hide the window after 30 seconds.
    To achieve this, i have added mouse listener to JPanel, JTable, JButton and JScrollPane. so if the cursor is in any one of the component, it will not hide the window.
    but for this i need to add listener to all the components in the JPanel. For JScrollPane i have to add horizontal, vertical and all the top corner buttons of Scroll bar.
    Is this the only way to do this?

  • Error using JTextArea with JScrollPane

    hi,
    I am using JTextArea with JScrollpane. I am getting a problem in selecting the text in text area. I am searching for some text in the text area and selecting it if search successful. The problem is that the the scrollbar position didnt set to the correct location. So sometime the text selected is not visible in the scrolpane. Any help regarding this will be highly appreciated.
    Regards
    Danish

    What about sth like this:Rectangle r = textarea.modelToView(textarea.getSelectionStart());
    scrollpane.scrollRectToVisible(r);Just a guess, no idea whether it works.

  • HT3412 I just ordered and received 2 large Hardcover photo books and one arrived with the inside binding messed up. Do you know how this can get corrected?

    Have you tried returning a photo book that has a binding problem? I just ordered 2 large hardcover photobooks and one arrived with the inside binding messed up. Do you know how this can get corrected? They were over $80 and it seems they should not be flawed. I would appreciate any tips. lindajenkins

    Contact Apple Support - link at the bottom of every page of these forums
    LN

  • What can I do I got my iPad fixed at a different brand place but not apple and I have ended up a few weeks later with dust inside my screen is their anything apple can still do for me?

    What can I do I got my iPad fixed at a different brand place but not apple and I have ended up a few weeks later with dust inside my screen is their anything apple can still do for me?

    If another person or company serviced your iPad, your warranty has been voided.  Apple will do an out-of-warranty exchange.  Have you contacted the original service provider, and complained?

  • Handling ActiveX events with Javascript inside BSPs

    Hi,
    Has anyone any experience with handling events from ActiveX objects (using the <object> tag) with Javascript, inside BSPs?
    I'm developing solely for the IE browser. Reading other threads, I know that the usual way this is done is via the below code excerpt:
    <i><script type="text/javascript" for="MyObject" event="Object_Event">
         js_function();
    </script></i>
    I create a HTML page, with the <object>, <script..for..event> tags, etc. Everything works fine when the page is run from my local system. However, when the code is run from WebAS (Activate then Test (F8)), the ActiveX object loads fine. But the javascript does not respond to events thrown by the ActiveX object.
    I wonder if anyone can share their experiences on this issue.
    Thank you.
    Amos

    It's the Skype4COM (v1.0.0.17) wrapper for the SkypeAPI, available at https://developer.skype.com/Download
    (Note: NOT the v1.0.0.16, which comes with the Skype ActiveX Tools package).
    I'm trying to use javascript to handle the event "CallStatus", thrown by Skype4COM, as shown in the code excerpt below.
    <i><script language="javascript" type="text/javascript" for="Skype" event="CallStatus(Call, Status)">
                 handleCallStatus (Call, Status);
    </script></i>
    It works locally, but not when in a BSP.
    It's rather interesting to mess with Skype calls from a webpage. Do let us know how your experience goes
    Amos

  • Need help with MC with links inside

    Anyone can shine some light on trying to reproduce something
    similar to this?
    http://www.focus.ca/home.html
    What I need is how to do one of those tabs that aniamtes down
    and reveals links inside. I have been at this for days.
    I am very new to flash and need more assistance on the
    construction of this project.
    So far, I know how to make a MC and animated it for
    rollover/rollout, but the link inside won't work because the action
    for the MC is interferring with the inside button actions. So, what
    is my next step? I have my MC on one frame in the main timeline and
    need to perform all animation inside that and add buttons also?
    Would I put an Insible Button in their too?
    I need help?

    As example of a text based navbar like Roddy suggested can be seen here: Text Based Navbar. With it you can have complete control of the font (just use a Web Safe Font, color, rollover color and size. You can then copy and paste the text box to each page.
    OT

  • I can not  daowload to the I movie a DVD with video inside

    I am unable to copy Dvd made by mi 
    in to IMOVIE  .... 
    i check the dvd on a tv via DVD,   and is working fine
    i can download  photo with music no problem    but not    a dvd   with video inside
    thank you     TONY

    You need to rip the DVD to mp4 before importing.
    Download Handbrake (free, Google it).
    Insert the DVD to your computer. DVD Player will come up. Quit it.
    Open Handbrake. Rip the DVD to a file on your desktop.
    Import that file from your desktop into iMovie.

  • What kinds of error iCloud symbol with ! inside?

    added song purcahsed outside of iTunes to library. iCloud symbol shows cloud with ! inside. what kind of errors produce this symbol? how to correct?

    See http://support.apple.com/kb/ts4124.

Maybe you are looking for

  • How to use HTML form vi

    Hi, I am trying to trying to fill up information into a website using labview. It has 3 text inputs and a image submit button. I was wondering if it is possible to fill the HTML with labview. Another question is that if anyone knows an example VI for

  • SQL error -1017 at location db_connect-2

    I scheduled Check and update optimizer statistics job in DB13 and I get this error msg. BR0301E SQL error -1017 at location db_connect-2 ORA-01017: invalid username/password; logon denied Connect to database instance BQ1 failed......... BRCONNECT ret

  • Lr 3.6 - Unable to save own tone curve settings

    Currently I'm trying to save an own "tone curve" but in the menu no entry to save it appears. In my understanding an entry "Eigene" (or "Own") should appear as soon as I am changing the tone curve manualy. I am using the latest version of Lightroom 3

  • ITunes skips and stutters while working.

    iTunes has begun sounding terrible when I'm doing other work that is processor intensive.  Whether streaming or playing files, while I'm editing images in Adobe Lightroom.  OS 10.7.2 iTunes 10.5.  Its nearly unlistenable.

  • HT2518 Migration Wizard: PC - hard drive - Mac

    Hello all, I've got an iPhone, recently got an iPad and now about to replace my Windows 7 laptop with a MacBook Air I went to use the migration wizard but it was so slow and I can't wait to play with my new toy! As the Air only has Wi-Fi, is there a