How to Strech and move Line

i havw written a line component by inheriting JComponent class and using the Line2D.Double class
to draw the line . now i want to strech the line using mouseevent .i think setLine function can be used
to strech &move the line . i tried but i failed .please help me. tell me wether it can be done with it
or by other function PLEASE HELP with Some Source Code.

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.*;
public class rajkumar extends JPanel implements MouseInputListener {
  int x1, y1, x2, y2;
  public rajkumar() {
    addMouseListener(this);
    addMouseMotionListener(this);
  public void mousePressed(MouseEvent e) {
    x1 = e.getX();
    y1 = e.getY();
  public void mouseDragged(MouseEvent e) {
    x2 = e.getX();
    y2 = e.getY();
    repaint();
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
    double width  = getSize().width;
    double height = getSize().height;
    Shape
      staticLine = new Line2D.Double(width/4, height/2, width/2, height/2),
      movingLine = new Line2D.Double(x1, y1, x2, y2);
    g2.draw(staticLine);
    g2.draw(movingLine); 
  public void mouseEntered(MouseEvent e)  {}
  public void mouseExited(MouseEvent e)   {}
  public void mouseClicked(MouseEvent e)  {}
  public void mouseReleased(MouseEvent e) {}
  public void mouseMoved(MouseEvent e)    {}
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new rajkumar());
    frame.setSize(400,300);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

Similar Messages

  • How to save and  move an application

    Hi,
    I have made an application on Oracle Express. How to save and move that to another machine ?
    Many thanks.

    I'm in the process of porting my XE app to a 10.1 instance.
    I created an app export and export file of the schema. Then I installed a client on the same machine so I could connect and I get errors detailed in the end of this thread when attempting to import. Most of the tables are successful however, none of the procedural code goes in. The app export imported fine.
    Now, I can manually copy the objects that remain but only if I can connect to XE and this ability seems to have been lost with the install of the 10.1 client.
    Does anyone know how I can connect to XE using PLSQL Developer or is it indeed possible to connect to XE on a machine that is configured to also connect to a 10.1 remote server? I have installed the 10.1 client into a new Oracle home.
    . importing CODESPEED's objects into PRIMPATH
    IMP-00008: unrecognized statement in the export file:
    IMP-00017: following statement failed with ORACLE error 1950:
    "CREATE TABLE "FOLDER" ("FOLDER_ID" NUMBER NOT NULL ENABLE, "STAFF_ID_CREATE"
    "" NUMBER NOT NULL ENABLE, "STAFF_ID_MODIFY" NUMBER, "FOLDER_NAME" VARCHAR2("
    "100) NOT NULL ENABLE, "FOLDER_CREATED" DATE NOT NULL ENABLE, "FOLDER_MODIFI"
    "ED" DATE NOT NULL ENABLE, "FOLDER_NOTES" CLOB, "FOLDER_OWNER" NUMBER NOT NU"
    "LL ENABLE, "DRA_VERSION_ID" NUMBER, "ASSIGNED" NUMBER NOT NULL ENABLE, ""
    "UNASSIGNED" NUMBER NOT NULL ENABLE, "APPROVED" NUMBER NOT NULL ENABLE, "FOL"
    "DER_STATUS" VARCHAR2(1) NOT NULL ENABLE, "CODING_RULE_SET" NUMBER) PCTFREE"
    " 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FR"
    "EELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS "
    "LOB ("FOLDER_NOTES") STORE AS (TABLESPACE "USERS" ENABLE STORAGE IN ROW CH"
    "UNK 8192 PCTVERSION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 FREELISTS 1 F"
    "REELIST GROUPS 1 BUFFER_POOL DEFAULT))"
    IMP-00003: ORACLE error 1950 encountered
    ORA-01950: no privileges on tablespace 'USERS'
    IMP-00017: following statement failed with ORACLE error 2248:
    "ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 2 NLS_LENGTH_SEMANTICS = 'BYTE' PL"
    "SQL_CODE_TYPE = 'INTERPRETED' PLSQL_DEBUG = TRUE PLSQL_WARNINGS = 'DISABLE:"
    "ALL'PLSQL_CCFLAGS = ''"
    IMP-00003: ORACLE error 2248 encountered
    ORA-02248: invalid option for ALTER SESSION
    IMP-00000: Import terminated unsuccessfully
    C:\Documents and Settings\PWin>

  • How to drag and move duplicated movieclip in flashMX

    i would like to know how to drag and move duplicated movie
    clip in flashMX? i'm unable to drag and move duplicated movieclips
    but able to see duplicated movieclip on the stage. Is there anyone
    who can show me or direct me to any tutorial site?
    Thanks

    i have just changed to Flash MX2004 and below is my code. I'm
    not sure what has gone wrong with my script as i still unable to
    drag my duplicated movieclip? hope u guys can help me out!
    var mySelection = "";//Global declaration
    var totalmc = 0;
    wire.onPress = function ()
    this.createEmptyMovieClip(["mc"+totalmc],
    this.getNextHighestDepth(["mc"+totalmc])); //Create a newMovieClip
    with variable name "mc1""
    duplicate(["mc"+totalmc]);
    //trace(["mc"+totalmc]);
    dragging(["mc"+totalmc]);
    mc = attachMovie("idwire", ["wire"+totalmc++],
    this.getNextHighestDepth(["wire"+totalmc])); //store the Movie into
    mc1 by attaching
    mc._x = 273;//(Stage.width - mc1._width)/2;
    mc._y = 196.5;//(Stage.height - mc1._height)/2; //setting
    the corrdinates for x and y axis
    dragging(["wire"+totalmc]); //calling the dragging function
    //trace(mc1._width +","+ mc1._height);
    //Function for dragging
    function dragging()
    mc.onPress = function()
    this.startDrag(true);
    mySelection = this;
    mc.onRelease = mc.onReleaseOutside = function()
    stopDrag();
    function duplicate()
    mc.duplicateMovieClip (["mc"+i], i);
    i++;
    //trace("mc"+i);
    //trace(x);
    //Btn function for flipping
    flip.onRelease = function()
    mySelection._rotation += 10;
    //Btn function for delete
    del.onRelease = function()
    mySelection.removeMovieClip();

  • Where do I see how many photos (and movies) are in my Revel library?

    I see no place that states how many photos or movies are in Revel.

    Hi Pattie,
    Thanks for the reply...but here's the status:
    A.
    I'm in the Revel program downloaded on my desktop...not on its web site...and I made an album but can't find any place where it shows the number of photos in that album.
    As I view Mel's Library page and go to: View/Added By there is a total in the upper left corner that shows the total photos Added by ME. 
    But when viewing photos in my library: View/ All Photos by Date in either Grid or Track there is no total anywhere on the page. Each track has it's total and that's it.
    I don't understand how Revel ID's a Duplicate. 
    A window, Skipped Photos, pops up and states, "X photos were duplicates" indicating that they were not uploaded - and that  is supported by the math (in 3 out of 5 uploads): Selected photos minus Videos and Dupes = # of photos uploaded.
    However, on the last upload of 2000 Selected photos, the window said there were 2 duplicates. I counted 19 identical photos! Also without Revel identifying what the dupes actually were (by its reckoning) I have no way of determining what was not uploaded. All VERY confusing.
    When uploading using the download program on my laptop Revel won't upload videos.
    B.
    I went to the website and yes, when I click on the album it shows the photo count at the bottom. However, in order to get to the bottom of 10,000+ photos in the Library is a major and lengthy process as clicking on the side bar only takes me down a few photos with each click...and not to the end! There's no way to easily get to the bottom!  Scrolling the photos is equally slow and useless when all I'm trying to see is the total count! click on Sort oldest 1st and the newest go to the top! and the reverse is true of the other!
    mel

  • How to select and move objects on multiple layers

    Coming from Photoshop...  how do I move the contents of multiple layers across the page at one time?
    In photoshop, i would click on one or more layesr in the Layers panel, and then use the move tool to move them all on the page. How do I do that in Fireworks? It seems to be too basic to be documented anywhere I have seen but the interaction is very different. I tried  ctrl-clicking on multiple layers and sometimes is seems to work. the objects are selected and I can move them. Other times, it just refused to select anything or it only select the object within one of the selected layers.
    It sort of looks like selecting a layer selects objects in that layer unless the layer has a child layer. Is that true? Seems a strange limitation if it is.
    I saw a comment somewhere that suggrested grouping and ungrouping which seems a little complicated for a basic editing action. Also, if it won't select the objects on all of the selected layers.
    I'm guessing that I'm missing a basic concept in Fireworks here.

    I found that It worked if I selected a layer, if there is a child layer
    then shift>select and ctr+click other layers or objects. You could also
    lock layers/objects you don't want to move and use Select>Select All, if
    you are moving most items.

  • How to collect and move the deleted process chain to Prod.

    Hi,
    I have a process chain (BI 7)that is already in D,Q and P and now I want to delete a Process Chain under "Display Component" and my question is how to collect the deleted process chain to move all the way to Q and P.
    Waiting for your response
    Regards,
    Sunil

    Hi Srinivas,
    Thank You ,I was scared that i dont get any request to collect and my problem is resolved.
    Regards,
    Sunil

  • How to find and move just MP3 file types?

    Arrgggh! Windows user here increasing frustrated with "intuitive" imac.
    I just imported some CD music as MP3. This imported and inserted into my itunes library, but there does not seem to be any way that I can tell which of the files in the library are MP3. I want to move these files into a play list and burn them to a CDR.
    How do I tell which are the files that are MP3? The "view" menu does not have file type as a display option.
    Thanks for any help (info, prozac, whatever)
    -f-

    message deleted
    Message was edited by: VKX

  • How to find and move iTunes file from back-up

    I have a new drive in my iMac.  Now I want to move my iTunes files from my backup, but I want to know how to move it to the new computer so all my equipment will get recognized by iTunes in my new computer.  Thank you.

    Copy the entire iTunes folder (and in doing so all its subfolders and files) intact to the computer.  Open iTunes and immediately hold down the Option (alt) key so you get a prompt to select a library, then guide it to the iTunes Library.itl file in the moved iTunes folder.
    If you put the copied iTunes folder in the default location of Macintosh HD > Users > *User Name* > Music  then you don't even need to start with the option key held down, iTunes will automatically look for it there.  (Make sure there isn't anything already in the iTunes folder there that you want to keep since you will be replacing it with the one you are moving.)

  • How to upgrade AND move between platforms with different Endians...?

    Hi, all,
    I have two databases - one of 500Gb and one of 50Gb - that are currently running on 10.2.0.4 on AIX 64-bit. They are Production systems.
    I have to move them to a brand new Linux (RHEL 5.6 - 64-bit) server that will be running 11.2.0.2.
    For test, I'm OK with this being done with Data Pump. But for the eventual move to 'New Prod', this will result in hours' worth of downtime and it's a business-critical system, so I'm trying to mitigate that as much as I can.
    I was, naively, hoping to use RMAN to both move the databases from one box to the other, but also to upgrade them. I figure I would do the following (as per Metalink 369644.1) as I have a Recovery Catalog, etc, etc:
    Install the binaries on the New Prod server
    Connect to the RCAT and restore the database and recovery to a PiT
    Manually upgrade the database by putting the DB into STARTUP UPGRADE and running the catupgrd.sql
    Unfortunately, I didn't realise the Endian was different between AIX and RHEL (as per 1079563.1). Oops.
    It doesn't look like I'll be able to use Transportable Tablespaces (as per 243304.1) either without first having to migrate the data across as a 10g DB and then upgrading.
    So my options appear to be:
    a) Data Pump and suck the outage up
    b) Move the data using Transportable Tablespaces to 10.2.0.4 and then upgrade to 11.2.0.2.
    Are there any other options? I have hopes that a logical standby would work in this instance a la rolling upgrade, but suspect that the different O/S AND the different Endian would scupper that idea...
    Mark

    Perhaps, I have more experience using concurrent exports/imports using the traditional exp/imp utility than using the parallel option on expdp/impdp. One thing you can do with exp/imp that you cannot do with expdp/impdp is export into a named pipe, start a remove copy of the named pipe to the new server, and then start importing from the named pipe on the new server so that you are importing while still exporting the same objects. We use tables= exports when we did this back when the tables= parameter could only handle 99 tables. We had a separate export for every large table and then a set of exports for 99 tables for each of the other tasks ran 6 to 12 concurrent processes.
    One thing to look at is historic data. Potentially some tables can be moved in advance of the majority of the application objects and replaced with synonym to remote objects.
    Truely static tables could also potentially be moved in advance even if only a day or two before to reduce the number of objects to be moved.
    Build the new database in noarchive log mode to save some processing and switch it over and immediately back it up when you migrate.
    And Yes, if the two platforms appear in the view name I gave you then you can use transportable tablespaces with the rman conversion step. Instructions for using rman to do the conversion are in the rman manual.
    HTH -- Mark D Powell --

  • Some how every image and movie is has an identical copy, taking up huge amounts of space how can I get rid of the copies?

    I am trying to clean up my computer and somehow have now go two copies of all imovies, how can I remove the duplicated copies quickly as I have 1000's of small videos?

    What Mac do you have, running what version of OS X?

  • How to create parallel Diagonal lines easily in Photoshop?

    Hi All,
    I want to create some parallel but diagnol lines easily in photoshop or illustrator. A easy to follow tutorial will be fanastic. Please help me.
    Thanks in advance.

    I nearly always start an angled illustration element on the horizontal or vertical grid, and Free Transfor the angle after.
    If you need several lines then I would tend to use Free Transform step and repeat.
    Show Grid and check that snap to grid is enabled.
    Select Line tool and set thickness
    Draw line in line with the grid
    Free Transform, and move line to the required spacing using the grid as a guide.  Press Enter
    Ctrl Alt Shift t  (or Cmd Opt Shift t) as many times as you need lines
    I would probably make them too long, and trim after any rotation or aother adjustments had been made.
    I don't have or use Illustrator.

  • Determination of Item category and Schedule line category

    Hi,
    I am fresher being trained in SAP-SD.I am confused with determination of Item and schedule line category. Pls help me
    How is item and schedule line category is determined. Should it be done by us or by the system. pls explain it in a low level.

    hello,
    these are very basic question and can solved if you search over the net or ask your instructor to recommend any book.
    coming to your question
    item category determination  in sales document is done via following rule
    sales document typeitem categorygroupusage+higher level item cat=item cat det in sales doc
    OR                              +       NORM                                                              =TAN
    SCHEDULE LINE CAT determination  in ITEM OF A sales document is done via following rule
    item category+mrp type=schedule line category
    TAN               +PD          =CP
    revert if helpful
    Mohit Singh

  • How do i plot with the operating system time in one plot and show lines between cursors in another using the same XY graph?

    I am having some trouble graphing two plots at once. One plot is to show the current temperature inside a chamber as a function of time. I am trying to pick the current time and temperature each second and plot it with each point being connected by a line. I am able to show a moving, blinking dot each second but I can't figure out how to develop an actual line with these dots. To make matters worse, the blinking dot is back in the year 1903. I understand that it uses seconds elapsed since 1903, and am trying to find out how to graph the current temperature with the system time.
    The second plot is just 5 moveable cursors that are to be connected by a line. I am able to move the cursors and retrieve the position information, but I can't make a line between them.
    I have attached my main .vi, though you may have to pick the graphing part off to have it work for you.
    Attachments:
    Main Module Chamber Testing I_O every 30 sec.vi ‏288 KB

    You're not creating the XY graph data correctly. I've attached an example with a couple of simple XY Graphs. One is using a couple of shift registers to hold the spearate x and y arrays. I think this is what you were trying to do. The other one uses a VI from the shipping examples called XY Chart. It makes an XY Grpah act like a chart. I've also shown the correct way to display current time.Message Edited by Dennis Knutson on 05-12-2005 03:51 PM
    Attachments:
    XY Graph.vi ‏41 KB

  • How to hide/show and move screenelements at runtime

    Hi Guys
        Currently, i have a requirment that, in the same screen, when user choose different different option in the dropdown list, there should be different screenelements and table control with different columns showing below it.
    Now, i have two plans below:
    1), hide/show and move position of screen elements and table control at runtime
    2), call different subscreen
    I hope i can take the first way since the second way will modify structure of program ( As it is infotype screen ), any one knows how to implement the first solution?

    Hi,
    I would suggest you to call different subscreens and load them dynamically based on your parameters.Since different subscreen are called your coding and functionality could also be seperated by writing in the PAI and PBO of the correspondiong Screens.
    if you have decided to go by your first method then try the below code.
    a) if it is normal UI elements like text box etc
    LOOP AT SCREEN.
        IF <var> = ' value '.
            screen-invisible = '0'.
            MODIFY SCREEN.
      endif
    ENDLOOP.
    Here <var> refers to the screen field name and value refers to its value.
    b) To hide columns in a Table control.
    DATA cols LIKE LINE OF tc-cols.
      LOOP AT tc-cols INTO cols.
        IF cols-screen-group1 = 'G1'.
          cols-invisible = 'X'. "HIDE THIS COLUMN
          MODIFY tc-cols
          FROM cols
          TRANSPORTING invisible.
        ENDIF.
        CLEAR cols.
      ENDLOOP.
    PS: here TC refers to the name of the table control.
    Lemme know if you face any problems.
    Cheers,
    RK

  • How to use magic move with connection lines?

    When I use magic move with connection lines, they disappear and reappear in the next slide. It seems like magic move doesn't recognize the connection lines (or can't match them), so it just redraws them, instead of leaving them there.
    I'm trying to use magic move to make a nice presentation that includes connection lines. How can I make without the lines disappearing every time something moves?

    Group the shapes and connection line together:
    select the objects then Arrange > Group (alt Command G)

Maybe you are looking for