java - How can I call my class gui_Game from Main via button's action listener? -
when clicked button named "start", i'd launch class in gui_game
. in gui_game
set title , there have 3 button.
this code in main
class:
private class start implements actionlistener{ public void actionperformed(actionevent e) { jbutton b = (jbutton) e.getsource(); if (b.gettext().equals("start")) // want add here } }
this gui_game
source:
public class gui_game extends jframe{ private jbutton button; private jbutton button1; private jbutton button2; private jbutton button3; private jbutton button4; private jbutton button5; private jbutton button6; private jbutton button7; private jbutton button8; private jlabel stage; public gui_game() throws ioexception { // .. code .. } public static void main(string[] args) throws ioexception { gui_game main = new gui_game(); main.setvisible(true); } }
in gui_game
, creates new window , 3 buttons.
Comments
Post a Comment