Jump to content

Tried making gui with tabs now script wont even start


skillerkidos1

Recommended Posts

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

c1caaf97a978c79ffd42f44383c93bf4.png

SOLVED THANK YOU!

 

idk what im doing wrong :(

thank you for your help in  advance <3

Edited by skillerkidos1
Link to comment
Share on other sites

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. 
 

  1. public void open(){
  2. mainDialog.setVisible(true);
  3. }
  4.  
  5. public void close(){
  6. mainDialog.setVisible(false);
  7. mainDialog.dispose();
  8. }
Link to comment
Share on other sites

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 by Nbacon
  • Heart 1
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

  • Heart 1
Link to comment
Share on other sites

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 ❤️❤️❤️❤️

  • Heart 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...