0

We have a project for university which is a program to hold handouts and feedback for courseworks done.

What we've thought of is breaking the whole thing down into smaller pieces, for example: You have a coursework which requires to write a program and a report on results etc. So the user will create a new coursework by selecting the "code" and "report" options, since that's what is required. And then we need to create the respective tabs in the program so the user can input what is needed.

I have created all necessary forms and windows, It's just I'm not sure how to move on forward. a) where should I put my code? should I have it on the "create" event? b) how do I do this whole custom population thing?

Obviously, I'm not asking for the entire thing in code. I'm not even sure what to read and what to search for.

Following are some screenshots of the ui to help explain what I mean.

New project window New project window

How the main window should be after creating a new projet. Notice the various tabs. How the main window should be after creating a new projet. Notice the various tabs.

A form for report feedback A form for report feedback

Ema Black
  • 63
  • 1
  • 12

1 Answers1

1

On your "Create" button click check for the checkbox.isSelected() and use the method below as:

if(reportCheckbox.isSelected()){
  addonScreen(new reportFrame(),"Report Submission");
  addonScreen(new reportFeedbackFrame(),"Report Feedback");
}

Use a desktop pane as a container...add your tabbed pane to it

public static JTabbedPane tabbedPane = new JTabbedPane();
jDesktopPane1.add(tabbedPane);

Use this method to add tabs to the layout at runtime

public static void addOnScreen(JInternalFrame inFrame, String title) {
    //border for the internal frame        

    javax.swing.plaf.InternalFrameUI ifu = inFrame.getUI();
    ((javax.swing.plaf.basic.BasicInternalFrameUI) ifu).setNorthPane(null);
    Border b1 = new LineBorder(new Color(114, 139, 173), 3, true) {
    };

    tabbedPane.setBounds(0, 0, jDesktopPane1.getWidth(), jDesktopPane1.getHeight());
    inFrame.setLocation(0, 0);
    inFrame.setSize(jDesktopPane1.getWidth(), jDesktopPane1.getHeight());
    inFrame.setBorder(b1);
    JPanel jp = new JPanel();
    jp.setLayout(new GridLayout());
    jp.setOpaque(true);
    jp.add(inFrame);
    tabbedPane.addTab(title, jp);
    tabbedPane.setSelectedComponent(jp);
    inFrame.requestFocusInWindow();
    inFrame.setVisible(true);
    tabbedPane.setVisible(true);
}