How to convert the cursor to lens

Hi anyone here can help me
I have developed an application which opens the FITS Images(Flexible Image Transform System- which is used to open astronomical images) . Now i need to convert the cursor to lens means as and when the cursor moves on the image that portion of the image should be zoomed up.
After browsing in the net i could come across the below coding, but it is not working. Whats wrong with code? Is there any other method to do so? Could anyone suggest some useful websites where i can get enough imformation about it?
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.*;
public class DetachedMagnifyingGlass extends JComponent
implements MouseMotionListener {
double zoom;
JComponent comp;
Point point;
Dimension mySize;
Robot robot;
public DetachedMagnifyingGlass (JComponent comp,
Dimension size,
double zoom) {
this.comp = comp;
// flag to say don't draw until we get a MouseMotionEvent
point = new Point (-1, -1);
comp.addMouseMotionListener(this);
this.mySize = size;
this.zoom = zoom;
// if we can't get a robot, then we just never
// paint anything
try {
robot = new Robot();
} catch (AWTException awte) {
System.err.println ("Can't get a Robot");
awte.printStackTrace();
public void paint (Graphics g) {
if ((robot == null) || (point.x == -1))
g.setColor (Color.blue);
g.fillRect (0, 0, mySize.width, mySize.height);
return;
Rectangle grabRect = computeGrabRect();
BufferedImage grabImg = robot.createScreenCapture (grabRect);
Image scaleImg =
grabImg.getScaledInstance (mySize.width, mySize.height, Image.SCALE_FAST);
g.drawImage (scaleImg, 0, 0, null);
private Rectangle computeGrabRect() {
// width, height are size of this comp / zoom
int grabWidth = (int) ((double) mySize.width / zoom);
int grabHeight = (int) ((double) mySize.height / zoom);
// upper left corner is current point
return new Rectangle (point.x, point.y, grabWidth, grabHeight);
public Dimension getPreferredSize() { return mySize; }
public Dimension getMinimumSize() { return mySize; }
public Dimension getMaximumSize() { return mySize; }
// MouseMotionListener implementations
public void mouseMoved (MouseEvent e) {
Point offsetPoint = comp.getLocationOnScreen();
e.translatePoint (offsetPoint.x, offsetPoint.y);
point = e.getPoint();
repaint();
public void mouseDragged (MouseEvent e) {
mouseMoved (e);
}

if you return to the Swing Forum's main page, read the other subject titles, one of them might catch your attention

Similar Messages

  • How to convert the javasource file(*.class) to execute file(*.exe)?

    How to convert the javasource file(*.class) to execute file(*.exe)?
    thank you!

    Although i have seen a few programs (that are platform specific) that will embed a small jvm into an exe with your class file, it is generally excepted that you cannot create an executable file using java. The JAR executable file is probably the closest your going to get
    Pete

  • I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?

    I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?
    Thank you

    So it seems from reading the COMMAND manual that my first issue is that I used a 16GB SD card, and the manual says it will only recogize up to a 2GB SD card. I did use my MB Air's SD card slot and crated a folder and dragged the music files to it, then to the card. So I am going to get a 2GB card and try that next. Otherwise just stick with the iPOD connected. At least that is 8GB

  • How to convert the character value to currency/numeric

    Hi,
    See the sample code here
    data: v_qtr_field(7).
    data: w_low_limit like glt0-kslvt,
          w_amount like glt0-hslvt.
    w_low_limit = 02.
    w_max_period = 3.
    concatenate 'HSL' w_low_limit into v_qtr_field.
    *comment
    *I am looking for a field formation thru above code like in GLT0 table like HSL02,HSL03 *etc based on the value user entered in the selection *screen
    DO w_max_period TIMES
      VARYING w_amount FROM v_qtr_field NEXT v_qtr_field + 1.
       t_trans_values-dmbe2 = t_trans_values-dmbe2 + w_amount.
      ENDDO.
    I am facing problem in the Do loop as it wont allows multiple data types. can you suggest me how to convert the v_qtr_field whose data type is character to currency?

    Hi,
    Please check this code .
    PERFORM write_currency
                  USING buf_anla-urwrt t_dates-waers t_txw_anla-urwrt.
    *       FORM WRITE_CURRENCY                                           *
    *       convert currency amount to string                             *
    *       - use decimal point                                           *
    *       - remove separator characters                                 *
    *  -->  P_AMOUNT                                                      *
    *  -->  P_CURRENCY_UNIT                                               *
    *  -->  P_STRING                                                      *
    FORM WRITE_CURRENCY
         USING P_AMOUNT        TYPE P
               P_CURRENCY_UNIT LIKE TCURC-WAERS
               P_STRING        TYPE C.
      DATA: DEC2POINT(2) TYPE C VALUE ',.'.
    * convert separator to decimal point
      WRITE P_AMOUNT TO P_STRING CURRENCY P_CURRENCY_UNIT
            NO-GROUPING
            NO-SIGN
            LEFT-JUSTIFIED.
      TRANSLATE P_STRING USING DEC2POINT.
    * put minus sign before number
      IF p_amount < 0.
        SHIFT P_STRING RIGHT.
        P_STRING(1) = '-'.
      ENDIF.
    ENDFORM.
    <i>Hope This Info Helps YOU.</i>
    Regards,
    Lakshmi

  • How to convert the Report Builder output to .xls

    Dear All,
    Let me please know how to convert the Report Builder output to Excel Format.
    As there are having the facility to convert the output in .PDF or .HTML format but i want to convert that into Excel Sheet......
    Please Guide me in this regards
    Thanks in advance
    Regards,
    Vishal......

    Hello,
    If your question is about the format spreadsheet, it is not possible from Reports Builder :
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwwhthow/whatare/output/output_a_simpleexcel.htm
    Restrictions
    It is not possible to generate spreadsheet output directly from Reports Builder. Instead, on the command line, you can run the report using rwrun or Reports Server clients (rwservlet, rwclient, rwcgi), with DESFORMAT=SPREADSHEET. You cannot store DESFORMAT=SPREADSHEET as a system parameter value in the report definition (.rdf file).
    Regards

  • How to determine the cursor record count before the "open cursor"?

    Is it possible to determine the record count of an explicit cursor without running a count()? Say, my cursor definition is something like this,
    CURSOR cur_vehicle
    IS
    SELECT os.order_id, os.order_item, vs.part_id
    vs.part_num,
    vs.iso_num,
    vs.model_yr
    vs.dealer_cde,
    vs.cust_cde,
    px.plant_cd
    FROM parts_source vs,
    orders_source os,
    plant_tbl_crossref px
    wHERE os.order_id = vs.order_id
    AND vs.part_id = os.part_id
    AND vs.plant_cde = px.plant_cde
    ORDER BY os.order_id;
    I want to log the count of records returned by the above cursor prior to the first fetch, without running a count(1) for the query in cursor select.
    I know adding " Count(1) over(order by null) " in the cursor SELECT will bring it. But that does not help me log the record count to some log file or table before opening the cursor for processing.
    To conclude, my objective is to update the record count of cursor in some table before processing

    sarvan wrote:
    Is it possible to determine the record count of an explicit cursor without running a count()?
    ..snipped..No. The only way to do it correctly is inside that select.
    Each select is a consistent read. Which means that if this is done as 2 select statements, the 1st select can see a different version of the data than the 2nd select statement. does. So if you want a count and that to be consistent and on the same version of the data than the select, it has to be done as part of the select.
    Also consider what a cursor is. It is not a result set of sorts that is created in memory upfront - with a convenient interface that tells you the size/number of rows of that result set.
    A cursor is basically a program that reads database data as input and produce output. A fetch from a cursor is an instruction for this program to execute and output data.
    There's no data set that is created by the cursor from which the count can be determined. The cursor program does have state variables - like +%RowCount+ that specifies how many rows the cursor has thus far output. And you need to run that cursor to the end (no more output) in order to determine the total number of rows output by the cursor.

  • How to run the cursor

    HI
    can i knw how to run the cursor from the package. The cursor name is "cursor fet_rec".
    procedure update_hdr is
    cursor fet_rec is
    i rhave the run procdure but i am unable to run the cursor.
    procedure update_hdr is
    cursor fet_rec is
    select status, request_hdr_id
    from xxkfupm01.kfupm_mcr_request_header
    where status = 'Approved'
    for update;
    cnt1 NUMBER := 0;
    cnt2 NUMBER := 0;
    BEGIN
    for rec in fet_rec Loop
    select count(*)
    into cnt1
    from XXKFUPM01.kfupm_mcr_request_details
    where request_hdr_id = REC.REQUEST_HDR_ID;
    select count(*)
    into cnt2
    from XXKFUPM01.kfupm_mcr_request_details
    where request_hdr_id = REC.REQUEST_HDR_ID
    and status = 'Complete';
    if (cnt1 = cnt2) THEN
    update xxkfupm01.kfupm_mcr_request_header
    set status = 'Complete'
    where current of fet_rec;
    END IF;
    END LOOP;
    Regards
    Arif
    Edited by: user11309801 on Jan 3, 2011 6:56 AM
    Edited by: user11309801 on Jan 3, 2011 7:00 AM

    http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
    http://www.oracle.com/pls/db102/homepage
    http://www.oracle.com/pls/db112/homepage

  • How to control the cursor position in the Table control in Module pool

    Hi,
    Can any body tell me how to change the cursor positon from last field of the first record to the
    first field of the second record , when user presses enter in the last field in the module pool
    programming.
    Thanks

    Hi,
    Please avoid posting duplicate posts.
    Re: how to get the cursor position from screen in module pool program
    Nag

  • How to convert the class in the one package to same class in the other pack

    How to convert the class in the one package to same class in the other package
    example:
    BeanDTO.java
    package cho3.hello.bean;
    public class BeanDTO {
    private String name;
    private int age;
    * @return
    public int getAge() {
         return age;
    * @return
    public String getName() {
         return name;
    * @param i
    public void setAge(int i) {
         age = i;
    * @param string
    public void setName(String string) {
         name = string;
    BeanDTO.java in other package
    package ch03.hello;
    public class BeanDTO {
    private String name;
    private int age;
    * @return
    public int getAge() {
         return age;
    * @return
    public String getName() {
         return name;
    * @param i
    public void setAge(int i) {
         age = i;
    * @param string
    public void setName(String string) {
         name = string;
    My converter lass lokks like
    public class BeanUtilTest {
         public static void main(String[] args) {
              try
                   ch03.hello.BeanDTO bean=new ch03.hello.BeanDTO();
              bean.setAge(10);
              bean.setName("mahesh");
              cho3.hello.bean.BeanDTO beanDto=new cho3.hello.bean.BeanDTO();
              ClassConverter classconv=new ClassConverter();
              //classconv.
              System.out.println("hi "+beanDto.getClass().toString());
              System.out.println("hi helli "+bean.toString()+" "+bean.getAge()+" "+bean.getName()+" "+bean.getClass());
              Object b=classconv.convert(beanDto.getClass(),(Object)bean);
              System.out.println(b.toString());
              beanDto= (cho3.hello.bean.BeanDTO)b;
              System.out.println(" "+beanDto.getAge()+" "+beanDto.getName() );
              }catch(Exception e)
                   e.printStackTrace();
    But its giving class cast exception. Please help on this..

    Do you mean "two different layers" as in separate JVMs or "two different layers" as in functional areas running within the same JVM.
    In either case, if the first class is actually semantically and functionally the same as the second (and they are always intended to be the same) then import and and use the first class in place of the second. That's beyond any question of how to get the data of the first into the second if and when you need to.
    Once you make the breakthrough and use one class instead of two I'd guess that almost solves your problem. But if you want to describe your architecture a little that would help others pin down want you're trying to do.

  • How to convert the report english to germany in abap

    Hi guys,
    How to convert the report english to germany in abap and any manual code or function module.
    please give the solution.

    you need to maintain all the text in text element and maintain text translation..
    goto> translations

  • How to Convert the Warning Message to Error Message in Standard Transaction

    Hi,
        I face one problem in Standard Transaction Code CS02. In that  by entering the material Number, Plant, bomstatus press enter. it gives a warning message. How to convert the Warning message to Error. In abap how to do that. Please help me.

    Mohan,
    It appears that there is some configuration you can do for BOM Message types to change the message type.  The IMG link for this function is:
    Production->Basic Data->Bill of Material->General Data->Change Message Type
    However you need to read the IMG documentation to see if this will work for you.  There are only certain messages that can be changed with this configuration step.
    Also, please do not double post questions in the forums.
    Best Regards,
    Chris H.

  • How to convert the counter input as a RPM

    Hello NI,
                          Could you tell me. how to convert the Counter input to the RPM. I am using Rotary encoder has a 5V amplitude with 500 PPR. i am going to measure the Engine speed as a rpm.
    I am using third party hardware, from the hardware i can get the Count as well as Frequency also.
    Could you suggest to me...?  i looked out some disscussion in these forum but i cant able to understand.
    can you please explain with simple way....
    if you have any simulation send me....
    Regards,
    Balaji DP

    Hi balaji,
    [email protected] wrote:
    ...I am using third party hardware, from the hardware i can get the Count as well as Frequency also.
    If you're able to read frequency as X pulses/sec(?) that seems to convert RPM as follows:
    X (pulse/sec) * 1/500 (rev/pulse) * 60 (sec/min) = X * 60/500 RPM (???)
    Cheers!
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • Does anyone know how to convert the output from the standard report to xml?

    Does anyone know how to convert the output from the standard SAP report to xml?

    since it a standard report which you cannot modify you can only do the following.
    submit report exporting list to memory
    then
    list from memory and then
    use the returned itab along with CALL TRNSFORMATION key word to convert to xml.
    but this only going to place the whole list content (including data and formating lines,etc) into a xml element and not the actual data alone in the list .

  • How to convert the CS6 MAC version to the Windows version?

    I followed the advice to go to go/getserial, but the productcode i entered was "invalid", but the figures i entered are correct. What now ?

    Thank you for the tip, but I only get to : ask the community..   No
    contact with any agent.
    Pat Willener schreef op 19/09/2014 11:25:
    >
          How to convert the CS6 MAC version to the Windows version?
    created by Pat Willener <https://forums.adobe.com/people/pwillener> in
    /Downloading, Installing, Setting Up/ - View the full discussion
    <https://forums.adobe.com/message/6744036#6744036>

  • How to convert the varray to ref cursor

    Hi,
    Is there any way to convert varray to ref cursor....
    i dont want to use any table or record as an ref cursor..
    i just want to create a procedure which returns a ref cursor..
    below is the sample procedure for it..
    create or replace procedure FETCH_DATA1
    tab_name in varchar2,
    p_recordset1 OUT fetch_data_pak.ref_cursor
    AS
    type v_array1 is varray(1000) of t_transaction%rowtype;
    v_array2 v_array1;
    cursor s1 is select * from t_transaction where lastupdate_date > '08-Aug-09';
    begin
    open s1;
    fetch s1 bulk collect into v_array2 limit 100;
    close s1;
    select * from table(cast (v_array2 as p_recordset1));
    end FETCH_DATA1;
    I need to convert the varray to ref cursor.....

    Why put it into a varray at all?
    You can just open the ref cursor for that select you are desiring.
    And if you need to limit it to returning just the first 100 (as your code seems to imply), wrap it and filter on rownum.
    Something similar to this:
    create or replace procedure FETCH_DATA1
      tab_name in varchar2,
      p_recordset1 OUT fetch_data_pak.ref_cursor
    AS
    begin
      open p_recordset1 for
      select /*+ first_rows(100) */ * from (
        select * from t_transaction
        where lastupdate_date > to_date('08-08-2009','DD-MM-YYYY')
        --order by something
      where rownum <= 100;
    end FETCH_DATA1;And note, that you really should have an order by when you wish to limit yourself to "first 100 rows" - otherwise it will be "random 100 rows".
    That goes for your cursor solution as well...
    Edited by: Kim Berg Hansen on Nov 28, 2011 10:25 AM
    Added explicit date conversion - it is bad practice not to explicitly convert dates ;-)

Maybe you are looking for

  • Iphone 4 battery runs completely down with no use in an hour or two.

    My Iphone 4 battery, out of the blue, started running completely down in a couple hours with no use.  I would take it off the charger reading 100% and not do a thing, but the unit will get pretty warm and the battery drains.  The phone is only 3 mont

  • How do i install lightroom 4 with no cd drive on my macbook pro

    How do I install Lightroom 4 on my Macbook Pro????  There's no cd drive.  Is there a link from the website where I can download the software?

  • Default currency in shopping cart

    Hi Freinds, Can anyone let me know how the default currency can be changed in SC.I have done the same in ytansaction PPOMA_BBP under the attributes but it doesnt seem to be working.Where else do i have to check it out. Regards, Pawan.

  • N 73 asking acess points during call

    Hi, I have the Nokia N73, Whenever i make or receive call, pop-up occurs and ask to select the access point. i can't undrestand why it is asking the access points, If I select the access point, data connections gets activated, but for the next call i

  • IPhoto won't open avi files in Snow Leopard

    before I instaled Snow Leopard clicking on an avi file in iPhoto opened the file in Quick Time. After installing Snow Leopard I either have to put them on the desktop, or drag them onto Quick Time. Any ideas how to make iPhoto work with Snow Leopard?