Need help in text field with 2D array

text field with 2D array
Hi
I need help to represent (i) in from field and (j) in to field
I and j are 2D an array indices.
This code are not complated
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
//declaring class
public class test3 extends Applet implements ActionListener
{ //declaring the TextField
private TextField fromField ,toField;
//declaring an array
int weight[][];
int m = 99; // m is infinity
int N; // Set of Nodes
int d; // distance
int i; // source Node
int j; // destition Node
//declaring values of text field
private int from = i; // start Node
private int to = j; // end node
public void init()
setBackground(Color.white);
setForeground(Color.red);
//giving labels
Label TITLE2,TITLE1;
TITLE1 = new Label("from:");
add(TITLE1);
fromField = new TextField(5);
add(fromField);
// register listener using void add actionListener
fromField.addActionListener(this);
TITLE2 = new Label("to");
add(TITLE2);
toField = new TextField(5);
add(toField);
// register listener using void add actionListener
toField.addActionListener(this);
// event handler methods
public void actionPerformed(ActionEvent event) {
//declaring textfield
from=Integer.parseInt(fromField.getText());
to=Integer.parseInt(toField.getText());
weight =new int[7][7];
weight[1][1] = 0; weight[2][1]= 2;
weight[1][2]= 2; weight[2][2]= 0;
weight[1][3]= 5; weight[2][3]= 3;
weight[1][4]= 1; weight[2][4]= 2;
weight[1][5]= 99; weight[2][5]= 99;
weight[1][6]= 99; weight[2][6]= 99;
weight[3][1]= 5;
weight[3][2]= 3;
weight[3][3]= 0;
weight[3][4]= 3;
weight[3][5]= 1;
weight[3][6]= 5;
for (int i=1; i<7; ++i) {
for (int j=1; j<7; ++j)

all your base are belong to us

Similar Messages

  • Need help formatting text field default value

    Hello,
    I've received a customer request to put default text into the Value section of a text field. They're requesting that the default text include line breaks, bullets, etc. I added a Text Field object and added the default text to the Object tab > Value tab Default field but can't figure out how to add line breaks, etc.
    Thanks in advance,
    Saskia

    Hi,
    this is possible but not doable with the UI of Designer.
    The workaround is as follows:
    1. Create a text, enter your default text with all the formattings you need (text color, bold text, line breaks etc.)
    2. Create a text field and enter any word as default value. Let's say "Default".
    3. Select the text and the switch to the XML Source view.
    There you will find all the formatted text between the <value> tags such as:
    <value>
         <exData contentType="text/html">
              <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p style="letter-spacing:0in">This is<span style="xfa-spacerun:yes"> </span></p><p style="color:#ff0000;letter-spacing:0in">default Text</p><p style="letter-spacing:0in"><span style="xfa-spacerun:yes"> </span>• with<span style="xfa-spacerun:yes"> </span><span style="font-weight:bold">RichText</span> formatting.</p></body>
         </exData>
    </value>
    4. Select the whole code between the <value> tags and copy it to the clipboard (ctrl + c).
    5. Go to the Design View, select the text field, go back to the XML Source view.
    6. There you'll also find the value <tags> and your default value you entered before.
    <value>
         <text>Default</text>
    </value>
    7. Select this code section and paste the value copied before to the clipboard by pressing ctrl + v.
    8. That's it. When you now go back to the Design View your text field shows a formatted RichText as defaul text.

  • Need help regarding text field

    Hi ,
    I have a text field in my form which will contains a numeric value.Based on this value i have to show those many text fields to enter the name.
    I have tried this code by keeping the texfield in a sub form and try to display subform  using instance manager .see the below script.
    Textfield.NewState.presence="visible";
    var oSubform = xfa.resolveNode("form1.Page1.Textfield");
    oSubform.instanceManager.setInstances(3);
    form1.Page1.Textfield.instanceManager.addInstance();
    but this code is not working.
    Please help me!!
    Thanks in advance
    bharathi.

    you can't use the instanceManager for a TextField.. your oSubform should represents a Subform not a TextField
    you can use instanceManager only for containers such as rows and subforms

  • Apex 4.02 BUG: text field with autocomplete. wrong help text

    Following the wizard for a text field with autocomplete you reach a screen where you can enter a LOV query. The text area for the query has the following help text
    Enter the query that will return the list of values. The query must select two columns in the following order, first a display value then a return value. For example:
    select ename, empno
    from emp
    When selecting two identical columns, be sure to use unique column aliases, for example:
    select ename d, ename r
    from emp
    However the query should return only 1 value.

    Thanks Rene, I have fixed that in 4.1.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to create Using Formatted Text Field with multiple Sliders?

    Hi i found the Java Sun tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html very useful, and it tells how to create one Formatted Text Field with a Slider - however i need to create Formatted Text Field for multiple Sliders in one GUI, how do i do this?
    my code now is as follows, and the way it is now is scroll first slider is okay but scrolling second slider also changes value of text field of first slider! homework due tomorrow, please kindly help!
    // constructor
    label1 = new JLabel( "Individuals" );
    scroller1 = new JSlider( SwingConstants.HORIZONTAL,     0, 100, 10 );
    scroller1.setMajorTickSpacing( 10 );
    scroller1.setMinorTickSpacing( 1 );
    scroller1.setPaintTicks( true );
    scroller1.setPaintLabels( true );
    scroller1.addChangeListener(this);
    java.text.NumberFormat numberFormat = java.text.NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(numberFormat);
            formatter.setMinimum(new Integer(0));
            formatter.setMaximum(new Integer(100));
    textField1 = new JFormattedTextField(formatter);
    textField1.setValue(new Integer(10)); //FPS_INIT
    textField1.setColumns(1); //get some space
    textField1.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField1.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField1.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField1.selectAll();
                    } else try {                    //The text is valid,
                        textField1.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    label2 = new JLabel( "Precision" );
    scroller2 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 8 );
    scroller2.setMajorTickSpacing( 10 );
    scroller2.setMinorTickSpacing( 1 );
    scroller2.setPaintTicks( true );
    scroller2.setPaintLabels( true );
    scroller2.addChangeListener(this);
    textField2 = new JFormattedTextField(formatter);
    textField2.setValue(new Integer(10)); //FPS_INIT
    textField2.setColumns(1); //get some space
    textField2.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField2.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField2.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField2.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField2.selectAll();
                    } else try {                    //The text is valid,
                        textField2.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    // State Changed
         public void stateChanged(ChangeEvent e) {
             JSlider source = (JSlider)e.getSource();
             int fps = (int)source.getValue();
             if (!source.getValueIsAdjusting()) { //done adjusting
                  if(source==scroller1)   {
                       System.out.println("source ==scoller1\n");
                       textField1.setValue(new Integer(fps)); //update ftf value
                  else if(source==scroller2)     {
                       System.out.println("source ==scoller2\n");
                       textField2.setValue(new Integer(fps)); //update ftf value
             } else { //value is adjusting; just set the text
                 if(source==scroller1)     textField1.setText(String.valueOf(fps));
                 else if(source==scroller2)     textField2.setText(String.valueOf(fps));
    // Property Change
        public void propertyChange(PropertyChangeEvent e) {
            if ("value".equals(e.getPropertyName())) {
                Number value = (Number)e.getNewValue();
                if (scroller1 != null && value != null) {
                    scroller1.setValue(value.intValue());
                 else if (scroller2 != null && value != null) {
                    scroller2.setValue(value.intValue());
        // ACTION PERFORMED
        public void actionPerformed(ActionEvent event) {
        if (!textField1.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField1.selectAll();
        } else try {                    //The text is valid,
            textField1.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
             if (!textField2.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField2.selectAll();
        } else try {                    //The text is valid,
            textField2.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
    ...

    if :p3_note_id is null
    then
    insert into notes (project_id, note, notes_month, notes_year) So, p3_note_id is NULL.
    Another option is that you have a trigger on table NOTES that generates a new note_id even for an update.

  • How do I add and remove text in a text field with a checkbox?

    How do I add and/or remove text in a text field with a checkbox?
    this is my script in the text box......
    event.value="Hello, this is my narrative. \r\n\nFamily: \r\n\n" + this get.Field("FirstName").value + " " + this.getField("LastName").value + was born on"=this.getField("DOB.value + "\r\n\n + this.getField("drpField").value + "\r\n\n" + this getField("Father").value
    The text box looks like this...
    Hello, this is my narrative.
    FAMILY:
    John Smith was born on 08/02/2000
    Boby Lou
    Jack Smith
    I need to add/or remove the father field (Jack Smith) & r/n/n with a check box.
    Does anyone know how to do this?

    There are multiple errors in your code...
    Use this code instead (adjust the name of the check-box):
    var msg = "Hello, this is my narrative. \r\n\nFamily: \r\n\n" + this get.Field("FirstName").value + " " + this.getField("LastName").value + was born on" + this.getField("DOB.value) + "\r\n\n" + this.getField("drpField").value;
    if (this.getField("FatherCheckBox").value!="Off")
         msg += "\r\n\n" + this getField("Father").value;
    event.value = msg;

  • Auto populate text fields with a trigger such as entering text into input fields in ADF

    Hello all,
    I am not able to auto populate text fields with a trigger such as entering text into input fields in ADF.
    I tried AdfFacesContext.getCurrentInstance().addPartialTarget(val); in the back end using setter method of input text field.
    its not working ..
    is there any way to achieve it
    Regards,
    Shakir

    Hi,
    Always mention your JDev version.
    The valueChangeListener would fire only when you set the autoSubmit property of the field to true. Can you elaborate your requirement? What do you mean by related data? Are you performing some sort of search?
    If you want to get the value you entered on the field, just set autoSubmit to true and get the new value from the valueChangeListener. If your requirement is something like as and when you type, do something, you need to check out this approach :https://blogs.oracle.com/groundside/entry/auto_reduce_search_sample
    -Arun

  • Text field with autocomplete is always NULL

    Greetings,
    I am new to Apex so I am sure I am missing something obvious. I am using Apex 4.0.1 What I have done is created a form on a table page and added a new text with autocomplete page item. This new text field does not correspond to a column in the table. What I am trying to do is allow the user to use the autocomplete item to make a selection. Then when the user submits the page, I want to use the substr function on the value in the autocomplete field and populate one of the table fields. I have tried using PL/SQL functions in validations and computations but I have found that the value of the autocomplete field is always NULL. I can access the other fields that are associated with a table column fine. It must be something simple. Thanks for your help.
    Page Items
    P2_F1  - text field with auto complete. Not associated with a table column
    P2_F2 – Text field. Is associate with a table column
    This is what I want to do:
    Entered this in a validation
    begin
    if :P2_F1 is not null then
       :P2_F2 := substr(:P2_F1,1,5);
    end if;
    end;Thanks again
    Edited by: LRM on Jan 22, 2011 5:25 PM

    hi,
    The PL/SQL function can also work when you choose Computation point: After submit.
    For reading You can refer APEX documentation
    Application Builder User's Guide: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/toc.htm
    To debug application:
    While you run your application in development environment, you can view debug option on footer .
    Click on it to on debug and again click to debug off.
    To view debug result click on View Debug option.
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

  • Need help in identifying fields of sd report creation

    Hi Experts,
    I need to create report in sd from manual report .The fileds in report are taken from Quickbooks.so inorder to create report in sap I need to identify fields  in sap first.we dont had functional guy so i need help in identifying fields in sap for below mentioned report.
    Report: invoice distribution report-service billing for all states.
    Fields:customer number,customer name,city state,SAP Document number,Invoice date,period(month,year)invoice number,invoice type,currency,invoice amount in usd.
    Please help me in suggesting tcodes or table names from where i can fetch these fields.
    Thanking you in advance.
    Regards,
    narasimha.

    Hi Experts,
    Finally with all above suggestions i have chosen tables vbrk(billing document header data),kna1(customer header),vbrp.
    1.I created view to find the output of report with conditions as follows:
    tables:vbrk,kna1,vbrp
    vbrk-vbeln(invoice number)
    vbrk-fkart(invoice type)
    vbrk-fkdat(invoice date)
    vbrk-waerk(currency)
    vbrk-netwr(netvalue)
    vbrk-kunag(customer number)
    kna1-name1(customer name)
    kna1-ort01(customer city)
    kna1-regio(customer state)
    join condition:
    kna1-mandt=vbrk-mandt
    kna1-kunnr=vbrk-kunag.
    when i execute the report i am getting same value for lot of times.
    i am confused how to include sales document number.I hope sales document number and invoice are different.
    2.i have also added vbrp-aubel and join condition as
    vbrk-mandt = vbrp-mandt
    vbrk-vbeln = vbrp-vbeln.
    but when i execute the report i am getting lot of duplicated with same value and unknown invoice numbers.
    please let me know where i went wrong.
    is  there any standard adhoc report so that i can manipulate it with above requirement.
    vf05n is somewhat useful .is it possible to add  customer details in this??
    Thanks&Regards,
    narasimha.

  • How to add an animation to a text field with two lines?

    I have a text field with two or more lines. Why isn't it possible now to apply a text animation?

    For certain tasks, Titler and its Presets can be very good, and can simplify things greatly.
    However, when one gets beyond the limitations of the Titler, I really like to create my Titles in Photoshop, and Import those as Still Images into my Project. I then use the power of Keyframing various Effects over time. This allows me much more control, BUT does require more hand-work. Still, that added control is too important to me, and I sort of like doing the handwork.
    For the "alignment" of multiple Titles, to get multiple lines of Text, you can create the first Title, and then chose Duplicate Title. Initially, that will be identical, but you just change it, as is necessary. After you have changed that "second line of Text," place that Duplicate on the next Video Track, above the first Title, and use the Fixed Effect>Motion>Position, to move it down, to where it would be (by the height of the font, plus any desired Leading), if one had created a second line of Text on one Title.
    I also like to use Alignment Grids, when things get critical, and create those in Photoshop, with a trasparent background, and just place them, on say Video Track 2, with all of my Titles above that. Just do not forget to remove any Alignment Grids, before you Export/Share the Timeline, or they will be part of the output video.
    For more background on Keyframing (so very useful with more than just Titles), Steve Grisetti has done a multi-part tutorial, available as Basic Keyframing on Muvipix.com. I highly recommend it. Keyframing is simple to do, but can be a bit of a tough concept to grasp initially, and it's a subject that is tough to write about - takes longer to type instructions, than to do the work.
    Good luck,
    Hunt
    PS - Do not know if you saw them, but Titler has two Alignment Tools - Align Horizontally, and Align Vertically, that can be helpful to center Text.

  • Help changing text fields background

    Hello, I need help changing the field text background color. In some forms I use read only field texts, and I would like those ones to have a different color (like gray) so it is easy to see they are read only..
    How can I do that??
    Thanks for your help!!

    Nobody knows how to do it?

  • Auto populate blank text fields with n.a from a button or on print out.

    This seems straight forward but I cannot find an existing questions on this topic.
    I would like to add a form function that will fill any blank text fields with n.a. I do not want to use the default field value as I think it will cause confusion and cannot be applied for text fields formatted for dates. Is it possible to run a script that can do this? It would be OK if the action was triggered from a button or print activity after the rest of the form has been completed.
    Any thoughts would be appreciated.
    Thanks

    The question is whether your form is used only for filling out on screen (and not as a level 0 form, being printed out and filled out manually).
    If so, why not make the default value of the concerned fields to be "n/a" (or whatever you want to name them). That would relieve you from any validating before printing.
    Otherwise, you could maintain a list of field names which should get the n/a value if empty. This list would be an array.
    Your code in the willPrint event (if you want to have it reliably) would then look like this:
    for (var i = 0 ; i < nafieldarray.length ; i++) {
    if (this.getField(nafieldarray[i]).value == this.getField(nafieldarray[i]).defaultValue) {
    this.getField(nafieldarray[i].value = "n/a") ;
    HTH.
    Max Wyss.

  • Having issues with populating a Text Field with data from 2 other fields

    I have 3 fields Tools_1a_pri, Tools_1a_pri_other, Tools_1a_pri_txt.
    Tools_1a_pri is a drop down combo with a predefined list. One of the options is "Other".  When "Other" is selected, the text field Tools_1a_pri_other becomes visible for users to enter the name of the other tool.
    The Tools_1a_pri_txt is a text field with a calculation that shows either text stating that no tool has been selected or the Tools_1a_pri & or Tools_1a_pri_other.
    When I select one of the predefined tools, everything works.  When I select other, it appears that nothing has changed.  It requires that I click on another field before it populates.  This is confusing to the user.
    Tools_1a_pri   Validate code
    this.getField("Tools_1a_pri_Other").display = event.value=="Other" ? display.visible : display.hidden;
    Tools_1a_pri_txt  Calculation code
    //if nothing is selected, do the following
    if (getField("Tools_1a_pri").value.length < 2) {
    event.target.textColor = color.red
    event.value = "No primary tool identified";
    }else if (getField("Tools_1a_pri").value != "Other") {
    //otherwise do this if other is selected
    event.target.textColor = color.black
    event.value = getField("Tools_1a_pri").value;
    }else if (getField("Tools_1a_pri").value = "Other") {
    //otherwise do this if other is not selected
    event.target.textColor = color.black
    event.value = getField("Tools_1a_pri").value + " - " + getField("Tools_1a_pri_Other").value;

    You made the classic mistake of using the assignment operator in an if-statement instead of the comparison operator. Change this line:
    } else if (getField("Tools_1a_pri").value = "Other") {
    To this:
    } else if (getField("Tools_1a_pri").value == "Other") {

  • I have misplaced my iPod Touch 4th Generation. According to Find my iPhone, it should show up in offline mode. I need help on locating it with a software or some other way. Help?

    I have misplaced my iPod Touch 4th Generation. According to Find my iPhone, it should show up in offline mode. I need help on locating it with a software or some other way. Help?

    There is no other way.
    Sorry

  • Need help on struts configuration with ColdFusion 10 using IIS

    We need help on struts configuration with ColdFusion 10 using IIS.
    Earlier we were using ColdFusion 8 with IIS 6 for one of our application.  This application internally calls struts. After upgrading to ColdFusion 10 struts calls are not loading. We get 404 error.
    In ColdFusion 8 struts were configured using  actions extension .do in IIS from this file-
    C:\ColdFusion8\runtime\lib\wsconfig\jrun_iis6.dll.
    But in ColdFusion 10 this file is not present as ColdFusion 10 uses Tomcat in place of Jrun.
    Also there is no information in ColdFusion log file.

    Duane wrote:
    doctormirabilis, Welcome to the discussion area!
    1) how can i configure the time capsule in order to operate as a remote base station synchronizing with the relay using the ethernet port?
    Configure the Time Capsule to act as a bridge (not distributing IP addresses). Also configure the Time Capsule to create an 802.11n wireless network with a unique network name (SSID). That's it.
    2) how can i avoid that my powerbook while accessing my wireless network does connect through the relay station instead of using the time capsule?
    Configure the Time Capsule to use a different network name than the WDS link between the 2 AirPort Express (AX). Configure the PowerBook to use the Time Capsule network.
    There are 2 pieces of information that you should be aware of...
    (1) None of the PowerBooks are capable of 802.11n.
    (2) The WDS link cuts your available bandwidth in half. So the wireless link to your neighbor's has a maximum potential of 27 Mbps.
    Let's for a minute assume that you have a Mac compatible with 802.11n. In your configuration the time you could take advantage of the 802.11n speed is when the Mac is sending/recieving data directly from/to the Time Capsule.
    There would be NO speed increase in Internet access. The speed of Internet access is going to be controlled by the slowest link in the path to the Internet. That is probably the connection to the ISP. The next slowest path is the WDS link to your neighbor's.
    Duane,
    I am in a similar situation, sharing internet with my neighbor. Do you think it would be plausible to hook up a vonage phone adapter to time capsule's ethernet port if time capsule is bridging from my neighbor's router in the configuration you have described? A check of my upload speed shows 1.67Mbps (powerbookG4 w/ airport extreme). Vonage reccommends 90kbps minimum upload speed. Am I going to lose some speed putting the Vonag adapter behind time capsule?
    Thank you

Maybe you are looking for