Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ihm; import java.awt.Color; import java.awt.Dimension; import javax.swing.JPanel; import javax.swing.JTabbedPane; import models.DataList; import org.jfree.chart.JFreeChart; /** * * @author kenygia */ public class PaneTab extends JPanel { public JTabbedPane mainActivity = new JTabbedPane(); JPanel tabPane1, tabPane2, tabPane3; public PaneTab() { super(); //super.setPreferredSize(new Dimension(600,600)); //mainActivity.setPreferredSize(new Dimension(600,600)); mainActivity.setBackground(Color.GREEN); tabPane1 = new JPanel(); tabPane2 = new JPanel(); tabPane3 = new JPanel(); tabPane1.setBackground(Color.BLUE); tabPane2.setBackground(Color.CYAN); tabPane3.setBackground(Color.MAGENTA); mainActivity.add(tabPane1); mainActivity.setTitleAt(0, "Ram"); mainActivity.add(tabPane2); mainActivity.setTitleAt(1, "Rem"); mainActivity.add(tabPane3); mainActivity.setTitleAt(2, "Emilia"); DataList test = new DataList(); //mainActivity.add("Ram",tabPane1); //mainActivity.add("Rem",tabPane2); //mainActivity.add("Emilia",tabPane3); super.add(mainActivity); super.setVisible(true); } @Override public void setSize(Dimension dimOriginal) { //System.out.println(dimOriginal); Dimension d = new Dimension(dimOriginal.width - 192, dimOriginal.height - 192); //super.setPreferredSize(d); //mainActivity.setPreferredSize(d); } }