hi
this is jus a question. if you are doing a program that uses a GUI, with the radiobutton, checkboxes and so on
why do you have add an import for all the jradiobutton and jcheckbox. is is necessary to add an import for each of them


1 | import javax.swing.*; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | JRadioButton jrbwheat= new JRadioButton( "Wheat" ); JRadioButton jrbitalian = new JRadioButton( "Italian" ); JRadioButton jrbparmesanOrgeano = new JRadioButton( "Parmesan Orgeano" ); JRadioButton jrbhoney = new JRadioButton( "Honey Oats" ); bread.add(Wheat); bread.add(Italian); this area here is where I am getting the error: the erros says(non- static variable bread cannot be referenced from a static context) how can i fix this bread.add(Parmeasan Orgeano); bread.add(Honey Oats); } //type of sub JPanel type1 = new JPanel( new GridLayout 6 , 1 ); another error is here: it is telling me to import a javaz gridlayout. do i have to JRadioButton jrbblt = new JRadioButton( "Italian B.L.T - $5.00" ); JRadioButton jrbsubwayclub = new JRadioButton( "Subway Club - $5.00" ); JRadioButton jrbsteak = new JRadioButton( "Steak & Cheese -$5.00" ); JRadioButton jrbchickenteriyaki = new JRadioButton( "Chicken Teriyaki - $7.00" ); JRadioButton jrbsubwaymelt = new JRadioButton( "Subway Melt - $5.00" ); JRadioButton jrbtura = new JRadioButton( "Tura - $5.00" ); JRadioButton jrbroastbeef = new JRadioButton( "Roast Beef $ 7.00" ); JRadioButton jrbveggiedelite = new JRadioButton( "Veggie Delite" ); |