skillerkidos1 Posted January 26, 2021 Posted January 26, 2021 (edited) Hey so i tried making a GUI with tabs but now when i try to start my script nothing happens. the log does not say anything either. I tried use JFormDesigner but couldnt get that to work so i checked out explvs guide i think it was. suppose to looke like this SOLVED THANK YOU! idk what im doing wrong thank you for your help in advance Edited January 26, 2021 by skillerkidos1
Khaleesi Posted January 26, 2021 Posted January 26, 2021 (edited) Have you put somthing in your .open() method? Any errors? Edited January 26, 2021 by Khaleesi
skillerkidos1 Posted January 26, 2021 Author Posted January 26, 2021 1 hour ago, Khaleesi said: Have you put somthing in your .open() method? Any errors? No I had a simple GUI and it was working fine then I redid the GUI and now the script won’t start. The log in osbot does not say anything when I try to start the script. public void open(){ mainDialog.setVisible(true); } public void close(){ mainDialog.setVisible(false); mainDialog.dispose(); }
Nbacon Posted January 26, 2021 Posted January 26, 2021 Were is JFrame frame? (I think that is your problem)
skillerkidos1 Posted January 26, 2021 Author Posted January 26, 2021 33 minutes ago, Nbacon said: Were is JFrame frame? (I think that is your problem) Where would I put that? Originally I was following this guide here
Nbacon Posted January 26, 2021 Posted January 26, 2021 (edited) Ok. I was mistaken on the Jpanel.Try this mainDialog = new JDialog(); mainDialog.setTitle("KO Corp"); mainDialog.setModal(true); mainDialog.setLayout(new BoxLayout(mainDialog, BoxLayout.PAGE_AXIS)); mainDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS)); mainDialog.getContentPane().add(mainPanel); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setBorder(new EmptyBorder(15,15,15,15)); mainPanel.add(tabbedPane); (next time can you post the whole code so I/everone can run it) Edited January 26, 2021 by Nbacon 1
skillerkidos1 Posted January 26, 2021 Author Posted January 26, 2021 14 minutes ago, Nbacon said: Ok. I was mistaken on the Jpanel.Try this mainDialog = new JDialog(); mainDialog.setTitle("KO Corp"); mainDialog.setModal(true); mainDialog.setLayout(new BoxLayout(mainDialog, BoxLayout.PAGE_AXIS)); mainDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS)); mainDialog.getContentPane().add(mainPanel); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setBorder(new EmptyBorder(15,15,15,15)); mainPanel.add(tabbedPane); (next time can you post the whole code so I/everone can run it) https://pastebin.com/U0hmwKbZ That’s all of it and I’ll try what you said when I get home I’m a few hours. Hopefully that will work!
Nbacon Posted January 26, 2021 Posted January 26, 2021 Wow.... comment out... "mainDialog.setLayout(new BoxLayout(mainDialog, BoxLayout.PAGE_AXIS));" works on my pc with this test code. public class Main { public static void main(String[] args) { AtomicReference<GUI> gui = new AtomicReference<GUI>(new GUI()); try { SwingUtilities.invokeAndWait(() -> { gui.set(new GUI()); gui.get().open(); }); } catch (InterruptedException | InvocationTargetException e) { return; } System.out.println("Done"); } } (linux so it might look different on windows/mac) https://ibb.co/qFX15fW 1
skillerkidos1 Posted January 26, 2021 Author Posted January 26, 2021 12 minutes ago, Nbacon said: Wow.... comment out... "mainDialog.setLayout(new BoxLayout(mainDialog, BoxLayout.PAGE_AXIS));" works on my pc with this test code. public class Main { public static void main(String[] args) { AtomicReference<GUI> gui = new AtomicReference<GUI>(new GUI()); try { SwingUtilities.invokeAndWait(() -> { gui.set(new GUI()); gui.get().open(); }); } catch (InterruptedException | InvocationTargetException e) { return; } System.out.println("Done"); } } (linux so it might look different on windows/mac) https://ibb.co/qFX15fW I love you 1