Drag constraints

Hi!
I've got a few quick answers here before, so I'll try with another problem.
I'm trying to implement drag functionality into my application and found these examples in the live docs:
http://livedocs.adobe.com/flex/3/html/help.html?content=dragdrop_7.html#247940
But dragging is allowed "outside" the canvas which just adds a scrollbar to it.
I want to restrict the allowed area so it just can be dragged inside the visible area. How do I do this?
Best regards,
Magnus

You can probaby modify the example on my blog
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Similar Messages

  • Bug?  Can't switch off constraint / snapping when dragging multiple points

    Can someone please check this one out:
    Summary:
    Prefs are set to: Snap Vector Tools and Transforms to Pixel Grid OFF. Constrain path dragging in the options bar is OFF.
    If I have a vector path in a document I can drag one selected point freely. If I have two or more points selected transformation is constrained/snapped to the pixel grid.
    CS6, Windows 7/64bit.
    Expected result:
    With settings as above I should be able to drag points without constraint/snapping.
    How to reproduce:
    Ensure settings are as described above.
    Draw ellipse path with the shape tool.
    Select and drag one point with the direct selection tool = free dragging
    Select and drag multiple points with the direct selection tool = constrained dragging

    Thanks for noticing this Mike,
    This may have been overlooked, but we notice that it also appears in CS5.
    We'll have a look at it.
    Thanks again
    Pete

  • Error while adding Image: ORA-00001: unique constraint

    Dear all,
    I have an error while adding images to MDM I can´t explain. I want to add 7231 images. About 6983 run fine. The rest throws this error.
    Error: Service 'SRM_MDM_CATALOG', Schema 'SRMMDMCATALOG2_m000', ERROR CODE=1 ||| ORA-00001: unique constraint (SRMMDMCATALOG2_M000.IDATA_6_DATAID) violated
    Last CMD: INSERT INTO A2i_Data_6 (PermanentId, DataId, DataGroupId, Description_L3, CodeName, Name_L3) VALUES (:1, :2, :3, :4, :5, :6)
    Name=PermanentId; Type=9; Value=1641157; ArraySize=0; NullInd=0;
    Name=DataId; Type=5; Value=426458; ArraySize=0; NullInd=0;
    Name=DataGroupId; Type=4; Value=9; ArraySize=0; NullInd=0;
    Name=Description_L3; Type=2; Value=; ArraySize=0; NullInd=0;
    Name=CodeName; Type=2; Value=207603_Img8078_gif; ArraySize=0; NullInd=0;
    Name=Name_L3; Type=2; Value=207603_Img8078.gif; ArraySize=0; NullInd=0;
    Error: Service 'SRM_MDM_CATALOG', Schema 'SRMMDMCATALOG2_m000', ERROR CODE=1 ||| ORA-00001: unique constraint (SRMMDMCATALOG2_M000.IDATA_6_DATAID) violated
    Last CMD: INSERT INTO A2i_Data_6 (PermanentId, DataId, DataGroupId, Description_L3, CodeName, Name_L3) VALUES (:1, :2, :3, :4, :5, :6)
    Name=PermanentId; Type=9; Value=1641157; ArraySize=0; NullInd=0;
    Name=DataId; Type=5; Value=426458; ArraySize=0; NullInd=0;
    Name=DataGroupId; Type=4; Value=9; ArraySize=0; NullInd=0;
    Name=Description_L3; Type=2; Value=; ArraySize=0; NullInd=0;
    Name=CodeName; Type=2; Value=207603_Img8085_gif; ArraySize=0; NullInd=0;
    Name=Name_L3; Type=2; Value=207603_Img8085.gif; ArraySize=0; NullInd=0;
    I checked all data. There is no such dataset in the database. Can anybody give me a hint how to avoid this error.
    One thing I wonder: The PermanentId is allways the same but I can´t do anything here.
    BR
    Roman
    Edited by: Roman Becker on Jan 13, 2009 12:59 AM

    Hi Ritam,
    For such issues, can you please create a new thread or directly email the author rather than dragging back up a very old thread, it is unlikely that the resolution would be the same as the database/application/etc releases would most probably be very different.
    For now I will close this thread as unanswered.
    SAP SRM Moderators.

  • Bug report: 3.2; DAC; GridControl; Navigation - Invalid reaction to mouse drag

    Hi,
    This is a bug report, I think.
    I have a one-column GridControl with mandatory column. Normally, DAC framework prohibits from navigation out of empty field and emits one of those DAC-1002 or DAC-603 errors. The only exception I noticed was a double-click on another row. In this case navigation allowed but an error is still produced.
    Today I was playing with this GridControl and discovered that I can drag the yellow frame across rows. And here comes a bug - GridControl doesn't change the current row on InfoBus according to current selection marked by yellow frame.
    In my case it brings the following problem: if the cursor is placed on the new empty row, user drags the cursor to another row and then tries to use any other navigation means except dragging, he gets a navigation error. DAC framework still thinks that the current row is the empty one and produces an error telling that the attribute cannot be empty.
    Dev Team, any comments?
    Regards,
    Vladimir

    Hmm... Nobody answers. I'll try another variation of the same question.
    DAC framework implicitly validates attributes on the base of Mandatory constraint in the Entity Object definition. Is it possible to set the level of this validation? For example, I want to conduct validation only when user navigates out of the row or the whole rowset, but not when he just leaves a field.
    Regards,
    Vladimir

  • Re-order components in JPanel using Drag and Drop

    Hi,
    I have a JPanel that contains some more JPanels (the Layout is GridBagLayout - one column, each row - 1 JPanel). I would like to drag one JPanel (1) and after dropping it on some other JPanel (2), the (1) should be inserted at (2)'s position.
    I really can't get the idea from sun's tutorials :(

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class DragTest extends JPanel
        public DragTest()
            setLayout(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(5,5,5,5);
            gbc.weighty = 1.0;
            gbc.weightx = 1.0;
            gbc.fill = GridBagConstraints.BOTH;
            gbc.gridwidth = GridBagConstraints.REMAINDER;
            for(int j = 0; j < 4; j++)
                JPanel panel = new JPanel(new BorderLayout());
                panel.setBorder(BorderFactory.createEtchedBorder());
                panel.add(new JLabel("panel " + (j+1), JLabel.CENTER));
                add(panel, gbc);
        public static void main(String[] args)
            DragTest test = new DragTest();
            DragListener listener = new DragListener(test);
            test.addMouseListener(listener);
            test.addMouseMotionListener(listener);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(test);
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class DragListener extends MouseInputAdapter
        DragTest dragTest;
        Component selectedComponent;
        GridBagConstraints constraints;
        Point start;
        boolean dragging;
        final int MIN_DRAG_DISTANCE = 5;
        public DragListener(DragTest dt)
            dragTest = dt;
            dragging = false;
        public void mousePressed(MouseEvent e)
            Point p = e.getPoint();
            Component[] c = dragTest.getComponents();
            for(int j = 0; j < c.length; j++)
                Rectangle r = c[j].getBounds();
                if(r.contains(p))
                    selectedComponent = c[j];
                    start = p;
                    dragging = true;
                    break;
        public void mouseReleased(MouseEvent e)
            if(dragging)  // no component has been removed
                dragging = false;
                return;
            Point p = e.getPoint();
            if(!dragTest.getBounds().contains(p))  // out of bounds
                // failed drop - add back at index = 0
                dragTest.add(selectedComponent, constraints, 0);
                dragTest.revalidate();
                return;
            Component comp = dragTest.getComponentAt(p);
            int index;
            if(comp == dragTest)
                index = getDropIndex(dragTest, p);
            else  // over a child component
                Rectangle r = comp.getBounds();
                index = getComponentIndex(dragTest, comp);
                if(p.y - r.y > (r.y + r.height) - p.y)
                    index += 1;
            dragTest.add(selectedComponent, constraints, index);
            dragTest.revalidate();
        private int getDropIndex(Container parent, Point p)
            Component[] c = parent.getComponents();
            for(int j = 0; j < c.length; j++)
                if(c[j].getY() > p.y)
                    return j;
            return -1;
        private int getComponentIndex(Container parent, Component target)
            Component[] c = parent.getComponents();
            for(int j = 0; j < c.length; j++)
                if(c[j] == target)
                    return j;
            return -1;
        public void mouseDragged(MouseEvent e)
            if(dragging)
                if(e.getPoint().distance(start) > MIN_DRAG_DISTANCE)
                    // save constraints for the drop
                    GridBagLayout layout = (GridBagLayout)dragTest.getLayout();
                    constraints = layout.getConstraints(selectedComponent);
                    dragTest.remove(selectedComponent);
                    dragging = false;
                    dragTest.revalidate();
    }

  • Adobe Flash CS5.5 Crashes while drawing/dragging objects.

    I have experienced quite a few crashes trying out Adobe Creative Suite CS5.5 Premium when it comes to using Flash Professional CS5.5. I have documented one of the crashes at a pastebin entry, which I will link it and an earlier crash log dump below.
    Here's how the crash occurs on my iMac (27-inch, Mid-2011 with AMD 1GB Dedicated Graphics):
    1.) Create either a Flash Document - AS 2.0 or AS 3.0 does not matter, though using 3.0 makes it crash faster I've noticed.
    2.) Draw shapes. After a while of drawing shapes and making them into groups/objects/symbols...
    3.) Drag the shapes around, eventually performance starts to drop over time.
    4.) After a while, Flash will freeze and crash, complete with the beach-ball spinning.
    The most recent crash:
    http://pastebin.com/YCWKAbhp
    There is my pastebin of my latest crash, using an Adobe Flash document using ActionScript 2.0.
    Alternatively, sometimes Flash CS5.5 will crash using ActionScript 3.0 as the language of choice, and oddly much quicker. One of those crashes can be found here: http://pastebin.com/pTSerErw
    The irony in both cases is I don't primarily use Flash Professional CS5.5 for programming or scripting at all. I use it for basic vector artwork for an array of projects. Thus, I don't use AS3.0 with this program.
    Here's what I have done so far to try to remedy this:
    I have updated the Apple JRE/JDK for Mac OS X Lion to the latest revision. I also have cleared out the JRE/JDKs and have started from scratch, to clear out any possible mistakes in installation. I know Java seems to be part of the Flash complilation process, oddly enough
    Use ActionScript 2.0 documents helps keep crashes down, oddly. Yet they still happen eventually
    Booted into Safe Mode to try to fix permissions and such. No dice
    Repaired permissions manually using Disk Utility. No dice
    Edited my jvm.ini file on my install to have no memory constraints, instead defaulting to the ones I have manually set for my JRE/JDKs. Specifically for my Java 64-bit JRE/JDK: -Xmx2048m -Xms512m -Xss2048m -d64 using the Java Preferences application in /Application/Utilities/
    I have also monitored the console for any activity aside crashes. No dice
    Trashed my Preferences and Application Support files
    Deleted/Fixed corrupt or duplicate fonts - I did find some duplicates due to Microsoft Office 2011
    I also have sought out other errors here on the Adobe Forums/Community. While similar, they are usually for more complicated projects, while mine is simply drawing and copy/pasting stuff seems to be a problem.
    In short, I've done my research and still haven't been able to fix it
    Oddly enough, most of the time no corruption has been reported due to this. In fact, I usually just have to restart Flash, save often, and if it crashes, repeat until my project is done. I also don't use auto recovery because it actually makes things more confusing and I admittedly don't trust it.
    Also, I usually have Flash Professional running, as well as Adium (IM client), Safari, and iTunes. Usually no other programs are running outside background programs or menu bar items.
    Does anyone have insight, solutions or possible pointers on how to fix this? It's more of an annoyance - but this is painful since I spent good money on this product. I hope CS6 improves this with full 64-bit support and better memory management.

    Hi,
    I am not sure if this is a "Master Page since we use a French version (the functionnality is  named "Gabarit" in French), so here is a printscreen which shows what our users try to do:
    Immediately after the drop is completed, InDesign shuts down without further notice as described before.
    I fully patched one machine to 7.5.3, rebooted it and it still does not work.
    I know 2 GB is a little bit short, but since this is currently a corporate standard in my customer's organization, I will need to be sure that this is the direct and only cause before any upgrade request can be made.
    Thank you for your help.

  • Drag and Drop rows between tables in JSP

    I have to convert a swing application into a web project. One of the screens in my swing application uses drag and drop of records between two tables. The key is that when one of the rows is picked and dropped in the other table values get allocated to each column accordingly. I need to bring this functionality into a JSP. There is no constraint on using Javascripts. Please help me asap.
    Regards,
    KK

    Yes it is possible, but not so easy. If you'll be at OOW this year, you can come to my session (S301752, Monday 13:00-14:00) - I will show something similar there. If you're not so lucky, you can read the excellent blogpost of my colleague at [http://rutgerderuiter.blogspot.com/2008/07/drag-planboard.html]
    Cheers
    Roel

  • HOW TO DRAG AND DROP IN CALENDAR ?

    Hi guys,
    Once again I rely on your infinite wisdom to help me out with a little question I'm having regarding the Drag and Drop Functionality in the new Calendar control of the new APEX 4.1 (pretty cool by the way).
    The thing is that I'm trying to create a simple little page for scheduling purposes, basically for having a centralized place in which the members of a team with a remote manager put the info of which days are they planning on working and when will they start their shift and when they gonna leave, for that purpose I made use of the new Calendar control (pretty neat) which is working fine and is being fed by the following query (note that the field "DISPLAY_COLUMN" is the value that is displayed on the calendar):
    SELECT
    CASE WHEN eas.IS_HOLIDAY = 1 THEN ea.FNAME || ' (OOTO Using a make up Holiday)'
    WHEN eas.IS_VPN = 1 THEN ea.FNAME || ' (' || to_char(eas.SHIFT_START,'HH:MIPM') || ' - ' || to_char(eas.SHIFT_END,'HH:MIPM') || ')' || ' on VPN '
    WHEN ( eas.IS_VPN = 1 AND eas.IS_HOLIDAY = 1 ) THEN ea.FNAME || ' (' || to_char(eas.SHIFT_START,'HH:MIPM') || ' - ' || to_char(eas.SHIFT_END,'HH:MIPM') || ')' || ' on VPN & its Holiday '
    ELSE ea.FNAME || ' (' || to_char(eas.SHIFT_START,'HH:MIPM') || ' - ' || to_char(eas.SHIFT_END,'HH:MIPM') || ')'
    END AS DISPLAY_COLUMN
    , ea.ID AS ea_ID
    , ea.NAME AS ea_NAME
    , ea.FNAME AS ea_FNAME
    , ea.EMAIL AS ea_EMAIL
    , eas.ID AS eas_ID
    , eas.ASSIGNEE_ID AS eas_ASSIGNEE_ID
    , eas.DATE_ENTRY AS eas_DATE_ENTRY
    , eas.SHIFT_START AS eas_SHIFT_START
    , eas.SHIFT_END AS eas_SHIFT_END
    , eas.IS_VPN AS eas_IS_VPN
    , eas.IS_HOLIDAY AS eas_IS_HOLIDAY
    , CASE WHEN eas.IS_VPN = 1 THEN 'VPN'
    ELSE NULL END AS VPN_TEXT
    , CASE WHEN eas.IS_HOLIDAY = 1 THEN 'HOLIDAY'
    ELSE NULL END AS HOLIDAY_TEXT
    FROM EBA_ASSIGNEES ea, EBA_ASSIGNEES_SCHEDULE eas
    WHERE ea.ID = eas.ASSIGNEE_ID
    ORDER BY DISPLAY_COLUMN
    Alright, so far so good, everything is working just fine, the pop up window is inserting the calendar entries in the correct table as expected, but now I'd like to make use of the "Drag and Drop" functionality of this amazing control, to be able to "Clone" calendar entries in different dates instead of having the employees inserting their daily schedule for every day, so I'd like to be able to drag an existing entry from a certain day in the calendar and drop it elsewhere and I'd like the OnDemand process to make an insert on the table but with minor changes (like the date of the entry, of course) ,and I'm currently getting stuck in what to put in the OnDemand PLSQL process for that to happen (and how to reference the info in the row I'm currently dragging in the PLSQL code).
    Here's the table in which I'm currently inserting the Calendar entries (and in which I want to insert the result of the drag and drop as well):
    CREATE TABLE "EBA_ASSIGNEES_SCHEDULE"
    (     "ID" NUMBER NOT NULL ENABLE,
         "ASSIGNEE_ID" NUMBER NOT NULL ENABLE,
         "DATE_ENTRY" DATE NOT NULL ENABLE,
         "SHIFT_START" DATE,
         "SHIFT_END" DATE,
         "IS_VPN" NUMBER,
         "IS_HOLIDAY" NUMBER,
         CONSTRAINT "EBA_ASSIGNEES_SCHEDULE_PK" PRIMARY KEY ("ID") ENABLE
    Please guys, help me out here, I think this might be a simple process I just don't know how to proceed.
    Thanks in advance.
    Daniel Villegas.

    Hi,
    There are 3 things which you need to be clear about Drop & Drop On Demand Process.
    1. Which Column is used as primary Key while creating the SQL Calendar, you can find this under calendar attributes, Since your SQL Query used for Creating Calendar does not have ROWID, I think you would have ID column "eas.ID AS eas_ID" from your query.
    2. Which Column is used as Date Column in the Calendar from your query i think it must be one of these "DATE_ENTRY" DATE NOT NULL ENABLE, "SHIFT_START" DATE, "SHIFT_END" DATE, for the on demand process i will take DATE_ENTRY as your date column, please change accordingly
    3. Which Table need to be updated with the new date value when the data is dragged. In your case the Table will be "EBA_ASSIGNEES_SCHEDULE"
    So the on demand process will look like this.
    declare
    l_date_value varchar2(32767) := apex_application.g_x01;
    l_primary_key_value varchar2(32767) := apex_application.g_x02;
    begin
    update EBA_ASSIGNEES_SCHEDULE set DATE_ENTRY= to_date(l_date_value,'YYYYMMDD HH24MISS')
    where ID = l_primary_key_value;
    end;
    http://sathishkumarjs.blogspot.com/2011/07/enabling-drag-drop-and-add-edit-data.html
    Hope this helps
    "JS"

  • Constrain-Drag in Piano Roll?

    Before I send this one in as a feature-request, I wanted to make sure it wasn't an already-implemented feature which I just hadn't figured out yet:
    When dragging a selection in the Piano Roll (aka Matrix) view, is there any way (presumably via a modifier key) to restrict the move to ONLY vertical (or ONLY horizontal)?
    In many apps, this happens when you Shift-Drag a selection. In FinalCut, for instance, when you drag a clip from one track to another, holding the Shift key keeps that selection at the exact same spot along the Timeline. This is what I often want when moving a selection in the Piano Roll -- to change the notes in that particular MIDI track, but keep them in the exact same spot relative to all the other tracks.
    Is there any "official" way to do this Logic -- other than simply by eye, which is how I do it now?
    Thanks,
    John Bertram
    Toronto

    Another useful nugget -- thank you.
    I also just discovered that when the "constrain" preference is left on (making it the default), clicking Shift once as you describe turns OFF the vertical/horizontal constraint just for that one particular move.
    Very cool!
    John Bertram
    Toronto

  • Can't drag components to Design View? (FB)

    A co-worker of mine is unable to drag any component on to the
    design view. I looked at it and I can't seem to figure it out
    either. His project works fine under my version of Flex Builder
    (we're both using Flex Builder 3.0.2, OSX 10.5), I am able to drag
    and drop new components to any state. The only way he is able to
    add components is by going to the MXML and typing things manually.
    He is also having odd things happen in design view with alignment
    and constraints.
    Edit: Just to clarify when he tries to drag and drop instead
    of getting the "Green Plus Orb" he gets a White "Cancel" (always
    reminds me of a non-smoking sign) circle.
    I have managed to find a few people with the same problems on
    JIRA but every one of the bugs gives me the "This bug was imported
    from another system and requires review from a project committer
    before some of the details can be marked public." message.
    Any ideas/help would be appreciated - he is reinstalling FB
    now, but I dunno if that's going to help.
    Thanks!

    pkrasko, welcome to the forum,
    drag and drop; go to screen settings where you see the two monitors displayed with 1 on the left and 2 on the right. Click on 2 and drag it to the left of 1. You'll then be able to drag to the left, unless of course you've already physically moved the monitor to the right
    Hope this helps
    Andy  ______________________________________
    Please remember to come back and mark the post that you feel solved your question as the solution, it earns the member + points
    Did you find a post helpfull? You can thank the member by clicking on the star to the left awarding them Kudos Please add your type, model number and OS to your signature, it helps to help you. Forum Search Option T430 2347-G7U W8 x64, Yoga 10 HD+, Tablet 1838-2BG, T61p 6460-67G W7 x64, T43p 2668-G2G XP, T23 2647-9LG XP, plus a few more. FYI Unsolicited Personal Messages will be ignored.
      Deutsche Community     Comunidad en Español    English Community Русскоязычное Сообщество
    PepperonI blog 

  • Dragging a Triangle on Screen

    I need help in dragging the vertex of a triangle or just dragging a triangle when the user clicks on it . The code to draw the triangle is as follows. I have used a Polygon and LIne2D with Point2D to draw the lines on screen.
    Please Help as i have to have this and more stuff done asap.
    The code to draw the triangle on screen is as follows
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.geom.*;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.Line2D;
    import java.awt.geom.Point2D;
    * @author  Kripa Bhojwani
    public class Triangle extends javax.swing.JPanel {
        /** Creates new form Triangle */
        public Triangle() {
            initComponents();
          Polygon triangle = new Polygon(3);
        public void paintComponent(Graphics gfx) {
            super.paintComponent(gfx); // standard setup
            Graphics2D g = (Graphics2D) gfx;
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
            Polygon triangle = new Polygon(3);
            triangle.add(new Point2D.Double(150,300));
            triangle.add(new Point2D.Double(300,450));
            triangle.add(new Point2D.Double(300,300));
            g.setPaint(Color.BLACK);
            triangle.draw(g);
            // define the elements we will draw
    Ellipse2D.Double e1 = new Ellipse2D.Double(p1.x-r1,p1.y-r1, 4*r1, 5*r1 );
            g.fill(e1);
            g.draw(e1);
            Point2D.Double p1 = new Point2D.Double(900, 750);
            Point2D.Double p2 = new Point2D.Double(450, 300    );
            Point2D.Double p3 = new Point2D.Double(300,300);
           /* Ellipse2D.Double e1 = new Ellipse2D.Double(p1.x-r1,p1.y-r1, 4*r1, 5*r1 );
            g.fill(e1);
            g.draw(e1);
            Line2D.Double line = new Line2D.Double(p1, p2);
            Line2D.Double line1 = new Line2D.Double(p2, p3);
            Line2D.Double line2 = new Line2D.Double(p1, p3);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            setLayout(new java.awt.BorderLayout());
        // Variables declaration - do not modify
        // End of variables declaration
    }the Main Application code is on my JFrame and is as follows:
    import javax.swing.*;
    * @author  Kripa Bhojwani
    public class GUI extends javax.swing.JFrame {
        /** Creates new form GUI */
        public GUI() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            triangle1 = new Triangle();
            jMenuBar1 = new javax.swing.JMenuBar();
            jMenu1 = new javax.swing.JMenu();
            jMenuItem1 = new javax.swing.JMenuItem();
            jSeparator1 = new javax.swing.JSeparator();
            jMenuItem2 = new javax.swing.JMenuItem();
            jSeparator2 = new javax.swing.JSeparator();
            jMenuItem3 = new javax.swing.JMenuItem();
            addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
                public void mouseDragged(java.awt.event.MouseEvent evt) {
                    formMouseDragged(evt);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            triangle1.setBackground(new java.awt.Color(51, 204, 255));
            triangle1.setPreferredSize(new java.awt.Dimension(500, 500));
            triangle1.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    triangle1MouseClicked(evt);
                public void mouseEntered(java.awt.event.MouseEvent evt) {
                    triangle1MouseEntered(evt);
                public void mouseExited(java.awt.event.MouseEvent evt) {
                    triangle1MouseExited(evt);
            triangle1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
                public void mouseDragged(java.awt.event.MouseEvent evt) {
                    triangle1MouseDragged(evt);
                public void mouseMoved(java.awt.event.MouseEvent evt) {
                    triangle1MouseMoved(evt);
            jScrollPane1.setViewportView(triangle1);
            getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
            jMenuBar1.setBackground(new java.awt.Color(102, 153, 255));
            jMenu1.setBackground(new java.awt.Color(204, 204, 255));
            jMenu1.setText("File");
            jMenuItem1.setBackground(new java.awt.Color(255, 204, 255));
            jMenuItem1.setText("Open");
            jMenuItem1.setToolTipText("Open");
            jMenu1.add(jMenuItem1);
            jMenu1.add(jSeparator1);
            jMenuItem2.setText("Save");
            jMenuItem2.setToolTipText("Save");
            jMenu1.add(jMenuItem2);
            jMenu1.add(jSeparator2);
            jMenuItem3.setText("Exit");
            jMenuItem3.setToolTipText("X");
            jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem3ActionPerformed(evt);
            jMenu1.add(jMenuItem3);
            jMenuBar1.add(jMenu1);
            setJMenuBar(jMenuBar1);
            pack();
        private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
            System.exit(0);
        private void triangle1MouseMoved(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here:
             setTitle("Mouse is at [" + evt.getX()  + "," + evt.getY() + "]");
        private void triangle1MouseExited(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here:
            setTitle("Mouse out of Application Window");
        private void triangle1MouseDragged(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here:
            setTitle("Mouse Dragged at [" + evt.getX()  + "," + evt.getY() + "]");
        private void triangle1MouseEntered(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here:
                    setTitle("Mouse is in Application Window");
        private void triangle1MouseClicked(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here:
             setTitle("Mouse clicked at [" + evt.getX()  + "," + evt.getY() + "]");
        private void formMouseDragged(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here
             //setTitle("Mouse is at [" + evt.getX()  + "," + evt.getY() + "]");
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            new GUI().show();
            JFrame GUI = new JFrame("GUI");
            Triangle tri = new Triangle();
            GUI.getContentPane().add(tri);
        // Variables declaration - do not modify
        private javax.swing.JMenu jMenu1;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JMenuItem jMenuItem2;
        private javax.swing.JMenuItem jMenuItem3;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JSeparator jSeparator1;
        private javax.swing.JSeparator jSeparator2;
        private Triangle triangle1;
        // End of variables declaration
    }Any help on how to drag the triangle would be greatly appreciated.
    After this i need to stretch the vertex of the triangle such that i can increase the size of it.
    Thanks a lot
    Sharan

    Hi ... I have finally managed to draw and stretch a triangle on screen as well as Increase its size on screen.
    I have drawn a Right angle Triangle on screen or so it appears by the constraints set out to draw it.
    Then I have enabled dragging only when the user clicks on the Left Cordinates of the BASE. (PRECISELY ON THOSE POINTS)
    And stretching any side is possible only when the user clicks on the TOP or the RIght Hand side cordinates of the base.
    The problem is that as and when i stretch the triangle or drag the triangle for that matter it redraws itself a number of times i.e. i can c the entire triangle moving on screen and hence it overlaps and redraws itself on screen.
    Besides finding the exact cordinates of the triangle to DRAG it i.e. 300,300 for the base is difficult coz as of now thats the way i could work it out.
    The code for my program is below and i would appreciate if you could sort my problems out and tellme how to drag the triangle when the user just clicks within the area of the triangle and stretches it in a way that it does not redraw the entire triangle..
    Thanks...
    This is my main Class
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.Graphics.*;
    import java.awt.geom.Point2D;
    * @author  Kripa Bhojwani
    public class Geometry extends javax.swing.JFrame  {
        /** Creates new form Geometry */
        public Geometry() {
            JFrame Geometry = new JFrame("Geometry");
               initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
                public void mouseDragged(java.awt.event.MouseEvent evt) {
                    formMouseDragged(evt);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            pack();
        private void formMouseDragged(java.awt.event.MouseEvent evt) {
            // TODO add your handling code here:
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
             TriangleModel tri = new TriangleModel(300,150,450,300,300,300);
            View view  = new View(tri);   // view takes in model
             JFrame Geometry = new JFrame("Geometry");
            Geometry.setSize(500,500);
             Geometry.setContentPane(view);
            Geometry.setVisible(true);
            Geometry.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           // new Geometry().show();
        // Variables declaration - do not modify
        // End of variables declaration
    This is my triangleModel class ---  the Model
    * TriangleModel.java
    * Created on 02 December 2004, 20:27
    import java.awt.geom.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.Graphics;
    import java.awt.Point;
    * @author  Kripa Bhojwani
    public class TriangleModel extends Observable {
        private int cx, cy, x1,x2,x3, y1,y2,y3;
        private int _transx;
        private int _transy;
        /** Creates a new instance of TriangleModel */
        public TriangleModel(int x1, int y1, int x2, int y2, int x3, int y3) {
            this.x1 = x1;
            this.y1 = y1;
            this.x2 = x2;
            this.y2 = y2;
            this.x3 = x3;
            this.y3 = y3;
            setChanged();
            notifyObservers();
        public void setTop(int x1, int y1){
            this.y1= y1;
            setChanged();
            notifyObservers();
        public void setRight(int x2, int y2){
            this.x2 = x2;     
            setChanged();
            notifyObservers();
        public void setLeft(int x3, int y3){
            _transx = x3 - this.x3;
            _transy = y3 - this.y3;
            this.x3 += _transx;
            this.y3 += _transy;
            this.y2 += _transy;
            this.x2 += _transx;
            this.x1 += _transx;
            this.y1 += _transy;
            setChanged();
            notifyObservers();
        public Point getTop(){
            Point p = new Point(x1,y1);
            return p;
        public Point getRight(){
            Point p1 = new Point(x2,y2);
            return p1;
        public Point getLeft(){
            Point p3 = new Point(x3,y3);
            return p3;
    This is the Controller and View
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.Graphics.*;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.Line2D;
    import java.awt.geom.Point2D;
    import java.awt.event.*;
    import java.awt.Graphics2D;
    * @author  Kripa Bhojwani
    public class View extends javax.swing.JPanel implements Observer, MouseMotionListener, MouseListener{
        private TriangleModel model;
        private Polygon triangle;
        private boolean pressed = false;
        private boolean pressT = false;
        private boolean pressR = false;
        /** Creates new form View */
        public View(TriangleModel model) {
            this.model = model;
            model.addObserver(this);
            addMouseListener(this);
            addMouseMotionListener(this);
            // initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            setLayout(new java.awt.BorderLayout());
        public void paintComponent(Graphics gfx) {
            Graphics2D g = (Graphics2D) gfx;
            //  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            //RenderingHints.VALUE_ANTIALIAS_ON);
            //        Polygon triangle = new Polygon(3);
            Point tc = model.getTop();
            Point lc = model.getLeft();
            Point rc = model.getRight();
            //        triangle.add(new Point2D.Double(tc.getX(), tc.getY()));
            //        triangle.add(new Point2D.Double(lc.getX(), lc.getY()));
            //        triangle.add(new Point2D.Double(rc.getX(), rc.getY()));
            Point2D.Double p1 = new Point2D.Double(tc.getX(),tc.getY());
            Point2D.Double p2 = new Point2D.Double(lc.getX(),lc.getY());
            Point2D.Double p3 = new Point2D.Double(rc.getX(),rc.getY());
            Line2D.Double line = new Line2D.Double(p1, p2);
            Line2D.Double line1 = new Line2D.Double(p2, p3);
            Line2D.Double line2 = new Line2D.Double(p1, p3);
            // g.setPaint(Color.BLACK);
            // triangle.draw(g);
            g.draw(line);
            g.draw(line2);
            g.draw(line1);
        public void update(Observable o, Object arg) {
            repaint();
        public void mouseClicked(java.awt.event.MouseEvent e) {
        public void mouseDragged(java.awt.event.MouseEvent e) {
            if(pressed == true){
                model.setLeft(e.getX() ,  e.getY());
            else if(pressT == true){
                model.setTop(e.getX() , e.getY());
            else if (pressR == true){
                model.setRight(e.getX(), e.getY());
            else {
                pressed = false;
                pressT= false;
        public void mouseEntered(java.awt.event.MouseEvent e) {
        public void mouseExited(java.awt.event.MouseEvent e) {
        public void mouseMoved(java.awt.event.MouseEvent e) {
            System.out.println(""+e.getX() + e.getY());
        public void mousePressed(java.awt.event.MouseEvent e) {
            if (model.getLeft().getX()== e.getX() && model.getLeft().getY()== e.getY()){
                pressed = true;
            else if (model.getTop().getX()==e.getX() && model.getTop().getY()==e.getY()){
                pressT = true;
            else if(model.getRight().getX() == e.getX() && model.getRight().getY()==e.getY()){
                pressR = true;
            else {
                pressed =false;
                pressT = false;
                pressR = false;
        public void mouseReleased(java.awt.event.MouseEvent e) {
            if(pressed == true){
                model.setLeft(e.getX(),e.getY());
            else if (pressT ==true ){
                model.setTop(e.getX(), e.getY());
            else if(pressR ==true){
                model.setTop(e.getX(),e.getY());
            else{
                pressed = false;
                pressT = false;
                pressR = false;
        // Variables declaration - do not modify
        // End of variables declaration
    Thanks again
    code]

  • 4EA1: Dual monitor - add constraint popup always appears on primary monitor

    When editing a table and going to the constraints tab, and clicking the green plus sign to specify the type of constraint, it always appears on the primary display.
    Environment:
    Windows 7 x64
    C:\Users\trent>java -version
    java version "1.7.0_04"
    Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
    Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
    http://oi39.tinypic.com/35klb0l.jpg

    I have two monitors.   The trick to moving something from the #1 Monitor to #2 monitor is to first
    click that button between the X and the - up at the top right of your screen in the blue bar.  Hover over it and it
    says "Restore Down".  This makes whatever you have on the screen less than full screen but
    still visible.
    Then you can grab it and move it over to the other screen.  (Left click, hold, and drag)  For some
    reason, a full screen view won't move, but the smaller screen view does.  Grab it and move it
    horizontally to the other screen.
    After you have it on the second screen in the smaller size, that Restore Down button becomes the
    Maximize button.  Click that and whatever you've moved will be full screen.
    My set-up is a little different because my #1 screen is to my left and is the smaller screen just
    because that's how my office is arranged.  I do my primary work on my #2 screen which is the
    larger screen. Programs open on #1 screen and I have to move them to #2 screen.

  • Master-Details form - integrity constraint

    Hi,
    I have created a simple master-detail form. Master block is based on say Table1 with 2 columns and detail block is based on Table2 with 4 columns.
    When I am trying to create records using this form, I enter data in the Master block and then navigate to the detail block and then enter data. When I press the save button,
    the form throws error message "ORA-02291: integrity constraint (APPS.FK_RECORD_IDENTIFIER) violated - parent key not found"
    When I check the query using Help->Diagnostics->display database error, the insert statement is insert into table2 values (......
    I guess, the form is trying to insert data into table2 first. Since there is no corresponding entry in Table1, hence the error. What should be done, so that the form inserts Master block data into table1 first before attempting to insert data into detail block.
    Regards
    Suresh

    Suresh,
    In the Object Navigator view, check the block order under the Data Blocks section. The Master Block should come first, and then only the detail should come. If its is not like that, then change the order of the blocks by dragging the master block to top of the blocks.
    Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • Dragging to scale a thin rectangle moves the rectangle

    This is an old, old issue I've been seeing for years, and currently still exists in CC 2014 18.1.1. Mentioned in another thread but it really belongs in its own:
    When a rectangle is narrow enough (some quick testing puts the number at 15px narrow dimension at 100% zoom… at 16px the behavior is normal), dragging a center control point on the long side does resize the shape, but as the rectangle gets narrower or wider, the opposite side moves along in the direction you drag (but at a slower rate than the side you're dragging).
    Normally, if you have a 16px tall, 200px wide rectangle at x=0, y=0 (zoom level 100%) and drag the bottom edge down until the tooltip reads "H=200", the resulting shape is 200px wide, 200px tall, and remains at x=0, y=0. However, if you start with the same rectangle but 15px tall instead of 16px, the resulting shape is 200px wide, 200px tall but now starts at x=0, y=6. The top edge moved down as the bottom edge was dragged.
    This has been around long enough I'm wondering if it's supposed to behave that way, and if so, why?

    Yeah, you can do that, but it requires an extra (precise) click + holding shift, for the scenario I described. If you want to increase the height without changing the y-coordinate, you have to select the rectangle, press "S", click the top edge of the rectangle precisely to set the constraint, hold down shift, then drag vertically. Way more work than just selecting the shape and dragging the center control point…

  • Data Modeler 2.1 EA1  FK Constraints

    Hi,
    I don't know what functionality you have planed but, when I drag and drop the Master + Detail Table at the same time to the modeler window I see visually my FK Constraints. When I drag it one after the other I dont.
    Most of the time I'm working on existing models. I would need the Model-Viewer to drag one table to the modeler window and have the opportunity to import all dependend tables and see all the FKs. Otherwise I wouldn't work with it but still work with JDeveloper.
    Regards,
    Juergen

    Hi Philip,
    Yes I'm talking about the viewer in 2.1 EA1
    To be honest, I like the way Apex is doing it in the Object Browser / Model. You click on any table and it shows the first level dependency around it, you click on the dependend table and you get the first level dependencies of this table and so on.
    So first level dependencies would be enough but I would like to have the opportunity to import a single table and tell Data Modeler import all first level dependency tables, then I want to click to a imported table and say, import all first level dependencies of this table, and so on..., just like Apex.
    So first level would be a deal... :)
    Juergen

Maybe you are looking for