java - How To Add JLabel to Already Existing Jframe? -
lol dont know if worded right
i new programmer , code main class:
package culminatingnew;
import java.awt.borderlayout; import java.awt.color; import java.awt.container; import java.awt.dimension; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jtextfield; public class culminatingnew { public static void main(string[] args) { container container = null; jframe jframe = new jframe("math adventure"); jframe.setdefaultcloseoperation(jframe.exit_on_close); jframe.setlocationrelativeto(null); jframe.setbounds (150, 0, 1000, 1000); jframe.setbackground(color.blue); jframe.setvisible(true); jlabel labeltext = new jlabel("welcome!"); jframe.getcontentpane().add(new characterchoose());// jframe.setvisible(true); jframe.getcontentpane().add(labeltext); jframe.setvisible(true); so basically, i'm making game. in class in assignment package characterchoose, user greeted picture of character. want add text same screen saying "welcome", whenever try ignores characterchoose screen , opens new blank frame says "welcome". there way fix this?
gui's not linear/procedural programs, event driven, is, happens , respond it.
instead, maybe consider using button saying "continue" or something, user must press, once pressed, can present next view.
i'd recommend having @ cardlayout easier management of switching between views.
see how use buttons, check boxes, , radio buttons, how write action listeners , how use cardlayout more details
Comments
Post a Comment