Results 1 to 6 of 6
  1. #1
    Krtek80 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default problems with simple roll down menu in java

    Hello I have a problem withg following error message being popped up after attempting to compile the java code.
    Many thanks for any idea which might explain why this is so. Milan.
    THE ERROR MESSAGE IS:
    C:\Program Files\Java\jdk1.7.0_04\bin>javac GUI10_206.java
    Note: GUI10_206.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.


    the code is:

    import java.awt.*;
    import javax.swing.*;
    public class GUI10_206 {
    public static void main(String[] arg) {
    Okno okno = new Okno();
    }
    }
    class Okno extends JFrame {
    public Okno() {
    super("Nadpis Okna");
    setSize(400, 100);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);
    Container kon = getContentPane();
    kon.setBackground(Color.green);
    FlowLayout srf = new FlowLayout();
    kon.setLayout(srf);
    JComboBox rseznam1 = new JComboBox();
    rseznam1.addItem("Jedna");
    rseznam1.addItem("Dva");
    rseznam1.addItem("Tri");
    kon.add(rseznam1);
    setContentPane(kon);
    }
    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default Re: problems with simple roll down menu in java

    Please use [code] tags [/code] when posting code.
    Did you do as the message suggested and use the -Xlint:unchecked option on the command line?
    That would tell you exactly where that warning (and it's a warning, not an error) is being flagged.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: problems with simple roll down menu in java

    I'll add a hint: JComboBox was genericized in Java 7. So when tracking down the warning, make sure to refer to the Java 7 API -- not any earlier version.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Krtek80 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: problems with simple roll down menu in java

    Quote Originally Posted by DarrylBurke View Post
    I'll add a hint: JComboBox was genericized in Java 7. So when tracking down the warning, make sure to refer to the Java 7 API -- not any earlier version.

    db
    THANKS FOR YOUR HELP HOWEVER I HAVE VERSION "Java Edition Version 11.1.2.1.0", ANY IDEA WHAT THE PROBLEM COULD BE?
    MANY THANKS MILAN.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default Re: problems with simple roll down menu in java

    No need to shout...
    There is not version 11.1.2.1.0 (unless it's Oracles internal database one maybe, but I have no idea how the numbering on that works).
    From your first post above it is clear you are using Java 1.7 ("C:\Program Files\Java\jdk1.7.0_04\bin").

    Anyway, Darryl has said what the warning is about, which is that JComboBox is now a generic class.
    If you don't know about generics, here's the tutorial.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    Krtek80 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: problems with simple roll down menu in java

    Quote Originally Posted by Tolls View Post
    No need to shout...
    There is not version 11.1.2.1.0 (unless it's Oracles internal database one maybe, but I have no idea how the numbering on that works).
    From your first post above it is clear you are using Java 1.7 ("C:\Program Files\Java\jdk1.7.0_04\bin").

    Anyway, Darryl has said what the warning is about, which is that JComboBox is now a generic class.
    If you don't know about generics, here's the tutorial.
    Ok, thanks for your help, I am new to Java....:)

Similar Threads

  1. Creating a simple menu
    By hvince95 in forum New To Java
    Replies: 7
    Last Post: 01-20-2012, 08:07 AM
  2. Replies: 7
    Last Post: 07-13-2011, 08:52 PM
  3. Need some help with a simple menu.
    By Medabi3 in forum Java 2D
    Replies: 1
    Last Post: 04-04-2011, 06:21 AM
  4. Replies: 3
    Last Post: 08-07-2010, 06:28 AM
  5. Need help with java rapid roll game
    By blunderblitz in forum New To Java
    Replies: 1
    Last Post: 03-02-2010, 01:36 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
  •