Jump to content

Tried making gui with tabs now script wont even start


Recommended Posts

Posted (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

c1caaf97a978c79ffd42f44383c93bf4.png

SOLVED THANK YOU!

 

idk what im doing wrong :(

thank you for your help in  advance <3

Edited by skillerkidos1
Posted
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. }
Posted (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 by Nbacon
  • Heart 1
Posted
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!

Posted

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
Posted
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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