Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
  1. #21
    AngeloGilio is offline Member
    Join Date
    Mar 2015
    Posts
    11
    Rep Power
    0

    Default Re: Using JtextField as gogole toolbar

    Thanks a lot guys! i did it...i'm very gratefull!!!!

  2. #22
    AngeloGilio is offline Member
    Join Date
    Mar 2015
    Posts
    11
    Rep Power
    0

    Default Re: Using JtextField as gogole toolbar

    Guys i'm tring to compare a textbox input to arraylist, i wrote this but it give me an error...why? where i'm wrong? Thanks!

    public static void main(String args[]) {

    String p[] = new String[2];
    p[0]="test";
    p[1]="ragno";

    if (jTextField1 == p);

  3. #23
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Using JtextField as gogole toolbar

    A JTextField isn't an array of Strings, so they can't be compared for equality; a single String also isn't an array of Strings, so they can't be compared either. Pleas explain in words what you have in mind ...

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  4. #24
    AngeloGilio is offline Member
    Join Date
    Mar 2015
    Posts
    11
    Rep Power
    0

    Default Re: Using JtextField as gogole toolbar

    I'd like to compare the input from a textfield example: i write test in a textfield and check if this this world exist in a specific list..for this reason i've thought to do an array list...

    String p[] = new String[2];
    p[0]="test";
    p[1]="ragno";

    if (jTextField1 == p);

  5. #25
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Using JtextField as gogole toolbar

    As I wrote above: a JTextField isn't a String, it has a String and you can get it with its getText() method (read the API docs for that class); also, you're not using a List<String>, you're using a primitive array of Strings and that, for sure, can never be equal to a JTextField ... otherwise, you could've written: list.contains(yourTextField.getText()) ...

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 07-17-2014, 02:27 PM
  2. Replies: 3
    Last Post: 11-14-2011, 05:13 AM
  3. Replies: 1
    Last Post: 01-30-2009, 06:44 PM
  4. Creating a toolbar in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:08 PM
  5. How to use ToolBar in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •