swing - Java - createImageIcon() not recognized in code? -
i keep getting error createimageicon() not recognized available function. not sure why occuring, feel have loaded libraries need it.
imageicon icon = createimageicon("images/middle.gif","this caption");
i've tried using different arguments, etc., can't seem figure out.
import javax.swing.*; import javax.swing.imageicon; import java.awt.*; import java.awt.image.bufferstrategy; public class main extends jframe { public main() { } public static void main(string[] args) { jmenubar menubar = new jmenubar(); jmenu menu_file = new jmenu("test menu"); jmenu menu_file_new = new jmenu("new"); imageicon icon = createimageicon("images/middle.gif","this caption"); menu_file.add(menu_file_new); jmenuitem menu_file_new_project = new jmenuitem("project..."); jmenuitem menu_file_new_burrito = new jmenuitem("burrito..."); jmenuitem menu_file_new_cookie = new jmenuitem("cookie..."); jmenuitem menu_file_new_other = new jmenuitem("other..."); menu_file_new.add(menu_file_new_project); menu_file_new.add(menu_file_new_burrito); menu_file_new.add(menu_file_new_cookie); menu_file_new.add(menu_file_new_other); jmenuitem menu_file_open = new jmenuitem("open..."); jmenuitem menu_file_save = new jmenuitem("save"); jmenuitem menu_file_saveas = new jmenuitem("save as..."); jmenuitem menu_file_reload= new jmenuitem("reload"); menu_file.add(menu_file_open); menu_file.add(menu_file_save); menu_file.add(menu_file_saveas); menu_file.add(menu_file_reload); menu_file.addseparator(); jmenuitem menu_file_screenshot = new jmenuitem("take screenshot"); menu_file.add(menu_file_screenshot); menu_file.addseparator(); jmenuitem menu_file_exit = new jmenuitem("exit"); menu_file.add(menu_file_exit); menubar.add(menu_file); jmenu menu_edit = new jmenu("edit"); jmenu menu_windows = new jmenu("windows"); jmenu menu_mode = new jmenu("mode"); jmenu menu_help = new jmenu("help"); menubar.add(menu_edit); menubar.add(menu_windows); menubar.add(menu_mode); menubar.add(menu_help); main frame = new main(); frame.setjmenubar(menubar); // create menu , associate frame frame.settitle("3dairspace"); frame.setundecorated(true); //frame.setextendedstate(jframe.maximized_both); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.pack(); frame.setvisible(true); } }
should be:
imageicon icon = new imageicon("images/middle.gif","this caption");
so you're calling constructor new imageicon object?
Comments
Post a Comment