I can't populate a TableView. NullPointerException in TableView

Hi all.
I'm having a lot of problems to populate a table with data.
The following is my code:
public class Panel_MarcadoresController implements Initializable {
    @FXML static Tab lineas;
    @FXML TabPane marcadores;
    @FXML Button finalizarPolilinea;
    @FXML ComboBox comboGrosorLinea;
    @FXML TableView<CoordenadasLinea> tablaCoordenadasDeLinea;
    @FXML TableColumn itemCol;
    @FXML TableColumn latitudCol;
    @FXML TableColumn longitudCol;
   @Override
    public void initialize(URL url, ResourceBundle rb)
    public void leerCoordenadasLineaDesdeMapa(String datos)
        Pattern p = Pattern.compile("[,]+");
        String[] result = p.split(datos);
        ObservableList<CoordenadasLinea> dataCoordLinea = FXCollections.observableArrayList();
        int item = 0;
        String latitud = "";
        String longitud  = "";
        for (int i = 0; i < result.length; i++)
            item =  i;
            latitud = result;
longitud = result [i];
CoordenadasLinea coordenadasLinea = new CoordenadasLinea(latitud,longitud);
dataCoordLinea.add(coordenadasLinea);
tablaCoordenadasDeLinea.setItems(dataCoordLinea);
///// The following is a inner class
public class CoordenadasLinea
//private final SimpleIntegerProperty item = new SimpleIntegerProperty();
private final SimpleStringProperty latitud = new SimpleStringProperty("");
private final SimpleStringProperty longitud = new SimpleStringProperty("");
public CoordenadasLinea()
this("","");
public CoordenadasLinea(String lat, String Long)
setLatitud(lat);
setLongitud(Long);
// public void setItem(int it)
// item.set(it);
public void setLatitud(String lat)
latitud.set(lat);
public void setLongitud(String lon)
longitud.set(lon);
// public int getItem()
// return item.get();
public String getLatitud()
return latitud.get();
public String getlongitud()
return longitud.get();
My FXML file:<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.collections.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.collections.*?>
<?import javafx.geometry.Insets?>
<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.control.cell.*?>
<?import javafx.scene.layout.*?>
<?import fxmltableview.*?>
<AnchorPane id="AnchorPane" prefHeight="798.0" prefWidth="426.0" styleClass="mainFxmlClass, frame" xmlns:fx="http://javafx.com/fxml" fx:controller="signa.Panel_MarcadoresController">
<children>
<TableView fx:id="coordenadasDeLinea" layoutX="47.0" layoutY="436.0" prefHeight="138.0" prefWidth="317.0">
<columns>
<TableColumn prefWidth="75.0" text="Item" fx:id="itemCol"/>
<TableColumn prefWidth="120.0" text="Latitud" fx:id="latitudCol" >
<cellValueFactory>
<PropertyValueFactory property="latitud" />
</cellValueFactory>
</TableColumn>
<TableColumn prefWidth="120.0" text="Longitud" fx:id="longitudCol" >
<cellValueFactory>
<PropertyValueFactory property="longitud" />
</cellValueFactory>
</TableColumn>
</columns>
</TableView>
</children>
<layoutY>
<Long fx:value="0" />
</layoutY>
<stylesheets>
<URL value="@SIGNA.css" />
</stylesheets>
</AnchorPane>
The idea is that the table is filled with the data that is passed as a parameter to the method.
I've tried everything and I can't ... with this last code I present here, I get this exception: 
Exception in thread "Thread-5" java.lang.NullPointerException
at signa.Panel_MarcadoresController.leerCoordenadasLineaDesdeMapa(Panel_MarcadoresController.java:122)   this points here: tablaCoordenadasDeLinea.setItems(dataCoordLinea); I think I'm making a basic error but I'm locked ... help                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Here I am calling the changeMap
public class ClientExecution implements Runnable
    private Socket socket;
    //private Panel_MarcadoresController controladorDePanel;
    //Given what you said, I tried to do this
    public ClientExecution( Socket socket, Panel_MarcadoresController contPanel)
           this.socket = socket;
        this.controladorDePanel = contPanel;
    public void run ()
        try
             String instruccion ="";
             String datos="";
             EvaluateInput evaluateInput = new EvaluateInput(controladorDePanel);
             evaluateInput.changeMap(instruccion, datos);     
        catch (IOException e)
         {             e.printStackTrace();          }
}I made this change in EvaluateInput:
public  class EvaluateInput extends Evaluate
    private String datos;
    private Panel_MarcadoresController controladorMarcadores;
    public EvaluateInput (Panel_MarcadoresController contMarcadores)
        this.controladorMarcadores = contMarcadores;
    public EvaluateInput()
    public void changeMap(String instruccion, String datos)
        Pattern p = Pattern.compile("[,]+");
        String[] result = p.split(datos);
        switch(instruccion)
            case "@SELECT_OPEATIONAL_ AREA#" :
                CODE...
            break;
            case "@CLOSE_POLYLINE_VALUES#" :
                   controladorMarcadores.leerCoordenadasLineaDesdeMapa(datos);
            break;
}Here I invoke the class ClientExecution
public class SocketCatcherClients implements Runnable  
     Panel_MarcadoresController controladorMarcadores;
     public SocketCatcherClients(Panel_MarcadoresController contMarcadores)
        this.controladorMarcadores = contMarcadores;
   public void run()
       try
          Runnable nuevoCliente = new ClientExecution(cliente, controladorMarcadores); //Here I tried to pass the object
          Thread hilo = new Thread(nuevoCliente);
          hilo.start();
        }catch (Exception e)
             e.printStackTrace();
}Finally, I made this change in Main class...
public class Main extends Application {
     public static void main(String[] args) {
        Application.launch(Main.class, (java.lang.String[])null);
public void start(Stage primaryStage) {
        try {
                 CODE...
                 FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Panel_Marcadores.fxml"));
                 Panel_MarcadoresController controller = (Panel_MarcadoresController) fxmlLoader.getController();   //This object appears NULL
                (new Thread(new SocketCatcherClients(controller))).start();
         catch (Exception ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}Debugging I found that the controller (Panel_MarcadoresController ) object is null

Similar Messages

  • How can I populate a pdf with database data?

    How can I populate a pdf that we have on our server with database data on our server?

    Actually, if you export it in the right format then you won't need a script
    at all.
    You can import data directly into fields from a plain-text file via Tools -
    Forms - More Form Options - Import Data...
    I believe the format is tab-delimited with the field names in the first row
    and their values in the second.

  • I have a new windows 7 computer and I have downloaded the latest version of itunes. How can I populate my itunes music library from my ipod?

    I have installed a new windows 7 computer (Dell) and downloaded the latest version of ITunes. How can I populate my music into ITunes from my I-pod classic?

    Hey AppleMacParker,
    Thanks for the question. The following article may assist you in setting up syncing with your iPod:
    iTunes 11 for Windows: Set up syncing for iPod, iPhone, or iPad
    http://support.apple.com/kb/PH12313
    Select items to sync automatically
    1. Connect your iPod, iPhone, or iPad to your computer and select your device.
    2. Select the type of media you want to sync.
    The types of media you can sync depends on your device. For more information, see Sync and organize iOS apps and Add photos to iPod, iPhone, or iPad.
    3. Select the Sync checkbox, and select the items you want to sync automatically each time you connect your device.
    Click a button to select the kind of content you want to sync, then select the sync checkbox and select the items you want to sync automatically
    The bar at the bottom of the window shows how much space will remain on your device after you sync.
    Thanks,
    Matt M.

  • How can i populate records using LOV value in form 6i

    Create a form based on the following output use EMP Table
    Create a non Database Block i.e Control Block----> Dept No
    Create a Database Block -EMP
    Create an LOV for the Dept no from dept table.
    For the Current Dept No . Populate the Employee Records
    How can i populate records using LOV value????
    thanks

    How can i populate records using LOV value in form 6i Start by posting in the correct forum: {forum:id=82}
    (Seriously: after making all your previous posts in the Forms forum, how do you end up posting in this one? Is it because the Forms forum has changed category?)

  • How can i populate records using LOV value

    Create a form based on the following output use EMP Table
    Create a non Database Block i.e Control Block----> Dept No
    Create a Database Block -EMP
    Create an LOV for the Dept no from dept table.
    For the Current Dept No . Populate the Employee Records
    How can i populate records using LOV value????
    thanks

    Hi maddyd2k
    How can i populate records using LOV valueIt's not clear what u r trying to do create, create then want to...
    1.Pls Create a non-db item db set to > no named DEPT_NAME
    2. when creating the LOV assign the DEPT_NAME FROM DEPT table to that displayed item and u have also to assign the Dept No selected to the Dept No in the emp block
    To populate or display DEPT_NAME after Query - the If i got ur problem then - u need to cretae a Post-Query Trigger then use the following...
    BEGIN
    SELECT DEPT_NAME
    INTO :CONTROL_BLOCK.DEPT_NAME
    FROM DEPT
    WHERE Dept No = :Dept No;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    WHEN OTHERS THEN (ERRTXT);
    END;Hope this helps...
    Regards,
    Abdetu...

  • I have a students excel package intalled on my Mac Book - can I also install this software on my new mac mini - do I need another license or can I populate two machines?

    I have a students excel package intalled on my Mac Book - can I also install this software on my new mac mini - do I need another license or can I populate two machines?

    Normally Microsft allows the installation of their programs, except Operating Systems, to be installed on a desktop and notebook at the same time as long as both system are used exclusively by the same person and Not at the same time.
    So this should also be true for MS Office for Mac. The only way to tell is to install it on the Mini and then use the same key to activate it. If the activation goes through you are fine. But if you run both system at the same time do not open any of the Office programs on both system at the same time. That may trigger MS to disallow one of the activations.
    MS Office for both Mac and Windows checks the local network and logs into the MS activation site everytime one of the apps is started to check current activation and to check if you have it running on more then one computer on your local network using the same key.

  • Frm - 41337 - can not populate the list from record group

    Hi
    I have created a form with 4 combo boxes. And i am trying to populate the 4 combo boxes dynamically.
    Here is my table structure.
    BUS_FUNCTION VARCHAR2(500),
    SEQ NUMBER,
    STEP1 VARCHAR2(500),
    STEP2 VARCHAR2(500),
    STEP3 VARCHAR2(500),
    STEP4 VARCHAR2(500),
    KEYSTEP VARCHAR2(4000),
    OBJ_NAME VARCHAR2(500),
    SME VARCHAR2(50)
    In the fist combo box i am retriving bus_function and second seq and third step1.
    i wrote a trigger when_new_form_instance and i am calling a procedure from the trigger.
    here is my procedure code.
    PROCEDURE fp_get_list IS
    l_sql_text VARCHAR2(2000);
    BEGIN
    l_sql_text := 'SELECT bus_function,bus_function FROM TABS_BUS_FUNC';
    lp_populate_list('BUSFUNC.list22','rgcat2',l_sql_text);
    l_sql_text := 'SELECT TO_CHAR(SEQ),TO_CHAR(SEQ) FROM TABS_BUS_FUNC';
    lp_populate_list('BUSFUNC.BUS_FUNC','rgcat',l_sql_text);
    l_sql_text := 'SELECT step1,step1 FROM TABS_BUS_FUNC';
    lp_populate_list('BUSFUNC.list20','rgcat1',l_sql_text);
    END;
    Now the problem is i can able to get the values fro the first two colums. but the third column values are not populating.
    i am getting an error frm - 41337 - can not populate the list from record group.
    PLease help me in this.
    Thanks in advance,
    Raju

    I got answer
    i write a code in when-new-form-instance
    declare
    v_rg_id RECORDGROUP;
    v_return number;
    v_query varchar2(2000);
    outcome number ;
    begin
    v_rg_id := CREATE_GROUP_FROM_QUERY('RG_LIST','select Dname,To_char(Deptno) deptno from dept');
    v_return := POPULATE_GROUP(v_rg_id);
    POPULATE_LIST('emp.deptno', 'RG_LIST');
    end;
    but remember property of list item must be mapping of others value null and initial value null
    if ur problem not solve then tel me email, i ll send u fmb file

  • Can we populate UI Element Dropdownbykey at run time

    Hi All,
    Can we populate UI Element dropdownbykey at run time, I am able to populate R/3 data in inputfield type UI element, but how to populate it in dropdownbykey UI element, is it possible??
    Thanks in advance

    Hi Amit,
    Yes we can populate dropdownbykey UI element at run time using data from the R/3. For doing this, try to understand the below given code:
    empCode - Which you bind to the DropDownByKey.
    IContextElement contextElement = wdContext.currentContextElement();
    IWDNodeInfo nodeInfo = wdContext.getNodeInfo();
    IWDAttributeInfo dateAttributeInfo = nodeInfo.getAttribute(contextElement.empCode);
    IModifiableSimpleValueSet dropValueSet = dateAttributeInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
    String empCodeTxt=null;
    //Gives the Size of the List, which is coming from Model
    int nodeLength = wdContext.node<BAPIList>().size();
    for (int i = 0; i < nodeLength; i++) {
    // Gives the Value, which you want to show in Drop Down List Box..
    empCodeTxt=String.valueOf(((IPrivate<viewname>.I<BAPIList>Element)(wdContext.node<BAPIList>().getElementAt(i))).get<Parameter>());
    dropValueSet.put(empCodeTxt, empCodeTxt);
    This piece of code has been taken from the following thread:
    https://forums.sdn.sap.com/thread.jspa?threadID=215743&tstart=0
    Bye
    Ankur

  • How can I populate the users in the Directory Server?

    Hi all,
    I'm a new of Sun ONE Directory Server 5.2, I've just install a copy of it on Win2000 server and I have a small question to ask.
    How can I populate the users (This user can be use to login in to Sun ONE install messenger) in the Directory Server using the Directory server's admin console?
    Thanks in advance,
    Tuan Anh,

    Thanks Ramnath,
    I've read your suggest, but actually, I really wanted to know how to populate user and password. I've read some thing below in Sun ONE Directory 5.2 Getting Started Guide.pdf
    � o=userRoot
    During installation, a user database is created by default. The default name of
    the user database is o=userRoot. You can choose to populate this database at
    installation, or to populate it later.
    But I don�t know the related document, I have create successful user and pass by using admin console. But can not user this user to login in to Instant messenger.
    I'm looking forward to receive your help
    Tuan Anh

  • Can I populate a text field in one PDF with the modification date of a different file ?

    Rather convoluted problem here but I'm trying to place a text field on a PDF document that serves as the main menu page for a library of interlinked PDF documents
    The complete library contains over 7,000 files and additions are added and documents changed almost daily.
    We currently use batch files to open the main menu from it's shortcut and this runs a check on a sync log file (.txt) to ascertain when the last time the user synchronised with the server to get the latest copy of the files.
    Between a certain time range they are told how long it has been since they sync'ed and are offered the option to sync before opening, after a prescribed timeframe they cannot enter without synchronising. We use Allways Sync to conduct the file synchronisation with our mother files on our server.
    What I'd like to do is take advantage of Allways Syncs automatic synchronisation options to synchronise on log on and at prescribed idle periods there after.
    This works fine but I'd like the text field on the main menu PDF to say when the last synchronisation took place - easy if the main menu is the last file modified .. just use info.modDate.
    However, the main menu is rarely modified therefore I wish to import the text to populate the text field from a different file.. either by interrogating the other files modifictaion data (though I doubt Acrobat can do this) or by simply importing some text stored in another file (a .txt file?) which has previously been created by batch file commands.
    Any assistance would be greatly appreciated.
    Regards,
    Nifty Styles
    (Norfolk, England)
    P.S.  I'm using Acrobat 8.3.1. Professional on Windows XP (SP3).

    Thank you for all your help above.
    Just to confirm your advice, am I right with the following conclusions? :
    1. The script (function) to fill the text field with the modification date of a different PDF file needs to be stored in a folder level .js file.
    2. The document containing the text field needs to call the .js function either within the document script or within the custom script property of the text field itself.
    Further to that can you just advise on the syntax for accessing the modification date of the other document.
    Do I need to assign a variable to the address of the file to be used, and then use this variable in the text form filling script (as below) or can I use a direct file reference at the .modDate command.
    var LastSync = "C:\sync\bin\lastsync.pdf";
    var strMsg = util.printd("h:MM tt",LastSync.modDate) + " on ";
    strMsg += util.printd("dddd, d mmmm, yyyy",LastSync.modDate);
    this.getField("LastSyncDate").value = strMsg;
    If the syntax is totally different to the above I would be very grateful for some guidance in the right direction.
    I much appreciate your time to help me ... I'm almost there.
    Kind Regards,
    Nifty

  • Can't figure out where NullPointerException is coming from

    I will attach the code I have below. It is almost entirely done but i am getting a NullPointerException that is driving me nuts, and I can't figure out were it is coming from.
    Help is greatly appreciated.
    First code:
    import java.util.Scanner;
    import java.io.*;
    import java.util.Random;
    import java.util.Collection;
    public class DistributionPlagiarist
         public static void main(String[] args) throws IOException
              Scanner keyboard = new Scanner(System.in);
              int keyLength=0, phraseLength=0, numberOfPhrases=0;
              String inputFileName="", keepReadingFromFile="", theFile="";
              FrequencyLibrary text = new DenseFrequencyLibrary();
              if(args.length != 4)
                   System.out.println("The command line arguments you entered do not match what is needed.  Please try again.");
                   System.exit(0);
              for(int count=0; count<args.length; count++)
                   keyLength = Integer.parseInt(args[0]);
                   phraseLength = Integer.parseInt(args[1]);
                   numberOfPhrases = Integer.parseInt(args[2]);
                   inputFileName = args[3];
              if(keyLength < 0)
                   while(keyLength < 0)
                        System.out.print("The length of the key (" + keyLength + ")" + " you entered is less than zero.\nPlease enter another key length: ");
                        keyLength = keyboard.nextInt();
                        System.out.println();
              if(phraseLength < 0)
                   while(phraseLength < 0)
                        System.out.print("The desired length of the phrase (" + phraseLength + ")" + " you entered is less than zero.\nPlease enter another phrase length: ");
                        keyLength = keyboard.nextInt();
                        System.out.println();
              if(numberOfPhrases <= 0)
                   while(numberOfPhrases <= 0)
                        System.out.print("The desired number of phrases (" + keyLength + ")" + " you entered is not applicable.\nPlease choose another number: ");
                        keyLength = keyboard.nextInt();
                        System.out.println();
              File file=new File(inputFileName);
              boolean exists = file.exists();
              if (exists == false)
                   while(exists == false)
                        System.out.println("The file you are searching for does not exist.  Please place it in this programs directory.");
                        System.out.print("Please re-enter the file name: ");
                        inputFileName = keyboard.nextLine();
                        file=new File(inputFileName);
                        exists = file.exists();
              int count=keyLength, start=0, stop=0;
              FileReader freader = new FileReader(inputFileName);
              BufferedReader inputFile = new BufferedReader(freader);
              while(keepReadingFromFile != null)
                   keepReadingFromFile = inputFile.readLine();
                   if(keepReadingFromFile == null)
                        break;
                   else
                        theFile = theFile + keepReadingFromFile;
              while(count < theFile.length())
                   String name = theFile.substring(start, keyLength+stop);
                   char singleCharacter = theFile.charAt(count);
                   text.add(name, singleCharacter);
                   start++;
                   stop++;
                   count++;
              int countNumberOfPhrases=0;
              while(numberOfPhrases > 0)
                   countNumberOfPhrases++;
                   String phrase = randomphrase(text, phraseLength, keyLength);
                   System.out.println("Phrase " + countNumberOfPhrases + ":\n" + phrase);
                   numberOfPhrases--;
         private static String randomphrase(FrequencyLibrary textLibrary, int phraseLengthToMake, int startLength)
              String startString="";
              char characterToAdd=' ';
              startLength++;
              Random generator = new Random();
              int sizeOfLibrary=textLibrary.size()/2, randomInt = generator.nextInt(sizeOfLibrary+1), value=0;
              Collection<String> stringNames = textLibrary.makeStringCollection();
              for(String stringFromCollection : stringNames)
                   if(randomInt == value)
                        startString = stringFromCollection;
                   value++;
              String thePhrase = new String(startString);
              System.out.println("INITIAL START:" + startString + "TTTT");
              int substringStart=1;
              while(startLength < phraseLengthToMake)
                   characterToAdd = textLibrary.randomUniformChoose(startString);
                   thePhrase = thePhrase + characterToAdd;
                   System.out.println("CHARACTER:" + characterToAdd + "TTTT");
                   System.out.println("PHRASE:" + thePhrase + "TTTT");
                   startString = thePhrase.substring(substringStart, thePhrase.length());
                   boolean answer = textLibrary.contains(startString);
                   System.out.println(answer);
                   System.out.println("NEW STRING:" + startString + "TTTT");
                   startLength++;
                   substringStart++;
              return thePhrase;
    }Second code:
    import java.util.Collection;
    import java.util.HashMap;
    public class DenseFrequencyLibrary implements FrequencyLibrary
         private HashMap<String, MultiSetOfChar> bookTitleAndCharacterAndIntegerHashMap = new HashMap<String, MultiSetOfChar>();
         private MultiSetOfChar keyAndValuePairs = new DenseMultiSetOfChar();
          * Creates a new DenseFrequencyLibrary with all the essential things clear;
         DenseFrequencyLibrary()
              bookTitleAndCharacterAndIntegerHashMap.clear();
          * Input the value from the creation of the DensneMultiSetOfChar into a HashMap.  If the key
          * already exists then the value associated with it is updated by one.
          * @param character a char to be used in forming the HashMap
          * @return characterMap
         private HashMap<String, MultiSetOfChar> inputIntoMap(String name, char character)
              if(!bookTitleAndCharacterAndIntegerHashMap.containsKey(name))
                   keyAndValuePairs = new DenseMultiSetOfChar(character);
              else
                   keyAndValuePairs.add(character);
              this.bookTitleAndCharacterAndIntegerHashMap.put(name, keyAndValuePairs); //input character and value
              return bookTitleAndCharacterAndIntegerHashMap; //return the new HashMap
          * Returns the number of books in the library.
          * @return |b|, ie the number of books in b
        public int size()
             int numberOfBooks=bookTitleAndCharacterAndIntegerHashMap.size();
             return numberOfBooks;
         * Searches the library for an occurrence of a given book
         * @param target the name of a book to be searched for in the library
         * @return true if and only if the argument is already a book title in the library.
        public boolean contains(String target)
             boolean bookIsInLibrary=false;
             if(bookTitleAndCharacterAndIntegerHashMap.containsKey(target))
                  bookIsInLibrary = true;
             return bookIsInLibrary;
         * Returns the MultiSetOfChar that represents the occurrences of the individual characters
         * in the text of the book indicated by the argument.
         * @param target
         * @return MultiSetOfChar
        public MultiSetOfChar getFrequencies(String target)
             MultiSetOfChar frequencyMultiSetOfChar = bookTitleAndCharacterAndIntegerHashMap.get(target);
             return frequencyMultiSetOfChar;
         * Modifies the character occurrences associated with name to include one more occurrence of element.
         * @param name string of the name of the book
         * @param element character to add to the specified book
        public void add(String name, char element)
             bookTitleAndCharacterAndIntegerHashMap = inputIntoMap(name, element);
         * Modifies the character occurrences associated with name to include one less occurrence of element.
         * @param name string of the name of the book
         * @param element character to be removed from the specified book
         * @return true if and only if the book is modified.
        public boolean remove(String name, char element)
             boolean characterWasRemovedFromBook=false;
             //if the target character is in the map then remove it
              if(bookTitleAndCharacterAndIntegerHashMap.containsKey(name))
                   MultiSetOfChar keyAndValuePairs = bookTitleAndCharacterAndIntegerHashMap.get(name);
                   keyAndValuePairs.remove(element);
                   characterWasRemovedFromBook = true; //set answer to true because the HashMap was changed
              else //target does not exist in the HashMap
                   characterWasRemovedFromBook = false; //set answer to false because the HashMap was not changed
             return characterWasRemovedFromBook;
         * Returns a random character, chosen from the same distribution as the characters appear in the book.
         * For example, if 5% of the characters in "Alice in Wonderland" are an 'A', then this method should
         * return an 'A' about 5% of the time.
         * @param name string of the name of the book to search through and remove a character
         * @return true if and only if the argument is already a book title in the library.
         public char randomUniformChoose(String name)
            MultiSetOfChar keyAndValuePairs = bookTitleAndCharacterAndIntegerHashMap.get(name);
            char randomCharacter = keyAndValuePairs.randomUniformChoose();
              return randomCharacter; //return the random character pulled out
         public Collection<String> makeStringCollection()
              Collection<String> stringCollection = bookTitleAndCharacterAndIntegerHashMap.keySet();
              return stringCollection;
    }Third code:
    import java.util.HashMap;
    import java.util.Set;
    import java.util.Collection;
    import java.util.Random;
    * DenseMultiSetOfChar implements MultiSetOfChar.
    * @mathmodel b is a finite multiset
    * @mathdef
    *  |b| is the cardinality of b
    *  ||c,b|| is the number of occurrences of element c in b
    * @author Kyle Hiltner
    public class DenseMultiSetOfChar implements MultiSetOfChar
         private char characterInput=' ';
         private HashMap<Character, Integer> characterMap = new HashMap<Character, Integer>();
          * Create a new DenseMultiSetOfChar with zero argument
         DenseMultiSetOfChar()
              characterMap.clear(); //clear static HashMap
          * Create a new DenseMultiSetOfChar with the passed in value.
          * @param newChar character input to be added to the HashMap
         DenseMultiSetOfChar(char newChar)
              this.characterInput = newChar; //set characterInput to the value passed in
              characterMap = inputIntoMap(this.characterInput); //call private procedure to add characterInput to HashMap
          * Input the value from the creation of the DensneMultiSetOfChar into a HashMap.  If the key
          * already exists then the value associated with it is updated by one.
          * @param character a char to be used in forming the HashMap
          * @return characterMap
         private HashMap<Character, Integer> inputIntoMap(char character)
              //if the character is not in the HashMap then add it with the starting value of 1
              if(!characterMap.containsKey(character))
                   characterMap.put(character, 1); //input character and value
              else //character does exist
                   int value = characterMap.get(character); //get the value for the specified key
                   value++; //increase the value so as to show that another character was added
                   characterMap.put(character, value); //place the character and new value in the HashMap
              return characterMap; //return the new HashMap
          * Returns the number of elements in this multiset (ie its cardinality).
          * Note that since multisets can include duplicates, the cardinality may be
          * larger than the number of distinct elements. Also, the total number of
          * items in the multiset is bounded above by Integer.MAX_VALUE.
          * @return |b|, ie the cardinality of b
         public int getCardinality()
              int totalElementsInMap=0;
              Collection<Integer> integerCollection = characterMap.values(); //create a collection for easy iteration
              //iterate through each value in the HashMap and compute the total number of elements in the HashMap
              for(Integer valueFromCollection : integerCollection)
                   totalElementsInMap = totalElementsInMap + valueFromCollection; //compute new value of total values
              return totalElementsInMap; //return the final total value
          * Returns the number of occurrences of a given element in the multiset. A
          * simple identity relating getElementCount and getCardinality is that the
          * sum of getElementCount for each char is equal to the cardinality of the
          * set.
          * @param target
          *            char to be counted in the multiset
          * @return ||target,b||, ie the number of occurrences of target in b
         public int getElementCount(char target)
              int numberOfGivenCharacters=0; //set initial value
              //if the HashMap contains the target character then numberOfGivenCharacters is set to the value
              if(characterMap.containsKey(target))
                   numberOfGivenCharacters = characterMap.get(target); //set numberOfGivenCharacters to the value assigned to the target character
              return numberOfGivenCharacters; //return the value for the target character
          * Returns a set such that every element in the multiset is in the set (but
          * no duplicates). The cardinality of the returned set must be less than or
          * equal to |b|. The cardinality of the two are equal if and only if b
          * contains no duplicate elements.
          * @return a set of Character, s, such that: <br />
          *         (for all (Character)i in s : (char)i in b) and <br />
          *         (for all (char)i in b : (Character)i in s)
         public Set<Character> getElementSet()
              Set<Character> characterSet = characterMap.keySet(); //create a Set from the keys of characters in the HashMap     
              return characterSet; //return the character Set
          * Adds a single element to the multiset. This operation always increases
          * the cardinality of the multiset by 1, assuming that the maximum capacity
          * of Integer.MAX_VALUE has not been reached.
          * @param item
          *            the char to be added to b
          * @requires |b| < Integer.MAX_VALUE
          * @alters b
          * @ensures b = #b union {item}
         public void add(char item)
              characterMap = inputIntoMap(item); //call the private method to add new character (item) to the HashMap
          * Removes the target, if it is present in the multiset. The method returns
          * true if and only if it changes the multiset.
          * @param target
          *            the char to be removed
          * @alters b
          * @ensures (target not in #b) ==> (b = #b) <br />
          *          (target in #b) ==> (b union {target} = #b)
          * @return target in #b
         public boolean remove(char target)
              boolean answer=false; //set initial value to false
              //if the target character is in the map then remove it
              if(characterMap.containsKey(target))
                   int value = characterMap.get(target); //find the value associated with the target character
                   //if the value is 1 call remove from the HashMap and remove key and value
                   if(value == 1)
                        characterMap.remove(target); //remove key and value from the HashMap
                   else //value is greater than 1
                        value--; //decrease value to show removal
                        characterMap.put(target, value); //replace target character with new value back into the HashMap
                   answer = true; //set answer to true because the HashMap was changed
              else //target does not exist in the HashMap
                   answer = false; //set answer to false because the HashMap was not changed
              return answer; //return answer
          * Returns a char chosen randomly based on the contents of the multiset.
          * This operation does not remove the char from the multiset or change the
          * multiset in any way. In particular, the cardinality of the multiset is
          * the same before and after this method.
          * <p>
          * Characters should be returned with a random distribution equal to the
          * distribution of characters in the multiset. That is, for a character that
          * appears N times in a multiset of cardinality M, the probability of that
          * character being returned is N / M. For example, a multiset that contains
          * only the character 'a', possibly many times, would always result in an
          * 'a' being generated. On the other hand, a multiset with an equal number
          * of 'a' and 'b' elements would return an 'a' approximately half the time
          * and a 'b' the other half.
          * @requires |b| >= 1
          * @return char c with probability p, where: <br />
          *         p = ||c,b|| / |b|
         public char randomUniformChoose()
              char randomCharacter=' ';
              Random generator = new Random();
              int totalElementsInMap=0;
              Collection<Integer> integerCollection = characterMap.values(); //create a collection for easy iteration
              //iterate through each value in the HashMap and compute the total number of elements in the HashMap. 
              //Do this in case a remove call was made
              for(Integer valueFromCollection : integerCollection)
                   totalElementsInMap = totalElementsInMap + valueFromCollection; //compute new value of total values
              int randomInt = generator.nextInt(totalElementsInMap+1), lowerValue=0, upperValue=0;
              Collection<Character> keyCollection = characterMap.keySet();
              //iterate through each value in the HashMap and compute the total number of elements in the HashMap
              for(Character keyFromCollection : keyCollection)
                 upperValue = upperValue + characterMap.get(keyFromCollection);
                 if(randomInt == upperValue)
                      randomCharacter = keyFromCollection;
                 if(randomInt >= lowerValue && randomInt <= upperValue)
                      randomCharacter = keyFromCollection;
                 lowerValue = upperValue + 1;
              return randomCharacter; //return the random character pulled out
    }The Error:
    Exception in thread "main" java.lang.NullPointerException
         at DenseFrequencyLibrary.randomUniformChoose(DenseFrequencyLibrary.java:137)
         at DistributionPlagiarist.randomphrase(DistributionPlagiarist.java:146)
         at DistributionPlagiarist.main(DistributionPlagiarist.java:112)I will attempt to explain what this does in as few words as possible. For a breakdown of the lab go urlhttp://www.cse.ohio-state.edu/~paolo/teaching/494MJ/labs/lab8.shtml{url}. If you don't feel like reading that: THe program reads in some command line arguments. From there it reads from the file provided in the command line and creates "keys" from the specified length. From there I need to create a phrase of the specified length. If i am supposed to create more then one then i do. That is pretty much it. I can't figure out where (really why) the NullPointerException error is coming from.
    Help is appreciated!!

    Post the actual error text (copy and paste, don't "interpret" it) here.
    It should include a stack trace which references a line number of the program -
    unless you suppressed the trace, in which case change your error handling
    so that the trace is produced.
    Identify which program line in your post the error is pointing to so that we can match
    the error with your program, since your post doesn't have line numbers..
    Edited by: ChuckBing on Nov 16, 2007 7:19 PM
    Also - posting large amounts of code (as you did) will reduce the chance of anyone helping

  • How can I populate a date field when document is signed?

    I have 4 digital signature fields in a PDF form.  Next to each signature field is a date field (m/d/yyyy format).  I would like it so when the user signs the signature box that the date field next to it populates with todays date, then changes to read only (so it cannot be altered).
    In Adobe Acrobat Pro 9 I have this form and it has the following fields
    Signature1
    Signature2
    Signature3
    Signature4
    DateField1
    DateField2
    DateField3
    DateField4
    The Signature fields trigger a Topaz.GemSignPlus driver where the end user will be signing on an electronic signature pad.
    How can I use Javascript to detect when one of those Signature fields is populated and then fill in the date to the approrpiate date field?  I tried creating boolean variables initialized as false for each sig field.  Then when the signature is done I try to change it to true, but for whatever reason my javascript detecting the value doesn't do anything.
    I've searched the net endlessly for this solution.  I can't believe I'm having such a hard time finding an answer.  I mean how many places do you go where they ask you to "Sign and date here".  Every signature based document I've ever seen also requires a date.
    Anyway here's what I have.  In Document JavaScript functions I have a script name called populate date:
    function populatedate()
    var bSignature1 = new Boolean();
    var bSignature2 = new Boolean();
    var bSignature3 = new Boolean();
    var bSignature4 = new Boolean();
    if (bSignature1) {
        DateField1.value = util.printd ("m/d/yyyy", new Date());
    if (bSignature2) {
        DateField2.value = util.printd ("m/d/yyyy", new Date());
    if (bSignature3) {
        DateField3.value = util.printd ("m/d/yyyy", new Date());
    if (bSignature4) {
        DateField4.value = util.printd ("m/d/yyyy", new Date());
    In each signature field I have under the Signed tab "This script executes when field is signed:
    var bSignature1 = new Boolean(true);
    I'm trying to change it to true see.  My thinking is if its true than DateField1.value should print the m/d/yyyy in it from the built in Date() function.
    But maybe I am not getting this context correct.  I am new to Javascript in Adobe.

    It's quite a round-about script... Why not simply use the signature signing script to set the value of the date field? The correct syntax for that is:
    this.getField("DateField1").value = util.printd ("m/d/yyyy", new Date());

  • ImageIcon can not be drawn and NullPointerException was thrown

    I have a dialog that displays list of items whose cell renderer is customized using ImageIcons. Permissions have been granted properly, I think. The dialog can be shown but it can not draw it's children element correctly. And java.lang.NullPointerException was thrown:
    java.lang.NullPointerException
            at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
            at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
            at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
            at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
            at javax.swing.ImageIcon.paintIcon(Unknown Source)
            at javax.swing.plaf.basic.BasicToggleButtonUI.paintIcon(Unknown Source)
            at javax.swing.plaf.basic.BasicToggleButtonUI.paint(Unknown Source)
            at javax.swing.plaf.ComponentUI.update(Unknown Source)
            at javax.swing.JComponent.paintComponent(Unknown Source)
            at javax.swing.JComponent.paint(Unknown Source)
            at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
            at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
            at javax.swing.JComponent._paintImmediately(Unknown Source)
            at javax.swing.JComponent.paintImmediately(Unknown Source)
            at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
            at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknow
    n Source)
            at java.awt.event.InvocationEvent.dispatch(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)The same app. can be run without problem in normal environment.(comp. in secure mode). It would be very nice if u can give me some advices about that.
    (Possibly I have not understanden any important aspects about JSE in this field.)
    Thanks!

    Done. I should have read through the usage of Icons in Java Tutorial first. If anybody has this similar problem, that is a good source for clearing.

  • Can illustrator populate a pie chart from excel data?

    I was wondering if there was a way to import excel datat into illustrator, then it populates a vector pie or bar chart for me?  Is this even possible?
    Thanks in advance,
    Jenny
    http://texturedwallpaper.org

    you can copy/paste data from Excel to Illustrator

  • How can i populate the Jcombobox with the data from my jpa list? Desperate

    I need to populate my jcombobox with data from my jpa. This is my first time trying this and i just need some sample or a quick solution to this. Thanks in advance
    <code>
    public static MyNames myNames() {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("JavaTrialsPU");
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    Query q = em.createNamedQuery("MyNames.findAll");
    MyNames n = (MyNames) q.getResultList();
    return n;
    public static void myCombo() {       
    comboBox = new JComboBox(????--how can i make the jcombobox display my myNames() list--?????);
    frame.add(comboBox, BorderLayout.PAGE_START);
    </code>

    Implement toString() on your entity to return whatever you want to use as a label for the combobox.
    Your need for quick solutions is very destructive to your learning process. In stead take the time and read around a little. Swing happens to have an excellent tutorial with many example programs readily available for you to pick through:
    http://docs.oracle.com/javase/tutorial/uiswing/
    And PS: you need to use \ tags in this forum.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for