Draging a component
hi all,
i have created an applet with components such as label,texfield and buttons.Now i want to drag the components to some new locations in the applet.I went through some tutorials for drag and drop,but that dint help me. Everything explains about transferring datas....like moving the content of the label to a list box,etc....... I tried someother ways to do that.....but couldnt succeed,since i am new to this technology. so please help me do this.....
thanks in advance
My draggable class should help. Even if it's not exactly what your looking for you should be able to adapt it
you are welcome to use and modify this class but please do not change the package or take credit for it as your own work
Draggable.java
===========================
package tjacobs.ui;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
/** tjacobs.ui.Draggable
* usage:
* Component c = ...
* new Draggable(c);
* parent.add(c);
public class Draggable extends MouseAdapter implements MouseMotionListener {
Point mLastPoint;
Component mDraggable;
public Draggable(Component w) {
w.addMouseMotionListener(this);
w.addMouseListener(this);
mDraggable = w;
public Draggable(Window w, Component drag) {
drag.addMouseMotionListener(this);
drag.addMouseListener(this);
mDraggable = w;
public void mousePressed(MouseEvent me) {
if (mDraggable.getCursor().equals(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))) {
mLastPoint = me.getPoint();
else {
mLastPoint = null;
private void setCursorType(Point p) {
Point loc = mDraggable.getLocation();
Dimension size = mDraggable.getSize();
if ((p.y + WindowUtilities.RESIZE_MARGIN_SIZE < loc.y + size.height) && (p.x + WindowUtilities.RESIZE_MARGIN_SIZE < p.x + size.width)) {
mDraggable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
public void mouseReleased(MouseEvent me) {
mLastPoint = null;
public void mouseMoved(MouseEvent me) {
setCursorType(me.getPoint());
public void mouseDragged(MouseEvent me) {
int x, y;
if (mLastPoint != null) {
x = mDraggable.getX() + (me.getX() - (int)mLastPoint.getX());
y = mDraggable.getY() + (me.getY() - (int)mLastPoint.getY());
mDraggable.setLocation(x, y);
}
Similar Messages
-
DnD exception when Draging a component
Hi,
I am trying to implement a Drag n Drop feature for our application and always get the following exception, when drag a node from JTree and try to drop it another instance of the same JTree. this happens as soon as I call the startDrag method from the TransferHandler.
java.awt.dnd.InvalidDnDOperationException: The operation requested cannot be performed by the DnD system since it is not in the appropriate state
at sun.awt.dnd.SunDropTargetContextPeer.setCurrentJVMLocalSourceTransferable(SunDropTargetContextPeer.java:105)
at sun.awt.windows.WDragSourceContextPeer.startDrag(WDragSourceContextPeer.java:82)
at java.awt.dnd.DragSource.startDrag(DragSource.java:260)
at java.awt.dnd.DragSource.startDrag(DragSource.java:326)
For some other reasons, I am limited to using JDK 1.3.1 on NT.
I understand this a very uncommon problem but I get this exception every time.
Anybody have any ideas as what is wrong or whats the workaround? Any help in this matter would be highly appreciated.
Thanks,
N.Check out the link shown below:
http://forum.java.sun.com/thread.jsp?forum=57&thread=296255
If that doesn't answer your question, search the forum with "deudeu +dnd" and you'll find a lot of posts by this person on JTree DnD.
;o)
V.V. -
Fusion Charts in webdynpro FlashIsland.
Hi,
I used fusion charts in flex appliction. When trying to this SWF file using webdynpro FlashIsland , it not showing fusion chart.
can i use fusion charts in webdynpro FlashIsland.
Regards,
Anand.Hi Thomas,
Can you tell the steps to create FlashIsland application for fusion charts. I need a help. I need to show simple one bar chart with
some static data( no need to come from backend).
These are the my steps:
1) created new flex application (chart.mxml).
2) copied FusionChart.swc file into lib folder.(Downloaded trail version from flex site).
3) Uploaded WDIslandLibrary30 ,WDIslandLibrary30-debug in to flex application .
4)Created some chartdata collection array with some values.
4) drageed the component into flex appliction and setted attributes.
5) builded it and uploded into Flashisland appliction.
6) Running appliction application .
But it showing blank page.
Regards,
Anand.
Edited by: Anand_vis on Feb 24, 2012 8:35 AM -
How to implement drag&move JLable?
hi,
I am new to swing and pardon me if I ask some real simple questions.
Using swing, i want to be able to drag&move components (like JLable/JTextField)
in my content pane and then get components' precise postions (in X, Y coordinates, or
something like that). It is like moving puzzle pieces around.
PLS note: I want to MOVE the WHOLE component, NOT only the text within the component.
Does swing support this internally? How can I do that? Any comments/suggestions/sample code
are truly welcome.
Thanks a lot.
JKDo the way like DnD text for Label, except you put the entire JLabel component as Transferable data object.
- The DropTarget will get the component and add it to "parent" ( "parent" is the container component that you like add the draged JLabel component)
- The DragSource will get the endDrop notification and call its "parent" to delete the JLabel component dragged.
You must deal with the "parent" container to add/delete the component for this special DnD component.
There are no default Swing DnD support for it. -
Error draging data page component on strut flow diagram
i m using Jdeveloper10g(9.0.5.2) on windows 2000
creating web application using strut+ADF+JSP technology stack encounter following error, i tryed multiple restart to IDE but still have same situation.
Message
BME-99003: An error occurred, so processing could not continue.
Cause
The application has tried to de-reference an invalid pointer. This exception should have been dealt with programatically. The current activity may fail and the system may have been left in an unstable state. The following is a stack trace.
Action
If further errors occur, you should restart the application.
Also, report the problem on the JDeveloper forum on otn.oracle.com, or contact Oracle support, giving the information from this message.
//////////////////////////////////////////////////////Try to change your language settings to English(United States).
Abdelkrim -
In Flash CS4,How can I give a AS3 List Component a suitable horizontalScrollBar
In Flash CS4 when an AS3 List Component has too many rows,it will has a verticalScrollBar automatically. but it will never has a horizontalScrollBar even a part of the content of the list is hidden.
I set the property list.horizontalScrollPolicy="on",and set list.maxHorizontalScrollPosition=200; then the horizontalScrollBar appear
but when I click the item of the list, all the list move to left, half of the list is hidden,
I can only see the right part of the list, the I click the list again,the list move to right,then I can see all the list by move the horizontalScrollBar
How can I give a suitable horizontalBar to the AS3 list component?Thank you for your help! (sorry,I`m bad in English...)
In fact, it works.
but,I made a mistake,the reason I want to give a list a horizontalScrollBar is:I want to show all content in a list that is not wide enough,
you see,first row can show all content in this list,but in the other rows,the content is too wide to show,I want to give the list a horizontalScrollBar to show all content by draging the horizontalScrollBar to right.
now,set property:
list.horizontalScrollPolicy="on", list.maxHorizontalScrollPosition=30;(the result is the image above),when I drag the horizontalScrollBar to right:
ah ha ,the row can`t show all content too,the horizontalScrollBar is related to the width of all the list, is not related to the width of the content in every row.
now I kown why the horizontalScrollBar is always disable.
but in design,to show a lot of content,we can`t draw a list too wide, it`s not beatiful,so I want to use a horizontalScrollBar to show all content in every row.
and the list is not too wide
ah ah, like the list in Flex4
In fact,ah,I have not studied Flex 4,so,I have to make it by using Flash CS4 Component
How can I do? Please
(so sorry for my bad English,I do my best in it) -
How to make default selection blank for SelectOneChoice component
Query 1
I have a JSF page having databound selectOneChoice on an attribute of ViewObject. The attribute LOV configuration has the List, Return Value set with the same value. UI Hints --> Choice List Options is checked for "Include No Selection Item" with "blank Item First to List" from drop down. When JSF loaded, default selected item does not appear to be blank. I expect that No Select Item should be selected by default. Do let us know if anything specific to be done for this?
Query 2
I have a JSF page to which taskflow containing a single jsff draged as region. On submit of JSFF form, all the read-only text-fields on jsff are getting blank. I want to retain the values of read-only fields on jsff. Please advice.This is in reference to Jdev 11g, using jspx's in adfc-config..
If your selectonechoice is like this,
<af:selectOneChoice value="#{bindings.SolutionUnit.inputValue}"
label="Cost Centre">
<f:selectItems value="#{bindings.SolutionUnit.items}"/>
</af:selectOneChoice>The selected value depends on what is retruned by the 'value' property of your component. If my #{bindings.SolutionUnit.inputValue} returns a null value or a value which is not present in <f:selectItems value="#{bindings.SolutionUnit.items}"/>, then I will get a blank row selected...
haven't worked much with regions, so.. -
I want to make a component which is dragable
and also accept same type other component.
Like photoshop layer panel,history panel,property panel whis is combined together as grouped item and can also be detached using draging.
Is this possible in flex as 3.Yes, for sure. Did you mean that you wanna use the Flex 3 or ActionScript 3?
If you are using Flex 3 take a look at this: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64595-7fed.html
If you are using Flex 4 you can also download the source code of this project: http://rectius.com.br/blog/?p=713
Regards,
Pablo Souza -
Problem with inputText in my custom component
Hi, I have a custom dataTable component that I'm trying to get to work. It has to be a custom component because dataTable doesn't support rowspan, colspan, multi line headers, and a rendered attribute for rows. The problem is, that when I wrap the column tag inside my row tag then the method for the inputText tag never gets called in the UPDATE_MODEL_VALUES phase.
I'm starting to think that JSF doesn't support 2 levels of tags between the inputText and dataTable. I'm hoping that someone can tell me what I have wrong with my components.
Here is the JSP snippet.
<cjsf:rptTable>
<cjsf:data id="dataTable1" value="#{allAuthUser.tableRows}" var="myTableRow1">
<cjsf:row>
<cjsf:col>
<h:inputText id="tableTestFld" value="#{myTableRow1.testFld}" size="5" maxlength="5"/>
</cjsf:col>
</cjsf:row>
</cjsf:data>
</cjsf:rptTable>Here is what it renders. It looks to me like everything renders fine. So I'm guessing that there is something in a component that is causing JSF during the life cycle to not be able to process correctly.
<table>
<tbody>
<tr>
<td><input id="tblmaintForm:body:dataTable1_0:tableTestFld" name="tblmaintForm:body:dataTable1_0:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
</tr>
<tr>
<td><input id="tblmaintForm:body:dataTable1_1:tableTestFld" name="tblmaintForm:body:dataTable1_1:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
</tr>
<tr>
<td><input id="tblmaintForm:body:dataTable1_2:tableTestFld" name="tblmaintForm:body:dataTable1_2:tableTestFld" type="text" value="" maxlength="5" size="5"/></td>
</tr>
</tbody>
</table>Note: If I leave off the row tag it renders the same way except of course the <tr> and </tr> tags are missing. If I do this, then the backing method for the inputText tag is called and everything works fine. Why doesn't it work with the row tag in place?
Here are the components:
public class UIRptTable extends UIComponentBase {
public UIRptTable() {
setRendererType("tblmaint.rptTableRenderer");
public String getFamily() {
return "javax.faces.Output";
public class UIRptTableData extends HtmlDataTable {
public UIRptTableData() {
setRendererType("tblmaint.rptTableDataRenderer");
public String getFamily() {
return "javax.faces.Data";
public class UIRptTableRow extends UIOutput {
public UIRptTableRow() {
setRendererType("tblmaint.rptTableRowRenderer");
public String getFamily() {
return "javax.faces.Output";
public class UIRptTableCol extends UIColumn {
public UIRptTableCol() {
setRendererType("tblmaint.rptTableColRenderer");
public String getFamily() {
return "javax.faces.Column";
}Here is part of the faces-config file in case you need it.
<!-- Components -->
<component>
<component-type>tblmaint.rptTable</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTable</component-class>
</component>
<component>
<component-type>tblmaint.rptTableData</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableData</component-class>
</component>
<component>
<component-type>tblmaint.rptTableRow</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableRow</component-class>
</component>
<component>
<component-type>tblmaint.rptTableCol</component-type>
<component-class>com.monsanto.ag_it.fieldops.aim.tblmaint.component.UIRptTableCol</component-class>
</component>
<!-- Render Kits -->
<render-kit>
<renderer>
<component-family>javax.faces.Output</component-family>
<renderer-type>tblmaint.rptTableRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableRenderer</renderer-class>
</renderer>
</render-kit>
<render-kit>
<renderer>
<component-family>javax.faces.Data</component-family>
<renderer-type>tblmaint.rptTableDataRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableDataRenderer</renderer-class>
</renderer>
</render-kit>
<render-kit>
<renderer>
<component-family>javax.faces.Output</component-family>
<renderer-type>tblmaint.rptTableRowRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableRowRenderer</renderer-class>
</renderer>
</render-kit>
<render-kit>
<renderer>
<component-family>javax.faces.Column</component-family>
<renderer-type>tblmaint.rptTableColRenderer</renderer-type>
<renderer-class>com.monsanto.ag_it.fieldops.aim.tblmaint.renderer.RptTableColRenderer</renderer-class>
</renderer>
</render-kit>I sure hope that someone can help me out. Please let me know if you need any additional information.
Thanks,
RayHi, Ray!
1) I was trying to put a button in the column header (for sorting) and I couldn't get that to work. That involved the >colhdr tag. I got that to work but I don't remember the fix. I'll look it up and reply back with that when I can.Dealing the first part of your trouble, you need NOT a custom component.
I have looked through the implementation of RepeaterRenderer, as you advised me, and found that the multi-header possibility is included in the implementation of dataTable control.
The code below is the part of source of repeater.jsp with only change:
<d:data_repeater>  <h:dataTable>
And it works fine.
<h:dataTable id="table"
binding="#{RepeaterBean.data}"
rows="5"
value="#{RepeaterBean.customers}"
var="customer">
<f:facet name="header">
<h:outputText value="Customer List"/> <!� First Header row -- >
</f:facet>
<h:column>
<%-- Visible checkbox for selection --%>
<h:selectBooleanCheckbox
id="checked"
binding="#{RepeaterBean.checked}"/>
<%-- Invisible checkbox for "created" flag --%>
<h:selectBooleanCheckbox
id="created"
binding="#{RepeaterBean.created}"
rendered="false"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Account Id"/> <!�Second Header row -- >
</f:facet>
<h:inputText id="accountId"
binding="#{RepeaterBean.accountId}"
required="true"
size="6"
value="#{customer.accountId}">
</h:inputText>
<h:message for="accountId"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Customer Name"/> <!�Second Header row -- >
</f:facet>
<h:inputText id="name"
required="true"
size="50"
value="#{customer.name}">
</h:inputText>
<h:message for="name"/>
</h:column>
<h:column>
<f:facet name="header"> <!�Second Header row -- >
<h:outputText value="Symbol"/>
</f:facet>
<h:inputText id="symbol"
required="true"
size="6"
value="#{customer.symbol}">
<f:validateLength
maximum="6"
minimum="2"/>
</h:inputText>
<h:message for="symbol"/>
</h:column>
<h:column>
<f:facet name="header"> <!�Second Header row -- >
<h:outputText value="Total Sales"/>
</f:facet>
<h:outputText id="totalSales"
value="#{customer.totalSales}">
<f:convertNumber
type="currency"/>
</h:outputText>
</h:column>
<h:column>
<f:facet name="header"> <!�Second Header row -- >
<h:outputText value="Commands"/>
</f:facet>
<h:commandButton id="press"
action="#{RepeaterBean.press}"
immediate="true"
value="#{RepeaterBean.pressLabel}"
type="SUBMIT"/>
<h:commandLink id="click"
action="#{RepeaterBean.click}"
immediate="true">
<h:outputText
value="Click"/>
</h:commandLink>
</h:column>
</h:dataTable>
You may have a look at HTML source to prove that dataTable is already what you need:
<table id="myform:table">
<thead>
<tr><th colspan="6" scope="colgroup">Customer List</th></tr>
<tr>
<th scope="col"></th>
<th scope="col">Account Id</th>
<th scope="col">Customer Name</th>
<th scope="col">Symbol</th>
<th scope="col">Total Sales</th>
<th scope="col">Commands</th>
</tr>
</thead>
<tbody>
2.) The second trouble is still unsettled as previously. Right now I have different task at my job, and I can�t continue investigation of this problem.
But when you find smth., please let me know. I�ll be very grateful.
Regards,
Oleksa Stelmakh -
Mini dvi to Component Video adapter !
Help !
Where Can I Find "mini dvi to Component Video adapter" ?
Help !"there is no such thing in apple store"
I MAID,
Begging your pardon, but I just tried the above linked Search Results, and what you seek is apparently on the list, as the search was performed exactly as you specified. You can read the description of the various items for sale and tell us what is different about the one that you need. That way we can perform a new search for you, or, in the alternative, you can search for yourself. If the Apple Store doesn't have what you want, search CompUSA. -
Presently I have a mini display port>VGA adaptor, running to a convertor box I picked up that handles S-video out, which is working fine for SD. I also have a VGA to Component Video (5 wire RCA) adaptor cable. Connecting Component adaptor dircetly to the mini display adaptor doesn't seem to work, neither does plugging it into a VGA port on the SD convertor box. I am guessing there is another convertor box out there that will help me make the transition from mini display to Component. Even if it means having a handful of adaptors plugged in. does anyone know where to find such a wonderful and magical device?
ThanksYour setup works fine for DV, because you used a DV deck and most likely DV footage. But now you are working with 720p HD footage (what format, BTW? HDV, dvcpro HD?). That same setup won't work for monitoring HD. Now you need an HD box or card to send out a proper HD signal. And since you have an older G5, you won't find any current solutions. You'll have to look at used capture cards that are PCIx. Or you and look at the Matrox MXO, that connects to the computer via a monitor connection. DVI.
-
I want to hook up Apple TV but my One HDMI Jack on my TV is already connected to my HD cable box. My TV has jacks for s video, component, and PC in jacks.
Can I use one of them to connect to Apple TV with some type of cable to my newer I-pad ?Here are the Apple TV outputs.
What other outputs does your HD cable box have?
Apple TV (2nd and 3rd generation): Guide to ports and connectors
http://support.apple.com/kb/HT5713
Cheers, Tom -
Why do I need to declare "defaultButton" ? (In a component form part of view stack)
After doing some research and some help from FlexGuy in another thread, I realize that I need to make sure I have custom components initialized before accessing parts of the component. Just recently I was thrown for a long time when I tried to first click on a form field that was part of a component in my view stack, I'd get:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.managers::FocusManager/focusInHandler()[C:\autobuild\galaga\frameworks\projects\framew ork\src\mx\managers\FocusManager.as:601]
With the debugger it's occuring in the focusInHandler method of FocusManager.as: (apparently _defaultButton is null.)
// restore the default button to be the original one
if (defButton && defButton != _defaultButton)
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
This prompted me, on a whim, to delcare a defaultButton:
<mx:Form id="empForm" defaultButton="{submitButton}">
which refers to my submit button:
<mx:Button id="submitButton" click="submitEmployee()" label="{submitLabel}"/>
My question, is why is this necessary? In some examples I don't see this declared at all, but I seem to need it? (I'm calling creationPolicy="all" to make sure my components are initialized but I still seem to have to this defaultButton declared?)It's a way of proving that you are able to purchase content from that country's store i.e. that you have a valid billing address in it
From Why can’t I select None when I edit my Apple ID payment information? - Apple Support :
If you changed your country or region
When you change the country or region of an existing Apple ID, you must provide a payment method and update your billing options. If you want to remove your payment method after you change the country or region, you can change your payment information to None. -
IE Script error when double clicking on a view in Abap Webdynpro component
Hello experts,
I am running mini SAP trial version 2004 with Internet explorer 7.0 and also installed gui patch 23.
I am making a sample application in SE80 and when double clicking on a view in Abap Webdynpro component I get following error:
<b>Internet Explorer Script Error</b>
An error has occured in the script on this page.
Line: 1
Char: 1
Error: 'wdp_show_menu' is undefined
Code: 0
URL: http://satellite5200:8000/sap/bc/wdvd/painting.html?_vdrespkey=EOJ6V1JQMX0VLTQ7AP6DQM64Y&_vdframe=painting&sap-client=000
Do you want to continue running scripts on this page?
Thanks in advance.
BhupendraHi Bhupendra,
If you are seeing this error in the Se 80 editor , i guess you can ignoire that ...While running the application it will not show any error.
Thanks
Anzy -
Create a new view in a enhance component
Hi All,
I want to create a new view for sales order and quatation in a component BP_factsheet.When i craete new view ,it is asking about some value like model node, bol entity, higher level, bol realtion.after that is is asking context node ,bsp application ,custome controller and view type.How can i get these value .when i create a new view then have to add these view in run time repositry under a window or not?
Thanks in advance....
VishwasHello Vishwas,
You might be interested in knowing how to customise the new UI to add a new view using the enhancement concept.
Please refer to the published document on the service marketplace:
http://help.sap.com/saphelp_crm60/helpdata/en/1a/023d63b8387c4a8dfea6592f3a23a7/frameset.htm
refers to the link at
service.sap.com/okp
Inside this go to:
SAP CRM 2006s: Learning Map for Technology Consultants
wherein you can find the cookbook to perform similar operation in detail.
SAP CRM UI Cookbook
I hope this helps.
Maybe you are looking for
-
Unit testing and system integration testing for crystal report
Hi gurus, I am creating crystal report by oracle procedure, will you please tell me how to do unit testing and system integration testing? appreciate very much.
-
How to sync calendars and contacts between ios 3.1.3 and Mountain Lion?
I have a 1st generation iPod touch under iOS 3.1.3 and a MacBook Pro under Mountain Lion 10.8.3 with iTunes 11.0.1. Since the upgrade to Mountain Lion syncing calendars and contacts between the iPod Touch and the Mac no longer works. I don't want my
-
How do I stop TV shows from being deleted?
Is there a way to restrict the ability to delete a tv show or series from an iPad? Our son has just deleted 2 of his cartoon series and as we are on hols, I didn't bring the laptop....also, is there a way to get the show back?
-
Web service: parameter types
Hi, We made an ABAP webservice with input parameters. In the WSDL the type of the parameters is: - <wsdl:message name="ZTestWebService2"> <wsdl:part name="Costcenter" type="n0:char10" /> The type char10 is defined like: - <xsd:simpleType name="char
-
Dear All, when i try to post document in the no. range which has only the balance of 400 documents,it is showing the warning message: number range RF_BELEG has reached the critical limit but i want to control this message only for last 100 documents.