UIX Tree for all who needs help!!!

Hi guys!!!
Uix team can`t write any examples of this subject, we decided to create it :-)...
There is an example of working tree with proxy for JDev 9.03!!!
All data takes from the DataBase. We use a ViewObject for DataBinding with hierarhical querry
(start with...
connect by prior... )! Dont forget to write this querry!
For using this querry U must use primary key (but not the rowID Item!!!!).
Don`t forget to change the name of your package, appmodule in UIX and Java!!!
There are Java & Uix files here!
If U have any questions ask us for e-mail: [email protected] !
With best regards,
Diamond Developer Team (Stukotiy Luda (advancd support), Chindakov Alex, Druppov Serge).
From Russia!
P.S. We will be glad to see the working example of hGrid with the same DataBinding!
package mypackage1;
import java.lang.String;
import oracle.cabo.data.jbo.ui.bind.UIBindingUtils;
import oracle.cabo.servlet.BajaContext;
import oracle.cabo.servlet.Page;
import oracle.cabo.servlet.event.EventResult;
import oracle.cabo.servlet.event.PageEvent;
import oracle.cabo.servlet.ui.BajaRenderingContext;
import oracle.cabo.ui.RenderingContext;
import oracle.cabo.ui.UIConstants;
import oracle.cabo.ui.data.DataObject;
import oracle.cabo.ui.data.DataObjectList;
import oracle.cabo.ui.data.tree.ClientStateTreeDataProxy;
import oracle.cabo.ui.data.tree.SimpleTreeData;
import oracle.jbo.NoDefException;
import oracle.jbo.Row;
import oracle.jbo.RowIterator;
import oracle.jbo.ViewObject;
import oracle.jbo.server.ApplicationModuleImpl;
// --- File generated by Oracle Business Components for Java.
public class Mypackage1ModuleImpl extends ApplicationModuleImpl
* This is the default constructor (do not remove)
public Mypackage1ModuleImpl()
* Container's getter for TsStatView1
public TsStatViewImpl getTsStatView1()
return (TsStatViewImpl)findViewObject("TsStatView1");
* Sample main for debugging Business Components code using the tester.
public static void main(String[] args)
launchTester("mypackage1", "Mypackage1ModuleLocal");
public class JBODataObjectList implements DataObjectList
* Create a data object list based on the current range of
* this row iterator.
public JBODataObjectList(RowIterator iterator)
this(iterator, Integer.MAX_VALUE);
* Create a data object list based on the current range of
* this row iterator, with a restricted size.
public JBODataObjectList(RowIterator iterator, int maxSize)
_iterator = iterator;
size     = Math.min(iterator.getRowCountInRange(), maxSize);
* Return the size of the list.
public int getLength()
return _size;
* Get an item from the list.
public DataObject getItem(int index)
// Make sure we're in range
if ((index < 0) || (index >= _size))
throw new IndexOutOfBoundsException();
Row row = _iterator.getRowAtRangeIndex(index);
if (row == null)
return null;
return new DO(row);
// An inner class that handles a single row
static private final class DO implements DataObject
public DO(Row row)
_row = row;
public Object selectValue(RenderingContext context, Object key)
// Make sure that the key is non-null
if (key != null)
try
// Treat the key as an attribute name
return _row.getAttribute(key.toString());
catch (NoDefException nde)
// Do nothing. It's legal to pass an invald key to DataObjects.
return null;
private final Row _row;
private final RowIterator _iterator;
private final int _size;
public class Tree implements DataObject {
private String submitURL = null;
public Tree(String submitURL){
this.submitURL = submitURL;
public static DataObject getProxy(RenderingContext rc, String ns, String name) {
return new Tree(null);
public static EventResult handleExpand(BajaContext context,Page page,PageEvent event)
throws Throwable
String state = event.getParameter(UIConstants.STATE_PARAM);
String node = event.getParameter(UIConstants.NODE_PARAM);
String selection = event.getParameter(UIConstants.SELECTION_PARAM);
EventResult result = new EventResult(page);
Object proxy = new ClientStateTreeDataProxy(null, state, node, selection);
result.setProperty("proxy", proxy);
return result;
public static int s = 0; // ������
public static int i = 0; // ������
// � ��������, ����������� ����, ���������� ��� ����� ������� �������� �����������!!!
public static String mOwner[]=new String[100]; // �������� ���� fk_owner �� ����
public static String mName[]=new String[100]; // �������� ���� fc_name �� ����
public static DataObject getTree(RenderingContext rc, String ns, String name){
SimpleTreeData child = new SimpleTreeData();
SimpleTreeData parent = new SimpleTreeData(); // ����������� ��������
SimpleTreeData parent1 = new SimpleTreeData(); // �������� �������
SimpleTreeData parentBuf[] = new SimpleTreeData[130]; // ����� ��� �������� ����������� ��������
int ownerInt; // ��� �������� fk_owner ������� ������
int buf = 0; // ��� �������� fk_owner ������� ������
String ownerStr, // --- � ������� ������
valueColumn; // ������ �������� ������� ������
if (i==0)
ViewObject vo = UIBindingUtils.getViewObject(rc); // ��� VO
vo.previous();
//for(s=0;s<96;s++)
while(vo.hasNext())
Row row=vo.next();
mOwner[s]=row.getAttribute("FkOwnerid").toString();
mName[s]=row.getAttribute("FcName").toString();
s++;
for (i=0;i<s;i++)
ownerStr=mOwner;
valueColumn=mName[i];
//ownerStr = row.getAttribute("FkOwnerid").toString();
ownerInt = Integer.parseInt(ownerStr);
//valueColumn = row.getAttribute("FcName").toString();
if(ownerInt == 0) // ������ ������
parent1 = new SimpleTreeData();
parent1.setText(valueColumn);
parent1.setExpandable("expanded");
parent.addChild(parent1);
buf = 0;
// parentBuf[ownerInt] = new MySimpleTreeData();
else
if(ownerInt != buf)
if(ownerInt > buf)
child = new SimpleTreeData();
child.setText(valueColumn);
child.setExpandable("expanded");
parent1.addChild(child);
parentBuf[ownerInt] = parent1;
parent1 = child;
buf = ownerInt;
else
child.setExpandable("no");
parent1 = parentBuf[ownerInt];
child = new SimpleTreeData();
child.setText(valueColumn);
child.setExpandable("expanded");
parent1.addChild(child);
parent1 = child;
buf = ownerInt;
else
child.setExpandable("no");
child = new SimpleTreeData();
child.setText(valueColumn);
child.setExpandable("expanded");
//parentBuf[ownerInt].addChild(child);
parent1 = parentBuf[ownerInt];
parent1.addChild(child);
parent1 = child;
if(i == 95)
child.setExpandable("no");
//child.setExpandable("no");
return parent;
public Object selectValue(RenderingContext rc, Object p1) {
BajaContext bc = BajaRenderingContext.getBajaContext(rc);
EventResult result = EventResult.getEventResult(bc);
Object proxy = (result==null) ? null : result.getProperty("proxy");
if (proxy==null) proxy = new ClientStateTreeDataProxy( submitURL, null, null, null);
return proxy;
<?xml version="1.0" encoding="windows-1252"?>
<page xmlns="http://xmlns.oracle.com/uix/controller"
xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
xmlns:ui="http://xmlns.oracle.com/uix/ui"
xmlns:bc4j="http://xmlns.oracle.com/uix/bc4j"
xmlns:html="http://www.w3.org/TR/REC-html40">
<bc4j:registryDef>
<bc4j:rootAppModuleDef name="TsStatView1AppModule"
definition="Project4.Mypackage1Module"
releaseMode="stateful" >
<bc4j:viewObjectDef name="TsStatView1"
rangeSize="3" />
</bc4j:rootAppModuleDef>
</bc4j:registryDef>
<content>
<dataScope xmlns="http://xmlns.oracle.com/uix/ui"
xmlns:data="http://xmlns.oracle.com/uix/ui">
<provider>
<data name="Proxy">
<method class="mypackage1.Tree" method="getProxy" />
</data>
<data name="Nodes">
<method class="mypackage1.Tree" method="getTree" />
</data>
</provider>
<contents>
<bc4j:rootAppModuleScope name="TsStatView1AppModule" >
<contents>
<document>
<metaContainer>
<!-- Set the page title -->
<head title=""/>
</metaContainer>
<contents>
<bc4j:viewObjectScope name="TsStatView1" >
<contents>
<pageLayout>
<contents>
<form name="menuForm" >
<contents>
<tree id="menuTree" formSubmitted="true"
data:nodes="nodes@Nodes"
data:proxy="proxy@Proxy" />
</contents>
</form>
</contents>
</pageLayout>
</contents>
</bc4j:viewObjectScope>
</contents>
</document>
</contents>
</bc4j:rootAppModuleScope>
</contents>
</dataScope>
</content>
<handlers>
<event name="expand" >
<method class="mypackage1.Tree" method="handleExpand" />
</event>
</handlers>
</page>

Don't forget, you can make code easier to read by enclosing it in [code ]  tags (without the space in the first tag), so it looks like this:
<provider>
     <data name="bundle">
          <bundle class="strings" />
     </data>
</provider> instead of this:
<provider>
     <data name="bundle">
          <bundle class="strings" />
     </data>
</provider>

Similar Messages

  • After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.

    After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.Urgent.TQ

    Izit software or hardware? Confuse:(
    Only can use wifi now.
    Any way thanks guys for ur suggestion:) amishcake and simes

  • HT4993 i have iphone5 A1429 locked by sprint. now i am in Saudia Arabia. i want to unlock it for all carrier. pls help me.

    i have iphone5 A1429 locked by sprint. now i am in Saudia Arabia. i want to unlock it for all carrier. pls help me.

    Are you a Sprint customer? If so, contact Sprint and see if you qualify to have it unlocked for use on non US carriers.
    If you are not a Sprint customer, sell it to someone in the US who can use it. Sprint will only unlock iPhones for current Sprint customers in good standing.

  • Bought a Template for a customer Need Help

    I know HTML but the coding to change things baffles me.  I am out of help with the seller who is in Australia.
    This is what the .txt looks like that I change function with.
    &Home_txt8=<font color="#d0d0d0"><b>text goes here
    It looks straightforward but I cant use /*  */  or <!--  to deactivate stuff so I can try it out.
    Any help would be welcomed.
    the url of the site is www.danceations.com
    I have done some mods but want to do more.
    Joepd

    The replies are terse and don't come right away. I bought it from some 
    outfit in Australia.  When I asked how do I get rid of the pulldown phono  on
    the index page the answer was "remove the first page of the Flash.fla.  
    Except it took out the song I added and I would need tro recreate a Flash  Page.
    Ugh!
    Not a good experience.
    joepd
    In a message dated 2/9/2012 4:19:49 P.M. Eastern Standard Time, 
    [email protected] writes:
    Re:  Bought a Template for a customer Need Help
    created by John Waller (http://forums.adobe.com/people/John+Waller)  in 
    Dreamweaver - View the full  discussion
    (http://forums.adobe.com/message/4196974#4196974)

  • Find Tax Return Locations for all Accounting needs, File Tax return......

    Hi dear friends
    Find Tax Return Locations for all Accounting needs, File Tax return, Business Accounting, Payroll, Income Tax, Property Tax, State Tax.
    Find a qualified local Tax Professional, CPA, Accounting Firm,  Accountant, Financial Planning from most widely used Directory.
    Our services are -- irs tax help, accounting, taxes, irs, tax debt help, payroll, income tax, property tax, tax attorney, tax, cpa, accountants, tax help, tax return, business tax return, free tax help, estate tax,
    More information visit below here --
    [FINDTAXRETURN|http://www.findtaxreturn.com/]
    Cheers
    Admin

    I have already received the TT application for 2012 filing.
    Have you checked at their website?
    http://www.turbotax.com/lp/ty11/ppc/hp.jsp?cid=ppc_gg_b_stan_dk_us_hv-trbtx-mn&a did=18494275668&skw=TurboTax&kw=turbotax&ven=gg&

  • Find Tax Return Locations for all Accounting needs, File Tax return, Busine

    Hi dear friends
    Find Tax Return Locations for all Accounting needs, File Tax return, Business Accounting, Payroll, Income Tax, Property Tax, State Tax.
    Find a qualified local Tax Professional, CPA, Accounting Firm,  Accountant, Financial Planning from most widely used Directory.
    Our services are -- irs tax help, accounting, taxes, irs, tax debt help, payroll, income tax, property tax, tax attorney, tax, cpa, accountants, tax help, tax return, business tax return, free tax help, estate tax,
    More information visit below here --
    [FINDTAXRETURN|http://www.findtaxreturn.com/]
    Cheers:)
    Admin:)

    I have already received the TT application for 2012 filing.
    Have you checked at their website?
    http://www.turbotax.com/lp/ty11/ppc/hp.jsp?cid=ppc_gg_b_stan_dk_us_hv-trbtx-mn&a did=18494275668&skw=TurboTax&kw=turbotax&ven=gg&

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How could I convert a locked PDF file to Microsoft Word file?Uergency for exam!Need help!

    How could I convert a locked PDF file to Microsoft Word file? Because of locking, I could not print it. Uergency for examination! Need help from veteran!

    Adobe do not offer any products, or help, in hacking protected files.

  • For all who are facing restarts and battery proble...

    I now have N8 with Anna perfectly working without tweaking (except for wifi scanning) any settings without battery life issues and no spontaneous resets..
    Soln 1 :
    Go to post 31 in this  thread /t5/Nseries-and-Symbian-Smartphones/Anna-Battery-Consumption-very-heavy-Nokia-N8/td-p/1121257
    This will solve the problem.
    Soln 2 -
    I still had sluggish performance after soln 1. I also noticed, that all the issues are reported by people who have "upgraded from pr 1.2 to Anna". I have not come across similar issues in the forum from people "who purchased phone with Anna pre-loaded". It seems that the upgrade process probably has some issues.
    I downloaded the "FULL" official firmware of my country's variant of Anna. Using a tool that I downloaded, I completely flashed my N8 with the full firmware. Ever since performance has been a whiz...no battery life issues and no resets. It is as good as the N8 purchased from the store with Anna pre-loaded from factory.
    Some caveats :
    1. This is not for the timid-hearted. The steps have to be followed exactly. Do your research before you attempt.
    2. Take a backup of your N8 before you do this. After you follow the procedure "Do not restore your applications & settings". Re-install them instead.
    3. For reasons that are obovious, I cannot mention the steps nor the links. It is easy enough to get by google search.
    Good luck..

    vstjames wrote:
    First off, I can't guarrantee this will fix your particular issue. It fixed mine. Apparently, ICS reconfigures numerous programs and settings. Comcast Email is one of them. The settings have SSL as default in both, incoming and outgoing. Comcast, afaik, doesn't use or require SSL. You need to change SSL to "none" in both, incoming and outgoing settings. That's it. Nothing else need be done. Close it, relaunch email app, let it connect or manually connect. The "no connection" error should be gone and your email should come in and go out. Now, how to to do it:
    Click on the "Apps" circle button, all apps, My Accounts (or Accounts and Sync if you don't have My Accounts), Email & Calendars, --> choose your comcast account and go to Account settings, -->choose Comcast (not General), scroll down to "Server Settings". Here you'll find your incoming and outgoing settings. Under "security type" choose "none" and do that for both, incoming and outgoing. Incoming Port: 110; Outgoing Port: 587. Click done, for each server, incoming, then outgoing. It will validate the server each time. When finished, click done, and let it connect to email and download it.
    I hope this helps all who have been having Comcast Email issues after ICS update. Good luck!
      It changed my GoDaddy account (I have my own domain name with email) settings, along with my wife's RoadRunner email settings. It doesn't look like it is just Comcast email...

  • IPod Info for those who need it

    Just thought I'd give some help to those who need it.
    - For those who are having trouble with their ipods accepting some videos and not others, try shortening the names of the video files. As long as the video files are in the proper format, this should clear up that issue.
    - For those who want to get the songs off of your ipod without having to worry about the iTunes one-way syncing issue the following programs will help you with that:
    PodPlus
    iPod Agent
    - For those who are just curious, here are the size incriments for data:
    Bit
    Byte
    Kilobyte
    Megabyte
    Gigabyte
    Terabyte
    Pentabyte
    I've got the 5th gen iPod and after a little finessing, I think I've got it all pretty much figured out. So, if anyone has questions, gimme a shout. Or maybe you've got some cool ideas I can use!
    5th Gen Windows XP Pro
      Windows XP Pro  

    What is an ideal average setting for my homemade iMovies?
    Settings for your iMovie for what? If your are talking about conversion to an iPod compatible format, which format? Are you more concerned with quality or quantity?
    First, what's the best, fastest and easiest way to convert these iMovies to the H.264 (is that done through iMovie or QT Pro or both) and what other settings (audio for one) should I be using besides the standard 30 fps ?
    Your are using the same QT tools whether you convert directly from iMovie or indirectly via QT Pro using a reference file. (I.e., the only time you save is the time it takes to write the reference file itself.)
    Define what you mean by best.
    The "Movie to iPod (320x240)" option is the fastest in terms of programming your conversion but the slowest in terms of time it take for processing. The "Movie to MPEG4" option is slower/harder to program for a single pass H.264 encode, but takes half the time to process as the dedicated H.264 option. MPEG4 video options (single pass and 2-pass modes) are faster than H.264 codec. Audio options are the same for both H.264 and MPEG4 formats -- AAC LC. I personally would stick with the 44.1 kbps sampling rate and 128 kbps data rate for audio but you could take it up to 48 kbps at 160 kbps if you want. As to frame rate, I would stick with the current (original) setting of your source. 30 (29.97) fps provides the smoothest flow of motion. You could, of course, try 24 or even 15 fps in some cases to see if it is acceptable. Dropping below 12 fps would probably be unacceptable to most people. But you're the producer and director here, so you have to make up your own mind.

  • TS1702 how can I get anyone to give us answer on the iphone apps casino game we purchased few days ago which once the token was finished we were not able to reset and play just for fun and not for gambling. we need help and not to be charged additional

    few days ago I have purchased Iphone casino games from itunes apps store. One of the game was made by the company called "ARISTOCRAT" dragan game. Usually we will get basic tokens to play the game, and if we ran out of the tokens all we need to do is going into "manu" and "setting" selete "dream" and reset that we should be able to continue play the game with same amount of the basic tokens. The one game would not let us to go back to the game. There were msg came out said" game center requires an active connection to the internet"? I didn't feel comfortable because we purchased the game for $1.99 to play for fun and not to gamble. We do have credit card on your file. We don't want to be charged alot of money for something not in our well. I need help to answer the question on the following:
    1.  Are we able to ever play this game again without going to internet? We don't even know which site to go to, because when we press the ok button nothing else came out to direct us to any area.
    2. We only purchased the few days ago order ID: MGT74GN6V7 on 10/03/12. all the other games we purchased we were able to continue to play by doing the same setting.
    Thank you for your help and looking forward to hear from you!

    You need to contact itunes support
    We are all itunes users just like you.
    http://www.apple.com/support/contact/

  • Powerbook G4  looses settings for booting for firewire?Need Help

    I have a powerbook g4 17 inch al..
    1.67 pro
    2 gigs ram
    and I formatted a seagate firewire 800 drive to be my hdd replacment <<it died
    well its installed fine ( partations is for powerbook boot)
    however when i shut down it doesn't find the drive..
    I tried ... setting the startup disk in preferences
    disk repair... permissions repair...
    if i press the option it doesn't find the drive... however it might have once found it before i migrated all my settings from time machine to it...
    the only way it works for me right now is to use the cd and then disk utilities..then choose startup disk... then it stARTS...
    any help would be great...
    thanks stateapple

    war is still on because computer are the key to uniting this world and ending war...
    and at macs prices they will not be the choosen machine...
    the prices are still high... and the prices 15 years ago were out of control...
    you get what you pay for... well this forum is proof that macs as far as hardware is concerned is no different then a pc of the same caliber ...both break down
    only difference is the pc doesn't cost an arm and leg to get it working again...
    why do you think i am trying to boot from firewire...
    because my harddrive quit after 3 years..right after warrenty ends....hmmmm
    when will a computer company ofer the same lifetime warrenty i can get from sears for my tools....
    yea i need to renew it every few years but at least they stand behind there product as long as I choose...
    I would still have my mac under warranty... but it wasn't an option... what does that say about the product or the company selling it to you....( keep in mind Sears offers a warranty for all tools and I could keep the warranty going forever)
    but that not what i was asking....
    how do I get help online with a professional to help solve my computer issue?
    i live an hour and half from the closet apple store.... 2 hour round trip...
    thank you...

  • Extract Menu Tree for All Active Menus

    All,
    I am trying to create an extract of the menu tree hierarchy for a group of "active" menus (i.e., active in that the menu is assigned to a responsibility which is assigned to a user). I have used the following query which returns the menu tree for a given MENU_ID (&MENU_ID):
    SELECT      LPAD(' ', 6*(LEVEL-1)) || menu_entry.entry_sequence sequence
         , LPAD(' ', 6*(LEVEL-1)) || menu.user_menu_name SubMenu_Descrition
         , LPAD(' ', 6*(LEVEL-1)) || func.user_function_name Function_Description
         , menu.menu_id
         , func.function_id
         , menu_entry.grant_flag Grant_Flag
         , DECODE(menu_entry.sub_menu_id, null, 'FUNCTION', DECODE(menu_entry.function_id, null, 'SUBMENU', 'BOTH')) Type
    FROM      apps.fnd_menu_entries menu_entry
         , apps.fnd_menus_tl menu
         , apps.fnd_form_functions_tl func
    WHERE      menu_entry.sub_menu_id = menu.menu_id(+)
         AND menu_entry.function_id = func.function_id(+)
         AND grant_flag = 'Y'
         START WITH menu_entry.menu_id =      (
                             SELECT      menu_id
                             FROM      apps.fnd_menus_tl menu2
                             WHERE      menu2.menu_id = '*&menu_id'*)
         CONNECT BY menu_entry.menu_id = PRIOR menu_entry.sub_menu_id
    ORDER SIBLINGS BY menu_entry.entry_sequence;
    I would like to be able to run the above query, and subsequently spool to file, for all of the MENU_IDs returned as a result of the following sub-query (i.e., replace the &menu_id value with the menu_ids returned from the following query):
    SELECT      FM.MENU_ID
    FROM      apps.FND_MENUS FM,
         apps.fnd_user_resp_groups furg,
         apps.fnd_responsibility fr
    WHERE     fm.menu_id = fr.menu_id
         AND furg.responsibility_id = fr.responsibility_id;
    Any help would be appreciated!
    Thanks,

    Hi;
    Please see below threads which may helpful for your issue:
    Migrating menues from oracle 11i to R12
    How to use FNDLOAD for functions, menus and responsibilities
    Menu Deleted
    Also see:
    Menu Deleted
    Regard
    Helios

  • Newbie to Java who needs help..

    Hello all.
    I am having some troubles making a random walker/Drunkard. What I have to do is make it that the user inputs the starting X, Y coordinates and the amount of steps he has to walk. After that, it is post to print back the new coordinates he walked to and the distance of his new coordinates is to the starting one. I am new to java so I am confused.. This is what I have so far..
    import java.util.*;
    public class Drunkard {
        private int x;
        private int y;
        private int numSteps;
        private int Distance;
        private int moveDrunk;
        public Drunkard() {
            this.x = x;
            this.y = y;
            this.numSteps = 0;
        public int getX() {
            return x;
        public int getY() {
            return y;
         public int getSteps() {
            return this.numSteps;
        private void move(int numSteps);
        private void moveDrunk(){
        moveDrunk = (int) (Math.random() * 4);
        public int getmoveDrunk() {
            return moveDrunk;
    public boolean getDistance{
    (int)(Math.sqrt((getX()*getX()) + (getY()*getY())));{
    return Distance
    import java.util.Scanner;
    public class DrunkardSimulator
        public static void main (String[] args)
            Scanner scan = new Scanner(System.in);
            System.out.print ("Enter the number of steps: ");
            numSteps = scan.nextInt();
            System.out.print ("Enter the starting x coordinate: ");
            x = scan.nextInt();
            System.out.print ("Enter the starting y coordinate: ");
            y = scan.nextInt();
            Drunkard drunk = new Drunkard();
            System.out.println("The drunk moved to X" +drunk.getX() + ", y " + drunk.getY() && "a distance of " + drunk.getDistance());
    }Any help would be nice.
    Edited by: orlfman on Apr 9, 2008 5:26 PM

    Sorry. I should have stated what I need help with..
    I need help with making him move randomly when the user types in the x,y starting coords, and the amount of steps he has to walk from what the user inputs. I also need help printing out the new x,y coords he walked to randomly and the distance his new coords are from where he first started at (the coords the user the typed in.)
    I have two files:
    Drunkard.java
    import java.awt.*;
    import java.util.*;
    public class Drunkard {
        private int x;
        private int y;
        private int numSteps;
        private int Distance;
        private int moveDrunk;
        public Drunkard(int x, int y) {
            this.x = x;
            this.y = y;
            this.numSteps = 0;
        public int getX() {
            return x;
        public int getY() {
            return y;
         public int getSteps() {
            return this.numSteps;
        public void moveDrunk(int numSteps){
             for (int i=0;i<numSteps;i++) {
            if(rand.nextInt(2)==1) { x+=1; } else { y+=1; } }
        public int getDistance(){
    (int)(Math.sqrt((getX()*getX()) + (getY()*getY())));{
    return Distance
      }And DrunkardSimulator.java
    import java.util.Scanner;
    public class DrunkardSimulator
        public static void main (String[] args)
    int x;
    int y;
    int numSteps;
            Scanner scan = new Scanner(System.in);
            System.out.print ("Enter the number of steps: ");
            numSteps = scan.nextInt();
            System.out.print ("Enter the starting x coordinate: ");
            x = scan.nextInt();
            System.out.print ("Enter the starting y coordinate: ");
            y = scan.nextInt();
            Drunkard drunk = new Drunkard(x,y);
            drunk.moveDrunk(5); //5 steps
            System.out.println("The drunk moved to X,Y" + drunk.getX() + drunk.getY() + drunk.getDistance());
    }Edited by: orlfman on Apr 10, 2008 12:29 AM
    Edited by: orlfman on Apr 10, 2008 12:31 AM

  • Photo management, once and for all...help!

    This will be an eye-roller for some of you, but my thousands of photos have become a jungle and I don't understand how to manage them.
    -iPhoto
    -photo stream
    -camera uploads
    Where is "ground zero" for all of my photos - is there one? -  and how can I wrangle them all into one place for easy management? I delete a photo from one place, only to find it again in some other place (or two). 
    Also, if I delete photos from iPhoto on my MacBook Air (I'm out of disk space...again....), does it automatically delete them from iPhoto on my iMac too?
    I think I literally need someone to draw me a picture of how photo storage works on Mac products.
    Thank you.....
    C

    iPhoto is a database program that keeps everything in a database - by default the iPhoto library in your pictures folder on your hard drive
    Assuming you have a default managed library then it has no connection of any sort to anything outside of your Mac - not the cloud - not any other Mac - nothing
    Once photos are imported into the iphoto database (viewed in an event or in Photos view) nothing else affects them
    Nothing you do "automatically" deletes photos form iphoto events
    MyPhotoStream is not a place to store photos but a stream to move photos between devices - they can be automatically imported into iPhoto (see the iPhoto preferences ==> iCloud) to become part of your library - if they are not then they are transient and only available for 30 days max
    By default camera uploads go into the iphoto library that you upload them into
    If you have specific questions please post them
    LN

Maybe you are looking for

  • Adobe Edge installation problem

    I downloaded Adobe Edge Animation installer in my PC with Windows 7 and, three times I tried install it, without success. All time this message appears: "Founded following problem: fail error on installation of creative cloud desktop. (Error 1)" Some

  • New to Mac--how do I save filed to a CD

    On my PC, I'd insert a blank CD-RW disc, format it, and just leave it in my drive. Anytime I wanted to save a file, whether it was a Word document or a photo, I'd click Save As, and when it prompted me for where, I'd click the disc (Drive G), and pre

  • Problem with GL accounts

    Hi Gurus when i was editing and saving Parked Documen it was giving two errors, one is GL 300568 has been set as not relevent for tax for one documents and for another doucemtns account 6698597has been set as not relevent for tax any idea regards Sun

  • SharePoint Document Set Version Extension

    Before reading further, please note this is not a simple 'how do I enable versioning' and, as far as I can tell, nothing similar has been asked before... Instead I am looking for any solutions (3rd party or OOTB) or novel suggestions for an extension

  • Unicode and converter

    Hi there all, Im Chrno, and i have now a question... well exactly what im trying to do now, that's imposible to me lol... Hope you guys can help OKey so this the question... I want to convert a string like this (in Vietnamese) "tá lả" or something li