Need some advice on how to approach a problem

Hi,
I have a Jpanel, in which i use paintComponent() to draw a lot of things....
I pretty much have a large grid...and within this grid, i have lines, which are connected by points....The lines are moved around by dragging the points.
To check if a point is grabbed....i just get the x,y coordinates from the mouse listener....loop through my list of points, and check if the x,y coordinates of the mouse click fall within a rectangle of the point....this is pretty simple...especially since the points are rather small...
I now have to figure out a way to enable a right click popup menu to appear if the user right click on top of a line (give or take a few pixels)....now I could take the approach mentioned above...and loop through all the lines....but i would not be able to do 1 check per line...since the lines can be long/short, and take any angle...thus its not as simple to just check a specific area around the whole line (because this area might turn out to be too large)....
so what i was thinking is to create my own component, which would draw a line, and have its own mouse listeners...and the popup menu would only occur if the mouse listener for the component went off....
im not so sure of this idea...thats why i am posting to this forum....any and add advice is greatly appreciated!
thanks!

thanks for your help...i read the distance formula...and i tried to implement it...but i couldn't get it working....I think i am confused as to what the distance formula is returning...here is my math:
we have a line between points: (105,239) & (153,239)...this is a straight line across the x - axis....and i click on a point: (140,230)
first thing i need to do is convert these points into Ax + By + C = 0....so:
y = (A/B)x + C
A = (y1-y2); ==> 0
B = (x1-x2); ==> -48
C = C*B; ==> 239 * -48 => -11,472
now we have our equation Ax + By + C = 0 ==> 0x - 48y - 11,472 = 0;
the distance formula states: abs(Ar + Bs + C)/sqrt(A^2 + B^2)....using r=140, and s = 230...we get:
abs(0 - 48*230 - 11,472) / sqrt(48^2) ==> approximately 469....
now this doesn't make sense....since the point is actually only 9 pixels away from the line (in the Y direction)....
thanks for your help!

Similar Messages

  • Need some advice on how to make this Flash movie

    I have 5 flash movies which are all exported swf files from Camtasia. Now I have to design a Flash movie which has 5 Icons on a blank screen which point to each of these movies. When the user clicks on one movie the exported swf from Camtasia should play and when its finished it shoudl go back to Main Menu page.
    a) Is it possible to include a controllable progress bar for a SWF movie
    I am just looking for advice , like do this and do that. I shall try and write the code myself.
    cheers
    peanutlife.

    You may find the VideoPlayer class helpful:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/video/VideoPlayer.html#includ eExamplesSummary
    There's some sample code there which shows you how to put a video player on a movie and play something.  You would just need to add some buttons and stuff.  That example is Actionscript 3.  Things will be different if you have an older version of Flash.

  • Need Some Advice on How to Sell Star Wars Cards

    I'm looking for some free advice. I've noticed that there are quite a few posters who sell cards. I have a box of Star Wars Cards from 1977.  I've had them for about 10 years and there is an unorganized mass of hundreds and hundreds of cards.I haven't counted them but there are a LOT of cards.  It seems like these came directly from the factory. I have no idea what they're about, nor do I have any interest in organizing them, but I do want to sell them and think they have some value. I could list them as is on eBay as is but I'm pretty sure that would be asking for problems on so many levels. I could take them to several stores in my town to see about selling. I can't stress just how far this is from my comfort zone.  That's why I thought I'd ask for advice here. I've started to list these about a dozen times and always end up tossing the box in a corner because it just gives me a headache.   

    I think Pierre makes a good point. What is "lowball" anyway? We all know that to make money here, one needs to at least triple the price paid, so that means at best one is going to get 33% of actual retail from a reseller. So if the cards have an actual marketable value of $300 (ie the SOLD price), the best one could hope for would be $100. For a boxlot like this, there is a lot of work, so figuring one's processing time in, it is likely more reasonable to expect half of that, ie $50. if one is lucky. In my opinion, the value one gets offered will be based on whether the seller has an easy market for it and/or how much time it takes to process it and sell it.  I have encountered situations where I have paid multiple times the price other reputable dealers have offered because "I have a guy" that buys the stuff being sold which allows me to pay more because I have a quick turnaround with little time invested. I am sure other folks who have not sold to me have found other dealers who have paid more, perhaps because the other dealer "has a guy" too that buys different stuff than my customers.  So I know likely for certain, depending on who you ask, there will be people who think I am better than fair in terms of what I offer and others who think I am less than fair because they found someone else who offered more. I also know that I divest some stuff to fellow dealers because other stamp dealers have cultured customer bases and I actually get more money selling it to my fellow dealer than I would get trying to sell it directly myself, and with no risk of loss. Anyway, because I get collateral (non stamps) stuff like this in the big boxes/estates I buy, I try to keep "I have a guy" for the non-stamp related stuff. Usually I find them by taking "free" collateral stuff, and as it becomes clear they're trustworthy, I divert the better stuff to them later. None of that is fast, I'm in my 37th selling year now and it takes a lot of time and energy to "find the guy".... but that's what I try to do... This doesn't really answer the original question, if I personally came across these, and didn't want/have the time to spend sorting them out etc, the route I would probably go is one of my trusted antique sellers. These probably have better chance of going well in an antique store than trying to compete against the loads of stuff here - but I wouldn't have had much invested in them because they'd have been collateral..... sometimes stuff like this goes better than it should in a general auction because folks believe star wars cards are worth a lot (they can be depending on condition, if there are actually complete sets etc). 

  • I need some advice ..How would you..

    I know I can ask this is in a dedicated Forum (of some sort)... but for now ...I am after quick and easy thoughts to start with.
    I want to make a "Home Page" for a retail IN STORE computer screen.
    Its for customers to access specific websites at the click of an icon (LOGO).
    ie 16 logos on screen ..in  custom-skinned Chrome Browser.
    I need this to be simple.
    Placement of Logos ...easy!
    1. So ...what simple application will end me up with an HTML file with each logo , linked.
    I want to avoid apps such as MUSE
    2. I assume its simple enough to place an appropriate file (folder?)  in a Chrome "local location" and make it a Favourite and a Home Page?
    Thoughts.
    Thanx!

    I used to have dreamweaver when it was macromedia .. before adobe got it. Did some pretty cool stuff with it using MS Visual Studio and MS Sql Server for database ASP ( dot net framework with local computer as the " server " ( called IIS ).. using windows ( pc )... pretty much the same as what Bill said...
    You had choices back then about business apps or straight HTML stuff.. and it does get complicated no many levels...
    One is design element ( page design ) and the other is code behind stuff ( what gets delivered from server to client pages ).
    I don't have CC which would probably include dreamweaver now right ??? So, if you do have CC I'd go with dreamweaver and use their templates maybe, or else their forum for help on what you wanna do. They are cool over there at that forum.
    As you probably know, the page design is basically around tables and cells and layers and all sorts of junk.. and that is dependent on the browsers and platforms ( smartphones and desktops and so on )...there's a girl over at dreamweaver forum who is really good and helpful about simple stuff and also complex stuff. and also some guys too... I'd go with that.
    If you want " free " dumb HTML stuff and have windows OS .. you can try Microsoft Expression.. which I got free a couple months ago.. from MS.. it is kinda like DW but more simple...
    In fact, the reason it became " free " was cause they couldn't compete with DW at all.. so they just give it away now. But it works fine for real simple stuff..
    No matter what you use you have to deal with the gazillion " client " things.. desktop, tablets, smartphones, etc .. AND the browser differences.. that code ALONE to seek out what the client is and then choose how to deliver the page ... is a challenge... I bet the DW forum would be a good place to start with that...
    good luck !

  • Needs some Advice on How-to, Real time Price Quote Page?

    I need to create a page that gives  a real time price quote. I would like to be able to allow the end user to  select the an option and in real time update the price and up date a  running total. I have looked around for some extentions but have not  found anything. Can anyone point me in the right direction?? If a DB is  need I use Access and ASP pages.
    thanks
    Dogger

    Anyone????

  • Access Web App - Need some advice with query (text to number problem)

    In an Access Web App I want to create a query.
    I have two tables which are related but in a bit complicated way. For some reason I have a text field in which I save a number. This number relates to the ID of another table. When I combine these two tables in a query, it's not working because the textfield
    cannot query the (ID)number field.
    Is there a way, in this query so that I covert the text field to a number so the query will work?
    I tried to do it with the "Parse" function but no luck, so far.
    Thanks, Mike

    Hi Mike,
    Based on the description, you want to create a query by joining a text filed with number filed?
    Did I understood correctly? If so, as far as I test, it works in Access 2013 web app. Here is the screen shot for your reference:
    If I misunderstood, please feel free to let me know.
    Regards & Fei
    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.

  • I need some advice, i kind of have a problem

    my ipod video was stolen out of my house the other day and i have a pretty good idea who did it and who has my ipod. The only problem is like the stupid college kid i am when i got my ipod i never registered it and cannot find the serial number. The one thing that i do have is a "Genius Bar" document from when my old ipod died on me. On the document it has the serial number of my old ipod but not the new one, however it does have the item number of the new ipod that apple gave to me. Do you think if i go to the apple store they will be able to take that number and figure out what the new serial number is or no? and if there is any other way to find the serial number please let me know.
    Thanks
    Matt

    If you haven't hooked up another iPod since the one that was stolen, then the serial number is in iTunes.
    Open iTunes, go to preferences, click on the iPod tab. It will say "No iPod Connected". Click on that message and it will then change to say "Last iPod: xxxxxxxxx" where xxxxxxxxx is the serial number of the iPod.
    Patrick

  • Newbie needs advice on how to approach a new project using iMovie/Cubase

    Hi all.
    As you have probably guessed it's a music to picture problem, never done it before so I need some advice. I'm doing a guitar tuition DVD so there will be some playing and some speech. I can combine both real time via the mixing desk and feed it straight to the camera's mike input. This seems to be the least flexible and most low tech approach. I would prefer to fiddle about in Cubase to get the audio right before fixing it to the video. I am unsure how to use iMovie and Cubase in a combined way to produce what I'm after. Cubase will handle video and iMovie will handle sound but which way round do I do it? I'm at a loss as even what questions to ask! At the moment I'm setting iMovie to record from the camera, setting Cubase to record the audio and clapping in time with the count in to act as a sync. Once I have my audio file I can import the vid into Cubase or import the audio into iMovie. Am I missing something here or is this the right way to do it? ( I might sound vaguely clever but don't rely on it in your answers ! I'm a guitarist after all....)
    TIA Nick.
    ,quad G5 Mac Mini   Mac OS X (10.4.6)  

    musicians are used to do everything simultanously (=band), film/video is doing each thing after the other ;-):
    I would
    * record the video to a camcorder, incl. guitar/music but NO voice-over…
    * import that into iM…
    * edit all together
    * THEN use this as a "click track" for any audio processing…, mainly adding the narration
    * re-import the final audio track back to iM, create videoDVD, getting rich by selling zillions of them....
    advantage: you concentrate on playing guitar OR telling the tricks&clues...
    besides: whatfor you need Cubase in such a project...? or is it "Guitar IN Cubase"?

  • Business Delegate pattern - need some advice

    Hi. First let me apologize for the long post. I could see no other way. I�m building a system that quite large and I need some advice. The system is a type of transaction system, let�s suppose a shopping cart. I�m using struts taglibs and tiles for presentation, struts proper for controller, and POJOs for business logic. Also I�m using OJB for my data tier.
    Now I�ve been reading Pro Jakarta Struts (Apress), which BTW is a recommended read to anyone with novice experience in struts and related technologies. I�ve assimilated most of the techniques and patterns described in the book, and most of them make sense to me. However, I�ve hit a snag while reading the Business Delegate and Service Locator patterns.
    The way I had though of building my application before reading the book, was to have a wrapper class, such as the following:
    public class ShoppingCart {
      private IAuthenticationService authenticationService;
      private ITransactionService transactionService;
      public ShoppingCart() {
         authenticationService = new DBAuthenticationService();
         authenticationService = new DBTransactionService();
      public login(String username, String password) {
         String sessionToken = authenticationService.logon(username, password);
         return sessionToken;
      private boolean isValidUser(sessionToken) {
         bolean validUser =  authenticationService.isValidUser(sessionToken);
         return validUser;
      public performTransaction(sessionToken, TransactionVO) {
         if (!isValidUser(sessionToken) {
              throw new AuthenticationException();
         transcationService.performTransaction(TransactionVO);
      public editPreferences(sessionToken, PreferencesVO) {
         if (!isValidUser(sessionToken) {
              throw new AuthenticationException();
         authenticationService.performTransaction(PreferencesVO);
    }My idea was that my wrapper class would isolate all the business logic and could perform login service in case my application was ever to be used with other presentation layer than struts (standalone client, web services). However I believe that this overlaps the Business Delegate pattern and maybe even totally implements it. The way I understand the code I�m reading in the book, they suggest having a BD for each major service such as AuthenticationServiceBD, TransactionServiceBD, etc� However this would break my single point of entry for authenticating users. I really need some advice on my design and how it fits with the BD and SL patterns (or others). I would also like to know what you think/recommend of my authentication strategy.
    thanks in advance
    Raphael

    Thanks for your reply. This however, I understood. My concern is regarding my application in regards to business delegate pattern. You see I have this class (simplified for clarity):
    public class ShoppingCart {
       private ILoginService ls = new DBLoginService();
       private ITransactionService ts = new DBTransService();
       // and so on for all services I offer.
       //  then I mirror all the calls of my private interfaces
       //  and pass them through internally
       public String sessionToken login(String username, String password) {
            ls.login(username, password);
       public boolean addToCart(sessionToken, itemNo) {
            // check session
            ts.addToCart(sessionToken, itemNo);
       //  and so on
    }Multiple questions for this one:
    1) Am I not already implementing the Business Delegate pattern with my ShoppingCart class since all interfaces are private and all calls are mirrored from the wrapper class (ShoppingCart) to the private interfaces? All services are implemented as POJOs and I am not using JNDI at the present so I don't use the ServiceLocator pattern.
    2) I store a reference to the wrapper class (ShoppingCart) in the ServletContext so I can grab it from my Action classes. What do you think of this approach?
    3) How many BDs should an application contain. In my case I use just one. What is the advantage of using more?
    4) I create my own session tokens in case I ever want to use to business code in a non-web applications where sessions are not available readily. This brings about the problem that I can't pass the interfaces directly to the Action classes because the login session needs to be checked before any calls to services. So all methods include a sessionToken parameter which I use to check the session. This way, if I want to expose some of the services through web services, I can still use a login. What do you think of this approach.
    5) Any other remarks are very welcome...
    I really need help with this from an experienced programmer. Most things I can handle on my own but with this type of design issue, books just don't cut it. I need experience. I would really apreciate some feedback.
    Raphael
    ps: I would give all my Duke dollars for this (I only have 30), but I'm not sure how. If you want them I can create a dummy question and give them to you.

  • Having some serious issues with my iPhone and need some advice

    I'm going to these two issues which have been occuring with me for the past weeks-
    1.) I am facing a problem with my iPhone 5's lightning port or the cable. This started happening all of a sudden; one second my phone is charging, and the other it is not. Even if it is slightly moved from its position, it would stop charging, and further shaking starts it again, so on and so forth. At first I thought the issue might be with my cable, so I asked my friend to bring his lightning cable to my house so we could test that. It happened again- one shake the phone will charge, another shake stops it. (Note that any kind of movement does this, not only shaking) I'm a bit skeptical about his (my friend's) cable too, though- it shows NOT CHARGING on his iPad while it is in fact actually charging. His cable is only 3-4 weeks old though, so this confuses me even more. I think the issue might be with my port, but as of now I cannot draw a valid conclusion to my problem.
    2.) The second problem is that I've noticed my battery drains a **** lot faster now- ever since the first issue started. I manage to get my phone charging by placing it very carefully on the table and it charges overnight. However, when I pick it up in the morning, and read some news, it drains from 100% to 99% in ~60 seconds. This never happened before. Before this, it used to be at 100% for at least 10-15 minutes (might be even more). If I reboot my phone, it shows 100% again, but it still drains a lot faster now. I know because I've been using this phone for the past 4 months now, and I know when it drains and when it does nots
    Please, help! I need some advice as to how I should approach this problem. My phone is in the warranty period, however, I would like to have an expert's opinion first.

    Hello,
    First: I've experienced the same problem with my iPhone 5. I've bought a new charger and it still did the same thing. I went to the Apple Store to get my iPhone checked out and they said that the pins inside my iPhone we're damaged, and I had to get a replacement.
    ~ Josh

  • Need some advices with OBIEE

    Hi guys,
    At the moment I am doing an internship somewhere, and I am supposed to visualise some data from an Oracle database into a Google Map.
    The data should be fake, because the application will be a showcase.
    I need some start-up hints, because actually I don't know where to start and with which programs.
    First of all a little background.
    The following programs are installed on my laptop:
    - Oracle DB (1013)
    - Oracle Example Schemas
    - Oracle WebLogic (103)
    - Oracle BI enterprise (101340)
    - JDeveloper
    This is what I want:
    - Create a database or schema with fake data. The fake data should consist of addresses. (for the Google Map)
    - The combination with BI enterprise is a requirement, part of the internship programme.
    - Combination with Google map functionality.
    Maybe someone can give me some advices in how to begin. Which techniques I should use or some useful tutorials.
    I would really appreciate if someone can give me a heads up!

    The [Oracle by Example|http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/index.html] website has many good step by step tutorials on OBIEE so that would be a good start. Having said OBIEE doesn't support "heat maps" or overlaying data on maps out of the box. They are some 3rd party tools out there but I don't think you want to go there. From my point of view anyone asking you to use OBIEE to overlay data on Google Maps doesn't know what OBIEE should be used for (and probably doesn't know Google Maps either).

  • I need some advice about the macbook pro and iPhone 5. I took a video on my iPhone and tried to email it it said it was too big to send? So i downloaded it to my macbook pro and tried to mail it to no avail? The macbook tells me the server won't let it th

    I need some advice about the macbook pro and iPhone 5.
    I took a video on my iPhone and tried to email it it said it was too big to send? So i downloaded it to my macbook pro and tried to mail it to no avail? The macbook tells me the server won't let it through other mail goes through any ideas how to resize it or what it might take to send it?

    I agree with LowLister, the best option for you to share the video online is to upload it to your online storage account for example : Box, Dropbox, SkyDrive (All of them provide free storage beginning from 2GB).
    You can upload the files which you want to share in this online storage and then they have sharing options in which you'll will get the link of the file to be sent and send the email. You're good to go!
    Tip : You can store multiple files for backup purposes.

  • When I burn a disc from a playlist in iTunes, the track names and artist info does not display on the disc when friends view/listen to it. This probably is an easy fix, but I need some advice.

    When I burn a disc from a playlist in iTunes on my MacBook, the track names and artist info does not display on the disc when friends view/listen to it. This probably is an easy fix, but I need some advice.

    No, this standard has been implemented for several decades.
    How iTunes remembers audio CDs - http://support.apple.com/kb/TA27785
    It is just conceivable you burned a CD that exactly matched one already in the Gracenote database.  Gracenote uses track count and duration to decide what CD it is you have in a computer.  If you have one that matches that it will label it.  You could conceivably even have one that matches it that is not the correct one.
    This script will only work on Macs:
    http://dougscripts.com/itunes/scripts/ss.php?sp=cdtexttocdinfo - script to use CD-text file on CD to label CD in iTunes

  • Songs disappearing. Need some advice.

    I need some advice regarind my ITunes library. I spent a lot of time importing all my cd's. I now have approx. 14,000 songs now. First I had put them all in as mp3's, then I heard about the quality and smaller size of AAC. I think that is where some duplicates came from. But some how I've ended up with up to 6 of a lot of my songs, at least it is showing 6 copies of many of my song in my ITunes library. But when I go to delete all but one of the songs, through ITunes, sometimes it is fine and sometimes I get the ! icon. I guess even though I left one in Itunes it actually deleted all copies. I did not know I was doing this because it doesn't show the ! icon until you go back and try to select the song. This took days and days to deleted over 6,000 duplicates.
    Now I'm finding some albums are missing songs and some are missing the whole albums even though they show in Itunes. I even have gone through and tried to "FIND" the songs some are really there but most are not. So how to I go about reconstructing the library. Is it best to try and find each one or just wipe (delete) my library clean and just reimport the entire library? I'm talking about reconstructing approximately 12,000 songs and I have no idea how many cd's.
    I just would like to know how you guys would handle this. Thanks for your help.
    Nancy

    miner78 wrote:
    Need some advice....I just bought the new retina MacBook Pro (2,199 model) and after reading about the ghosting or burn in issues that some users are experiencing I am starring to wonder if I made the right decision.  I am still waiting for my laptop to come in so I can still cancel my order.  I'm seriously considering opting for the non-retina MacBook Pro instead.  This will be my first Mac and I will mainly be using it to browse the web and do photo editing (I'm an amateur photographer) I know the non-retina doesn't not come with SSD and wondering how much of difference that makes.  Any advice, suggestions will be welcomed
    That's incorrect:
    Order online and for a fee you can have an SSD.

  • Where to begin? Need some advice

    Greetings all,
    I've been poking around here trying to find a topic that matches my question and have not had much luck. Here is my situation.
    I'm back into photography after many years and, of course, am coming from the traditional film and darkroom days and now find myself drinking from a fire hose trying to master digital photography.
    I want to use Photoshop but would appreciate some advice on how best to learn it? Can you folks recommend what you consider the best books for a total neophyte to Photoshop to use to learn the fundamentals?
    Thanks for any advice you can offer.
    Paul McCain
    Saint Louis

    I was surpised to see that was from back in April; I would have said September or October, if pressed to guess when the thread ran. Glad I have it bookmarked, and archived on my hard drive.
    If it ever
    would
    be considered for an addition to the FAQs, I hope someone asks me first, because there are a few things I'd like to add and clarify before it gets all sticky.

Maybe you are looking for