January 26, 20215 yr 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, 20215 yr by skillerkidos1
January 26, 20215 yr Have you put somthing in your .open() method? Any errors? Edited January 26, 20215 yr by Khaleesi
January 26, 20215 yr Author 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(); }
January 26, 20215 yr Author 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
January 26, 20215 yr 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, 20215 yr by Nbacon
January 26, 20215 yr Author 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!
January 26, 20215 yr 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
January 26, 20215 yr Author 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 ❤️❤️❤️❤️
Create an account or sign in to comment