dokato Posted March 28, 2015 Share Posted March 28, 2015 (edited) Ok so i've made this unfinished gui using window builder and now I want it to just pop up when i start my script, nothing more. I've tried to make an object of it in my main script class and also experimented and tried a bunch of diffrent things but nothing works (the script wont even start up). my gui class: http://pastebin.com/38v3WGrE Edited March 28, 2015 by dokato Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 28, 2015 Share Posted March 28, 2015 (edited) remove public static void main(String[] args) { GUI window = new GUI(); window.frame.setVisible(true); } in the main class create a simple instance of the gui GUI window = new GUI(); then in the onstart you make it visible window.frame.setVisible(true); and incase you are waiting for gui to end before you continue with the script. in the onloop add a simple isVisible() boolean check Edited March 28, 2015 by josedpay 1 Quote Link to comment Share on other sites More sharing options...
dokato Posted March 28, 2015 Author Share Posted March 28, 2015 still doesnt work Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 28, 2015 Share Posted March 28, 2015 still doesnt work change window.frame.setVisible(true); to window.setVisible(true); Quote Link to comment Share on other sites More sharing options...
dokato Posted March 28, 2015 Author Share Posted March 28, 2015 change window.frame.setVisible(true); to window.setVisible(true); nope still doesnt work, i also tried some additional thing as well but nothing works Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 28, 2015 Share Posted March 28, 2015 any error code? Quote Link to comment Share on other sites More sharing options...
dokato Posted March 28, 2015 Author Share Posted March 28, 2015 (edited) any error code? no error at all the script doesnt start when i click start, even the paint doesnt show up unless i undo what ive added Edited March 28, 2015 by dokato Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 28, 2015 Share Posted March 28, 2015 (edited) no error at all the script doesnt start when i click start, even the paint doesnt show up unless i undo what ive added ok so keep this in the onStart GUI window = new GUI(); Your gui class extend JFrame so use it. What you did was created a new jFrame instance instead of using the classes JFrame. So delete frame = new JFrame(); private JFrame frame; you will get a few error with "frame." simply remove it and it should be good. finally at the end of gui constructor the last line should be Gui() { //stuff setVisible(true); } no need for setVisible in the onstart since its in the constructor Edited March 28, 2015 by josedpay Quote Link to comment Share on other sites More sharing options...
dokato Posted March 28, 2015 Author Share Posted March 28, 2015 ok so keep this in the onStart GUI window = new GUI(); Your gui class extend JFrame so use it. What you did was created a new jFrame instance instead of using the classes JFrame. So delete frame = new JFrame(); private JFrame frame; you will get a few error with "frame." simply remove it and it should be good. finally at the end of gui constructor the last line should be Gui() { //stuff setVisible(true); } no need for setVisible in the onstart since its in the constructor still doesnt work and the script doesnt startup Quote Link to comment Share on other sites More sharing options...
dokato Posted March 28, 2015 Author Share Posted March 28, 2015 FIXED ty for help josedpay Quote Link to comment Share on other sites More sharing options...
Wizard Posted March 28, 2015 Share Posted March 28, 2015 Should run the gui on its own thread. SwingUtilities.invokeLater(new Runnable() { public void run() { Gui gui = new Gui(); gui.setVisible(true); } }); Quote Link to comment Share on other sites More sharing options...
7331337 Posted March 29, 2015 Share Posted March 29, 2015 Also you should make your own GUI, cleaner then the spam out of windowbuilder. Quote Link to comment Share on other sites More sharing options...