Movable components interacting with JScrollPane

I am creating movable components. The class is designed as an extension to JPanel and contains a label and a textfield. The Panel responds to the mouse and moves itself around a JPanel which is inside the JScrollPane according to the user. This will eventially be a layout process so users of this program can make things look the way they want.
I can't seem to get the JScrollPane to recognize when a component is moved outside it's immediate area and scroll. I'm looking through the archives but I am not running into answers because I don't know what to look for.
Do I need to look at the scrollable interface? Do I need to throw an event which will notify the Scrollpane. Any hints or answer would be greatly appreciated!
Here is my main class definition which may provide some clues:
public static void main (String[] args) {
JFrame view = new JFrame( "Testing" );
JPanel mainPanel = new JPanel();
JScrollPane scrollPane = new JScrollPane( mainPanel );
mainPanel.add( new movablePanel( "Label", "Testing" ) );
mainPanel.add( new MovablePanel( "Label", "Text" ) );
view.getContentPane().add( scrollPane );
view.validate();
view.repaint();
view.show();

Here's what you should do.
In your panel's mouseDragged or mouseMoved event handler, add:
x = this.getLocation().x;
y = this.getLocation().y;
maxX = this.getLocation().x+this.getSize().width;
maxY = this.getLocation().y+this.getSize().height;
scrollminX = ScrollPane.getViewPort().getViewPosition().x
scrollminY = ... getViewPosition().y
scrollmaxX = scrollminX + ScrollPane.getViewPort().getExtentSize().width;
scrollmaxY = scrollminY + ... getExtentSize().height
now test to see if everything is in range

Similar Messages

  • How does Openscript Interact with web components ?

    I was wondering how does openscript interact with web objects (eg Edit boxes, buttons), is it through some JNI api ? If yes in which package I can find this ?

    I am going to make the assumption from your comments that you are asking about using OpenScript to test applications based on Apple's WebObjects server. If that is a bad assumption let me know ...
    The scripts you build against the application will work in a similar manner to those that are built against other java based application servers in that the tool will be using the various key attributes of the html objects to locate them and replicate actions against them. Typical UI driven scripting ... That said, if your testing brings you down a level from the UI and you are trying to test some of the components of the application server tier specifically, well, then you might have to write your own java code to do it.

  • JList of components you can interact with

    Does anyone know how to populate a JList component with components you can interact with? The renderer you create to render the elements just uses the component paint method to paint the component but you can't click on it etc. e.g. if you have a JList of buttons when you click on the buttons they do not get pressed. Does anyone know how to get a JList of components that respond as if they were on say a JPanel?

    Cross posted: [http://www.java-forums.org/awt-swing/26380-jlist-components-you-can-interact.html]

  • Display and interact with a vi front panel on remote C++ app

    Hello:
    I am new to LV and need a little advice.  I need to display a LabVIEW VI front panel in my C++ .Net application that users can interact with to view real-time spectrum data.  The C++ app (client) must reside on a separate computer(s) from the VI so that the client can connect from anywhere around the world and interact with the VI. 
    I am not sure about the basic architecture that should accompany a good solution.  We want to use TCP/IP but not DataSocket.  I do not have access to Measurement Studio but I do have access to LabVIEW Professional Development System v 8.2.  Can anyone provide suggestions on what I need to do in order to
    1.  Connect to my TCP server using my C++ client app - I have already written TCP client and server code which communicate but now I need to integrate LV
    2.  Get access to the VI sitting on that server
    3.  Send the VI front panel to the client for display
    4.  Allow the user to modify parameters on the front panel displayed on the C++ client, send those changes back to the server, and refresh the front panel displayed in the C++ client given the new parameters (I would like a real-time display of the spectrum to always be available)
    Is this possible?  Has anyone done this using C++ .NET in VS2005?  Are there examples I can mimic or references that will help direct me?  I have searched and searched through NI's help and found a lot of good stuff but I'm still feeling confused about the best way to utilize LV.
    Thank you in advance!

    One more question ... what if I could use Measurement Studio?  The documentation seems to indicate that it's easy to create network applications and therefore it would be easy for me to re-create our VI's front panel using Measurement Studio components in my C++ app and then simply connect those components to the networked hardware (TCP/IP or DataSocket) that could be located anywhere in the world.
    Depending on what components you are using in your LabVIEW panel, it is probably pretty easy to build a Measurment Studio application to look like a LV panel.
    Given that, you could use network shared variables to move data across the network, no TCP programming necessary -- I think that this is pretty easy to do, but I don't know the specifics about variable programming in that environment.  Also, you will probably need to add some smarts to the server side to make sure that it is reading to and writing from variables in an appropriate manner.
    Question: why can't you just use LabVIEW for the client application also?

  • Help with JScrollPane

    I have a JScrollPane that I need to add multiple components to. That includes 5 JButtons, and 5 Jtree's.
    I need to add all of the components at once, making the JTree's visible and invisible by clicking the JButton's. My first problem is when I try to add multiple objects to the JScrollPane using the default layout manager. The last object added is always stretched to fill the entire viewport. This makes the objects first added un-viewable. So I decided to first add all of the objects to a Box then add the Box to the scrollpane.
    My second problem occurs when I make a JTree visible, aftering adding it to the Box. It draws the tree completely from top to bottom as it should, but clips the right end of titles on the nodes. The horizontal scroll adjusts enought so that you can scroll far enough to the right, but the titles are cut off.
    If I add one of the JTree's directly to the JScrollPane it behaves as it should, showing the complete node titles.
    I've tried revalidating, updating, and repainting without success.
    So, first question is can multiple objects be added to a JScrollPane using the default layout manager, without having the last object hide the previously added objects?
    Secondly, does anyone know why nodes in a JTree would be clipped when added to a Box then added the Box added to a JScrollPane. And more importantly how to fix it.
    Any help would be appreciated,
    Thanks,
    Jim

    Hi there
    Im not sure on exactly what you are trying to do.
    But if you want multiple components in one JScrollPane
    I would use a JPanel that I would add to the JScrollPane
    On that JPanel I would then add my components.
    I would also use GridBagLayout instead of any other layout manager. Thats because it is the most complex
    layout manager and it will arrange the components as I whant.
    If you whant to be able to remove a component from the view by making them invisible. I think I would consider
    JLayeredPane.
    on a JLayeredPane you add components on different layers. Each component is positionend exactly with setLocation or setBounds. This is the most exact thing to use. The JLayeredPane uses exact positioning of its components. which can be usefull when you use
    several components that will be visible at different times
    /Markus

  • Interacting with MS-Office

    1) From ASP.NET, I can interact with the MS Office applications and generate and poblate new Word, Excel, Power Point documents programatically. Can I do the same with JSP?
    2) From ASP.NET I can use Visual Basic COM+ componentes (three-tier model). I have heared about CORBA tech, which is the same for Java. How does this function?

    Not specific to the MS Office stuff, but others have answered that, but since you're a newcomer to the Mac, see these:
    Switching from Windows to Mac OS X,
    Basic Tutorials on using a Mac,
    Mac OS X keyboard shortcuts,
    Anatomy of a Mac,
    MacTips,
    Switching to Mac Superguide, and
    Switching to the Mac: The Missing Manual, Mountain Lion Edition.
    Additionally, *Texas Mac Man* recommends:
    Quick Assist,
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.

  • 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?

  • Interaction with Flash files

    Hi,
    Whats the easiest way to interact with a flash file from flash builder?
    I wish to change the speed of a tween in a flash file based on a value set in flash builder.
    Do you have to do make my flash file a component? .. Could someone point me in the direction of building components in flash builder?
    Thanks
      Aidan

    The multi-SCO intro video shows it packaging Flash and Dreamweaver as single SCOs and they are both part of Adobe's e-learning suite.
    I know Flash has learning elements and Dreamweaver has the course builder extension but I need to package Flash with no learning elements. I have the content of a couple of dozen courses in Flash  and I can build the quiz easily enough.
    Is there anything that can package up a single Dreamweaver (with embedded Flash) as a single SCO in the same way that the SCORM runtime wrapper used to do before it became out of date?

  • Bug: unable to interact with certain states

    Hi,
    I'm attempting to build a site in flash catalyst and I must say it is really a lot harder then expected due to limitations of the software such as a 20 page limit and the inability to transition and now even interact (link) with pages on higher/lower levels.
    In this case I have a site with lots of levels but to keep it simple:
    I'm attempting to link from level 3 to level 2, this seems impossible altough it us possible to link from 3 to 1... any suggestions as to why would be greatley appriciated.
    Thanks,
    Jason.

    Hello,
    The rules for what you should be able to interact with are listed in this FAQ thread. They basically say that you can target the top level application, the current component, or any components contained within the current component (you can click on them in EIP on the component).
    -Bear

  • 'Element is currently not visible and so may not be interacted with' when using Firefox.

    .

    Hi MonsoonMally,
    Thank you for posting in MSDN forum.
    >>'Element is currently not visible and so may not be interacted with', when playing back a CodedUI capture for a particular button selection function (captured in IE) and played back in Firefox.
    Based on your issue, I suggest you can try to use the
    DrawHighlight Method /SetFocus() to check if the correct control is found before you perform actions on the target control.
    If the above suggestion could not help you, since this cross browser testing is involved to the Extensions tool
    Selenium components for Coded UI Cross Browser Testing, this extension tool is
    out of support range of this forum.
    In order to resolve your issue better, I suggest you post this issue
    here, click “Q AND A”, you will get better support there.
    Thanks for your understanding.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Interaction with Content behind Transparent Flex App

    Hi,
    I have a Flex application with wmode=transparent and a transparent section that allows whatever is underneath it on the HTML page to show through.  In this case, what's showing through is another Flash application.  This works fine, but I can't interact with the Flash application showing through.
    I tried setting the z-index of the Flash app to something greater than my Flex app, and that worked, but unfortunately that solution doesn't work for my case because the Flex application has components that occasionally overlay in that area, and setting the z-index of the Flash app to be higher means those components are always stuck behind it.  Also unfortunately I don't control the loading of that Flash app, so I can't load/embed it into my app to get around this problem.
    Are there any other ways to do this?
    Cheers,
    Karthik

    UPDATE:
    So, I spent an entire work-day on trying to get this to
    work.... I finally ended up hacking the flex html filter library to
    display the formatted text as best as I could. It basically created
    a bunch of "<textformat>" tags. There were still a few
    layout/indentation issues. So, I tested it, and deployed to our
    test website, and got approval from one of the managers. Then, I
    come in this morning, and the all my work is gone. "Did I deploy
    the files to right server? I know I tested it last night....", I
    asked myself. The dates on the files were from last night. Odd. So
    I ask my supervisor if I was looking at the correct website for the
    server where I deployed the files.... "Oh yeah", he said, "I had to
    roll that back, because [the manager who gave me the content]
    didn't like how it looked." Nevermind that the files included other
    changes as well (it was a nightly build, the source control for the
    source files are done through a different source control program on
    a different server), so now the whole thing looks screwed up.
    Oh well.... I really need a blog to complain about this....
    Thanks everyone for your help.

  • How Client interact with Server in regular interval

    Hi friends,'
    I want to develop a chat server where the user should sent the request to server in background(as server can not sent response unless the request appears).So on regular request from the Client the server check the updation in database and sent the correspong message to user.
    How can i do this where the Client should interact with server in regular interval?
    Is there any other way to accomplish this ,any reference guide /tutorial to develop this ?
    Regards,
    Sachin Warang.

    You could add an <meta http-equiv="refresh" content="5;http://yourhost/context/servlet/"> to the HTML which will refresh the page every 5 seconds (change the 5 to 10 for every 10 seconds, etc.). The other way is to set up a JavaScript timer and use an XmlHttpRequest to make an asynchronous call to the server and update the HTML dynamically (using DOM) when a response is received (AJAX). Lastly, you could implement the client as an Applet, which gives you a much richer feature set and is a lot cleaner (having half of your app in JavaScript/DHTML is kind of messy).
    There are some vendors, such as IceSoft (http://www.icesoft.com/) producing JSF components that do the AJAX stuff transparently, so you just code a normal JSF app using their components and wire up to bean action methods where you need to.
    - Jesse

  • Interact with App data ?

    Is there any way to interact with the data created by the iPhone Apps. ?
    Example; is there a way to edit one of the "notes" files and have those edits sync back to the iPhone ?
    Or perhaps a way to edit the photos that the iPhone takes and save the files back (sync)  ?
    I kinda doubt it but a good question, I think ?
    Thanks

    One more question ... what if I could use Measurement Studio?  The documentation seems to indicate that it's easy to create network applications and therefore it would be easy for me to re-create our VI's front panel using Measurement Studio components in my C++ app and then simply connect those components to the networked hardware (TCP/IP or DataSocket) that could be located anywhere in the world.
    Depending on what components you are using in your LabVIEW panel, it is probably pretty easy to build a Measurment Studio application to look like a LV panel.
    Given that, you could use network shared variables to move data across the network, no TCP programming necessary -- I think that this is pretty easy to do, but I don't know the specifics about variable programming in that environment.  Also, you will probably need to add some smarts to the server side to make sure that it is reading to and writing from variables in an appropriate manner.
    Question: why can't you just use LabVIEW for the client application also?

  • Interactivity with grid/spreadsheets

    Hi all,
    Is there any way to interact with grids/spreadsheets such that you can click on a section and you open up some other component, like a drill down, or go to a link? It doesn't seem possible to me, but I was hoping someone here might have some experience/advice.
    Thanks.
    Anjana

    There is no specific linking etc as part of the grid component.  you can change the vaue of cells by changing the interaction options... but if you want to do a bit of navigation etc you will need to place something like a Icon or URL component over the are of the grid required and set it to be transparent... this is ok if your data isnt changing location of course!
    from the selectors components you also have the table component - this does allow you to make one of the columns selctable... you can then write the row id etc into a cell in your sheet to take some form of action.
    hope thats of some use!
    jez,

  • HT4907 I am able to connect to my Mac Mini on Back to My Mac through iCloud but the keyboard/trackpad on the MBAir or MBP with which I access does not register on the Mini.  So I can see the screen but cannot interact with it. Mini works accessing MBP/Air

    I am able to connect to my Mac Mini on Back to My Mac through iCloud but the keyboard/trackpad on the MBAir or MBP with which I access does not register on the Mini.  So I can see the screen but cannot interact with it. Mini works accessing MBP/Air and I can use Mini to input data or interact with screens of those computers.

    Regarding your first question about bookmarks, I think you discovered the answer in when you pressed the address bar. The second tab there has your bookmarks.
    As for the keyboard, I'm not sure why your Firefox is reacting so slowly; mine seems to show keyboards even when I don't want them. If you have accumulated a lot of history, perhaps that's an issue?
    Did you use any third party software to move your Firefox data from internal memory to the storage card?

Maybe you are looking for