java - Adjusting the JButton size and putting it as a small button in the middle of a JFrame -
jframe menu; private void menuframe() { menu = new jframe(); menu.setsize(600, 600); menu.setdefaultcloseoperation(jframe.exit_on_close); menu.setresizable(false); menu.getcontentpane().setlayout(new gridlayout(4,5)); menu.getcontentpane().setbackground(new color(15, 81, 162)); jbutton game = new jbutton("new game"); game.addactionlistener(this); menu.getcontentpane().add(game); jbutton multi = new jbutton("multiplayer"); menu.getcontentpane().add(multi); jbutton howto = new jbutton("how play"); menu.getcontentpane().add(howto); jbutton credits = new jbutton("credits"); menu.getcontentpane().add(credits); menu.setvisible(true); }
i have 2 questions:
- for menu frame, want have background small buttons placed center north down center south, problem buttons placed below each other size whole width of jframe after using setsize on it
- how put image background menu jframe?
then small buttons placed center north down center south
try vertical box layout.
Comments
Post a Comment