0

Is this possible? I'd like to add a java file in each tab of this JFrame. I've already created the files, I'd just like to show both files in one. The files I'd like to add are commented out:

storageSP and calculatorEDL

import javax.swing.*;
import java.awt.event.*;

public class TabbedPane extends JFrame {
    
    public TabbedPane() {
          
        setTitle("Duck Calculators");  
        setSize(400,400); 
        
        JTabbedPane jtp = new JTabbedPane();
        getContentPane().add(jtp);
        
        JPanel jpStorageSP = new JPanel();//This will create the first tab
        JPanel jpcalcEDL = new JPanel();//This will create the second tab

        jtp.addTab("storageSP", jpStorageSP);
        jtp.addTab("calculatorEDL", jpcalcEDL);

        //jpStorageSP.add(storageSP.java);//add file
        //jpcalcEDL.add(calculatorEDL.java);//add file

        setVisible(true);
    }

    public static void main (String []args){
    	TabbedPane tab = new TabbedPane();
    }
}
2
Contributors
1
Reply
6
Views
7 Years
Discussion Span
Last Post by NormR1
0

I'd just like to show both files in one. The files I'd like to add are commented out:

Why are they commented out?
What does the API doc for the addTab method say are valid arguments for it?

Edited by NormR1: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.