Results 1 to 6 of 6
- 09-24-2012, 03:09 PM #1
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
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);
}
}
- 09-24-2012, 03:37 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 09-24-2012, 04:08 PM #3
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-24-2012, 04:18 PM #4
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
- 09-24-2012, 04:39 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 09-24-2012, 04:44 PM #6
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Creating a simple menu
By hvince95 in forum New To JavaReplies: 7Last Post: 01-20-2012, 07:07 AM -
Problems with the menu and Internet Explorer 7
By vec in forum New To JavaReplies: 7Last Post: 07-13-2011, 07:52 PM -
Need some help with a simple menu.
By Medabi3 in forum Java 2DReplies: 1Last Post: 04-04-2011, 05:21 AM -
JFrame - Output and Input in Frame - menu choice and simple Calculator
By sambo731 in forum AWT / SwingReplies: 3Last Post: 08-07-2010, 05:28 AM -
Need help with java rapid roll game
By blunderblitz in forum New To JavaReplies: 1Last Post: 03-02-2010, 12:36 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks