IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants Java Discussion :

Générer des sous-onglets automatiquement


Sujet :

Composants Java

  1. #1
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut Générer des sous-onglets automatiquement
    Salut à tous,

    Lors de ma génération de mes sous onglets rien de s'affiche et surtout il y a une erreur.
    Pouvez-vous regarder essentiellement l'utilisation des JTabbedPane :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
     
    public JTabbedPane createJTabbed(File file) {
    		JTabbedPane tabbedPanes = null;
     
    		try {	
    			List<JTabbedPane> lstTabbedPane = createTabPanel(tabbedPanes, file);
     
    			tabbedPanes = new JTabbedPane();
    			for (JTabbedPane tabbedPane : lstTabbedPane) {
    				tabbedPane.add(tabbedPanes.getName(), tabbedPanes);
     
    				IhmConverter.getHDMT().add(tabbedPane);
    			}
    			wb.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		tabbedPanes.addChangeListener(new ActionChange(tabbedPanes));
     
    		return tabbedPanes;
    	}
     
    	/**
             * Create a tab panel by excel feel
             * 
             * @param fileName
             * @param excelFile
             * @return panel list
             */
    	public List<JTabbedPane> createTabPanel(JTabbedPane tabbedPane, File file) {
    		JTable spreadsheet = null;
    		List<JTabbedPane> lstTabbedPane = new ArrayList<JTabbedPane>();
     
    		try {
    			wb = new XSSFWorkbook(file);
    			// Get the sheet number
    			int nbFeuilles = wb.getNumberOfSheets();
    			for (int i = 0; i < nbFeuilles; i++) {
    				sheet = wb.getSheetAt(i);
    				// Create one JTable by excel feel
    				spreadsheet = createJTableWithExcel(spreadsheet,sheet);
    				spreadsheet.setEnabled(false);
    				spreadsheet.setFont(Final.getFont());
    				JScrollPane elevator = new JScrollPane(spreadsheet,
    						JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    						JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    				Dimension size = new Dimension(0,50);
    				elevator.setPreferredSize(size);
    				elevator.setMinimumSize(size);
    				elevator.getViewport().setBackground(Color.WHITE);
     
    				// Create a tab by excel feel number
    				tabbedPane = new JTabbedPane();
    				tabbedPane.setLayout(new BorderLayout());
    				//TitledBorder
    				tabbedPane.setBorder(BorderFactory.createTitledBorder(sheet
    						.getSheetName()));
    				tabbedPane.setBackground(Color.LIGHT_GRAY);
    				tabbedPane.add(elevator, BorderLayout.CENTER);
    				lstTabbedPane.add(tabbedPane);
    			}
    			wb.close();
    		} catch (InvalidFormatException e) {
    			e.printStackTrace();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		return lstTabbedPane;
    	}
     
    	/**
             * Create a JTable depending on the file and the entry sheet number
             * 
             * @param file
             * @param numSheet
             * @return the table
             */
    	public JTable createJTableWithExcel(JTable table, XSSFSheet sheet) {
    		// Create new table
    		table = new JTable();
    		// Reading the excel file
    		// Count the line number
    		int nbRows = sheet.getLastRowNum();
    		// Count the column number
    		int nbColumns = numberMaxColumn(sheet);
     
    		System.out.println("In the sheet " + sheet.getSheetName()
    				+ " there are " + nbRows + " lines and " + nbColumns
    				+ " columns");
     
    		// Create new object array
    		Object[][] obj = new Object[nbRows][nbColumns];
     
    		// Array header
    		String[] title = new String[nbColumns];
    		// Browsing the sheet and retrieves the lines one by one
    		for (int rowContent = 0; rowContent < nbRows; rowContent++) {
    			row = sheet.getRow(rowContent);
     
    			// Browsing the line and retrieves the columns
    			if (row != null) {
    				for (int columnContent = 0; columnContent < nbColumns; columnContent++) {
    					// Retrieves the cell and this value
    					cell = row.getCell((short) columnContent);
    					Object value = contentCell(cell);
     
    					obj[rowContent][columnContent] = value;
     
    					//the title
    					title[columnContent] = (String) obj[0][columnContent];
    				}
    			}
    		}
    		table.setModel(new DefaultTableModel(obj, title));
     
    		return table;
    	}
    La console :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
     
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
    	at java.util.Vector.elementAt(Unknown Source)
    	at javax.swing.JTabbedPane.setForegroundAt(Unknown Source)
    	at EVENT.ActionChange.<init>(ActionChange.java:22)
    	at EVENT.UtilityMethods.createJTabbed(UtilityMethods.java:82)
    	at EVENT.ActionEvents.btnLoad_click(ActionEvents.java:64)
    	at EVENT.ActionEvents.actionPerformed(ActionEvents.java:35)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
    	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
    	at javax.swing.JComponent.processKeyBindings(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Merci à tous

  2. #2
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    Petit problème de variables entre tabbedPane et tabbedPanes :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    for (JTabbedPane tabbedPane : lstTabbedPane) {
    	tabbedPanes.add(tabbedPane.getName(), tabbedPane);
     
    	IhmConverter.getHDMT().add(tabbedPanes);
    }
    Maintenant j'ai l'affichage , mais l'affichage un petit problème, il me crée un onglet et en dessous les onglets ou peut-être que ses la suite mais qu'il manque de place, de toute façon il est sensé mettre les noms de chaque feuilles ce qu'il ne fait pas Pourquoi ?
    La console avec un System.out.println(tabbedPanes) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
     
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    javax.swing.JTabbedPane[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalTabbedPaneUI$TabbedPaneLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=352,maximumSize=,minimumSize=,preferredSize=,haveRegistered=false,tabPlacement=TOP]
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
    	at javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabArea(Unknown Source)
    	at javax.swing.plaf.basic.BasicTabbedPaneUI.paint(Unknown Source)
    	at javax.swing.plaf.metal.MetalTabbedPaneUI.paint(Unknown Source)
    	at javax.swing.plaf.metal.MetalTabbedPaneUI.update(Unknown Source)
    	at javax.swing.JComponent.paintComponent(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JSplitPane.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JLayeredPane.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    	at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
    	at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    	at java.awt.Container.paint(Unknown Source)
    	at java.awt.Window.paint(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.access$700(Unknown Source)
    	at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Exception occurred during event dispatching:
    java.lang.ArrayIndexOutOfBoundsException: 0
    	at javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabArea(Unknown Source)
    	at javax.swing.plaf.basic.BasicTabbedPaneUI.paint(Unknown Source)
    	at javax.swing.plaf.metal.MetalTabbedPaneUI.paint(Unknown Source)
    	at javax.swing.plaf.metal.MetalTabbedPaneUI.update(Unknown Source)
    	at javax.swing.JComponent.paintComponent(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JSplitPane.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JLayeredPane.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    	at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
    	at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    	at java.awt.Container.paint(Unknown Source)
    	at java.awt.Window.paint(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.access$700(Unknown Source)
    	at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.Dialog$1.run(Unknown Source)
    	at java.awt.Dialog$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.awt.Dialog.show(Unknown Source)
    	at java.awt.Component.show(Unknown Source)
    	at java.awt.Component.setVisible(Unknown Source)
    	at java.awt.Window.setVisible(Unknown Source)
    	at java.awt.Dialog.setVisible(Unknown Source)
    	at EVENT.UtilityMethods.closeApplication(UtilityMethods.java:267)
    	at EVENT.ActionWindow.windowClosing(ActionWindow.java:16)
    	at java.awt.Window.processWindowEvent(Unknown Source)
    	at javax.swing.JFrame.processWindowEvent(Unknown Source)
    	at java.awt.Window.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Merci ♣♣♣

  3. #3
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    Voilà une amélioration du code et j'ai ajouté des commentaire pour que vous puissiez comprendre la façon dont je m'y suis pris.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
     
    public JTabbedPane createJTabbed(File file) {
    		//Celui-ci est l'onglet principal, c'est  à lui que les sous-onglets reviennent
    		final JTabbedPane tabbedPrincipal = IhmConverter.getHDMT();
     
    		try {
    			//on récupère ses sous-onglets grâce à la méthode createTabPanel
    			List<JTabbedPane> lstTabbedPane = createTabPanel(file);
    			//on ajoute les sous-onglets à l'onglet principal au fur et à mesure
    			for (JTabbedPane tabbedPane : lstTabbedPane) {
    				//on lui ajouter -- 1 : le nom et 2 : le sous onglet --
    				tabbedPrincipal.add(tabbedPane.getName(),tabbedPane);
    				tabbedPane.setLayout(new BorderLayout());
    				//puis on les ajoutes
    				tabbedPrincipal.add(tabbedPane);
    			}
    			//je ferme le fichier
    			wb.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		//maintenant qu'il est rempli de sous onglet je met un changeListener
    		tabbedPrincipal.addChangeListener(new ActionChange(tabbedPrincipal));
    		//puis retourne l'onglet avec ses sous-onglets
    		return tabbedPrincipal;
    	}
     
    	/**
             * Create a tab panel by excel feel
             * 
             * @param fileName
             * @param excelFile
             * @return panel list
             */
    	public List<JTabbedPane> createTabPanel(File file) {
    		JTable spreadsheet = null;
    		//celui-ci est un sous-onglet auquel on va ajouter à l'onglet principal
    		JTabbedPane tabbedPane = null;
    		//celui-ci va récupérer la list de tous les sous-onglets
    		List<JTabbedPane> lstTabbedPane = new ArrayList<JTabbedPane>();
     
    		try {
    			wb = new XSSFWorkbook(file);
    			// Get the sheet number
    			int nbFeuilles = wb.getNumberOfSheets();
    			for (int i = 0; i < nbFeuilles; i++) {
    				sheet = wb.getSheetAt(i);
    				// Create one spreadsheet by excel feel
    				spreadsheet = createJTableWithExcel(sheet);
    				spreadsheet.setEnabled(false);
    				spreadsheet.setFont(Final.getFont());
    				JScrollPane elevator = new JScrollPane(spreadsheet,
    						JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    						JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    				Dimension size = new Dimension(0,50);
    				elevator.setPreferredSize(size);
    				elevator.setMinimumSize(size);
    				elevator.getViewport().setBackground(Color.WHITE);
     
    				// Create a tab by excel feel number
    				tabbedPane = new JTabbedPane();
    				//tabbedPane.add(sheet.getSheetName(),tabbedPane);
    				//TitledBorder
    				tabbedPane.setBorder(BorderFactory.createTitledBorder(sheet
    						.getSheetName()));
    				tabbedPane.setBackground(Color.LIGHT_GRAY);
    				//on lui ajoute un ascenseur
    				tabbedPane.add(elevator, BorderLayout.CENTER);
    				lstTabbedPane.add(tabbedPane);
    			}
    			wb.close();
    		} catch (InvalidFormatException e) {
    			e.printStackTrace();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		return lstTabbedPane;
    	}
     
    	/**
             * Create a JTable depending on the file and the entry sheet number
             * 
             * @param file
             * @param numSheet
             * @return the table
             */
    	public JTable createJTableWithExcel(XSSFSheet sheet) {
    		// Create new table
    		JTable table = new JTable();
    		// Reading the excel file
    		// Count the line number
    		int nbRows = sheet.getLastRowNum();
    		// Count the column number
    		int nbColumns = numberMaxColumn(sheet);
    		/*
    		System.out.println("In the sheet " + sheet.getSheetName()
    				+ " there are " + nbRows + " lines and " + nbColumns
    				+ " columns");
    		*/
    		// Create new object array
    		Object[][] obj = new Object[nbRows][nbColumns];
     
    		// Array header
    		String[] title = new String[nbColumns];
    		// Browsing the sheet and retrieves the lines one by one
    		for (int rowContent = 0; rowContent < nbRows; rowContent++) {
    			row = sheet.getRow(rowContent);
     
    			// Browsing the line and retrieves the columns
    			if (row != null) {
    				for (int columnContent = 0; columnContent < nbColumns; columnContent++) {
    					// Retrieves the cell and this value
    					cell = row.getCell((short) columnContent);
    					Object value = contentCell(cell);
     
    					obj[rowContent][columnContent] = value;
     
    					//the title
    					title[columnContent] = (String) obj[0][columnContent];
    				}
    			}
    		}
    		table.setModel(new DefaultTableModel(obj, title));
     
    		return table;
    	}
    Et maintenant le message d'erreur.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
     
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
    	at javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabArea(Unknown Source)
    	at javax.swing.plaf.basic.BasicTabbedPaneUI.paint(Unknown Source)
    	at javax.swing.plaf.metal.MetalTabbedPaneUI.paint(Unknown Source)
    	at javax.swing.plaf.metal.MetalTabbedPaneUI.update(Unknown Source)
    	at javax.swing.JComponent.paintComponent(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintChildren(Unknown Source)
    	at javax.swing.JSplitPane.paintChildren(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    	at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
    	at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent._paintImmediately(Unknown Source)
    	at javax.swing.JComponent.paintImmediately(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.access$700(Unknown Source)
    	at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Merci d'avance ♥♥♥

  4. #4
    Modérateur
    Avatar de joel.drigo
    Homme Profil pro
    Ingénieur R&D - Développeur Java
    Inscrit en
    Septembre 2009
    Messages
    12 430
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur R&D - Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2009
    Messages : 12 430
    Points : 29 131
    Points
    29 131
    Billets dans le blog
    2
    Par défaut
    Je ne comprends pas pourquoi tu as transformé les JPanel en JTabbedPane, alors que ça fonctionnait très bien : tu te retrouves avec des JTabbedPane à un onglet qui sont des onglets d'un autre JTabbedPane. Quel intérêt ?
    Le nom du JTabbedPane (obtenu par getName()) n'a jamais constitué le nom de l'onglet : lequel ça serait s'il y en avait plusieurs (parce que en général, quand on fait des onglets, c'est qu'on en a plusieurs, sinon on fait juste un JPanel) ? On peut appeler setName(unNom) pour récupérer un nom par getName().

    Quant à l'exception que tu as, ça vient probablement du fait que tu remplaces le LayoutManager des JTabbedPane par le tiens (un BorderLayout). A vouloir faire des trucs trop tordus et compliqués... Bon, Sun/Oracle aurait pu protéger la méthode setLayout de JTabbedPane pour empêcher le plantage pendant le rendu, mais fallait penser à l'époque que quelqu'un utilise un JTabbedPane pour faire autre chose que du panneaux à onglet.

  5. #5
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    Donc je change le JTabbedPane de mes sous ongelts alors et je vais voir.

  6. #6
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    Tu as raison c'est presque bon, j'ai les onglets et le nom qui correspond bien mais, je n'ai plus les jtable.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
     
    public JTabbedPane createJTabbed(File file) {
    		//Celui-ci est l'onglet principal, c'est  à lui que les sous-onglets reviennent
    		final JTabbedPane tabbedPrincipal = IhmConverter.getHDMT();
     
    		try {
    			//on récupère ses sous-onglets grâce à la méthode createTabPanel
    			List<JPanel> lstPanel = createTabPanel(file);
    			//on ajoute les sous-onglets à l'onglet principal au fur et à mesure
    			for (JPanel panel : lstPanel) {
    				//panel.setName(sheet.getSheetName());
    				tabbedPrincipal.add(panel.getName(),panel);
     
    				//puis on les ajoutes
    				tabbedPrincipal.add(panel);
    			}
    			//je ferme le fichier
    			wb.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		//maintenant qu'il est rempli de sous onglet je met un changeListener
    		tabbedPrincipal.addChangeListener(new ActionChange(tabbedPrincipal));
    		//puis retourne l'onglet avec ses sous-onglets
    		return tabbedPrincipal;
    	}
     
    	/**
             * Create a tab panel by excel feel
             * 
             * @param fileName
             * @param excelFile
             * @return panel list
             */
    	public List<JPanel> createTabPanel(File file) {
    		JTable spreadsheet = null;
    		//celui-ci est un sous-onglet auquel on va ajouter à l'onglet principal
    		JPanel panel = null;
    		//celui-ci va récupérer la list de tous les sous-onglets
    		List<JPanel> lstPanel = new ArrayList<JPanel>();
     
    		try {
    			wb = new XSSFWorkbook(file);
    			// Get the sheet number
    			int nbFeuilles = wb.getNumberOfSheets();
    			for (int i = 0; i < nbFeuilles; i++) {
    				sheet = wb.getSheetAt(i);
    				// Create one spreadsheet by excel feel
    				spreadsheet = createJTableWithExcel(sheet);
    				spreadsheet.setEnabled(false);
    				spreadsheet.setFont(Final.getFont());
    				JScrollPane elevator = new JScrollPane(spreadsheet,
    						JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    						JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    				Dimension size = new Dimension(0,50);
    				elevator.setPreferredSize(size);
    				elevator.setMinimumSize(size);
    				elevator.getViewport().setBackground(Color.WHITE);
     
    				// Create a tab by excel feel number
    				panel = new JPanel();
    				//TitledBorder
    				panel.setBorder(BorderFactory.createTitledBorder(sheet
    						.getSheetName()));
    				panel.setName(sheet.getSheetName());
    				panel.setBackground(Color.LIGHT_GRAY);
    				//on lui ajoute un ascenseur
    				panel.add(elevator, BorderLayout.CENTER);
     
    				lstPanel.add(panel);
    			}
    			wb.close();
    		} catch (InvalidFormatException e) {
    			e.printStackTrace();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		return lstPanel;
    	}
     
    	/**
             * Create a JTable depending on the file and the entry sheet number
             * 
             * @param file
             * @param numSheet
             * @return the table
             */
    	public JTable createJTableWithExcel(XSSFSheet sheet) {
    		// Create new table
    		JTable table = new JTable();
    		// Reading the excel file
    		// Count the line number
    		int nbRows = sheet.getLastRowNum();
    		// Count the column number
    		int nbColumns = numberMaxColumn(sheet);
    		/*
    		System.out.println("In the sheet " + sheet.getSheetName()
    				+ " there are " + nbRows + " lines and " + nbColumns
    				+ " columns");
    		*/
    		// Create new object array
    		Object[][] obj = new Object[nbRows][nbColumns];
     
    		// Array header
    		String[] title = new String[nbColumns];
    		// Browsing the sheet and retrieves the lines one by one
    		for (int rowContent = 0; rowContent < nbRows; rowContent++) {
    			row = sheet.getRow(rowContent);
     
    			// Browsing the line and retrieves the columns
    			if (row != null) {
    				for (int columnContent = 0; columnContent < nbColumns; columnContent++) {
    					// Retrieves the cell and this value
    					cell = row.getCell((short) columnContent);
    					Object value = contentCell(cell);
     
    					obj[rowContent][columnContent] = value;
     
    					//the title
    					title[columnContent] = (String) obj[0][columnContent];
    				}
    			}
    		}
    		table.setModel(new DefaultTableModel(obj, title));
     
    		return table;
    	}

  7. #7
    Modérateur
    Avatar de joel.drigo
    Homme Profil pro
    Ingénieur R&D - Développeur Java
    Inscrit en
    Septembre 2009
    Messages
    12 430
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur R&D - Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2009
    Messages : 12 430
    Points : 29 131
    Points
    29 131
    Billets dans le blog
    2
    Par défaut
    Peut-être parce que tu leur donne une largeur de 0 :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Dimension size = new Dimension(0,50);
    elevator.setPreferredSize(size);

  8. #8
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    Pas faux !
    Dernière question :
    Selon le fichier excel que j'appelle il me dit ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
     
    Exception in thread "AWT-EventQueue-0" org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:65)
    	at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:601)
    	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:174)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:249)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:302)
    	at EVENT.UtilityMethods.createTabPanel(UtilityMethods.java:108)
    	at EVENT.UtilityMethods.createJTabbed(UtilityMethods.java:73)
    	at EVENT.ActionEvents.btnLoad_click(ActionEvents.java:64)
    	at EVENT.ActionEvents.actionPerformed(ActionEvents.java:35)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
    	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
    	at javax.swing.JComponent.processKeyBindings(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:62)
    	... 52 more
    Caused by: java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data. This may indicate that the file is used to inflate memory usage and thus could pose a security risk. You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Counter: 827392, cis.counter: 8192, ratio: 0.009900990099009901Limits: MIN_INFLATE_RATIO: 0.01
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.advance(ZipSecureFile.java:258)
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:215)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.fillByteBuffer(XMLStreamReader.java:209)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.access$600(XMLStreamReader.java:35)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader$FastStreamDecoder.read(XMLStreamReader.java:758)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.read(XMLStreamReader.java:162)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yy_refill(PiccoloLexer.java:3477)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yynextChar(PiccoloLexer.java:3725)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseCdataLiteral(PiccoloLexer.java:3036)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseQuotedTagValue(PiccoloLexer.java:2936)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseAttributesNS(PiccoloLexer.java:1754)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseOpenTagNS(PiccoloLexer.java:1521)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1362)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4682)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
    	at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264)
    	at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    	at org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:92)
    	at org.openxmlformats.schemas.spreadsheetml.x2006.main.StyleSheetDocument$Factory.parse(Unknown Source)
    	at org.apache.poi.xssf.model.StylesTable.readFrom(StylesTable.java:203)
    	at org.apache.poi.xssf.model.StylesTable.<init>(StylesTable.java:146)
    	... 58 more
    Exception in thread "AWT-EventQueue-0" org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:65)
    	at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:601)
    	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:174)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:249)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:302)
    	at EVENT.UtilityMethods.createTabPanel(UtilityMethods.java:108)
    	at EVENT.UtilityMethods.createJTabbed(UtilityMethods.java:73)
    	at EVENT.ActionEvents.btnLoad_click(ActionEvents.java:64)
    	at EVENT.ActionEvents.actionPerformed(ActionEvents.java:35)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
    	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
    	at javax.swing.JComponent.processKeyBindings(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:62)
    	... 52 more
    Caused by: java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data. This may indicate that the file is used to inflate memory usage and thus could pose a security risk. You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Counter: 827392, cis.counter: 8192, ratio: 0.009900990099009901Limits: MIN_INFLATE_RATIO: 0.01
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.advance(ZipSecureFile.java:258)
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:215)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.fillByteBuffer(XMLStreamReader.java:209)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.access$600(XMLStreamReader.java:35)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader$FastStreamDecoder.read(XMLStreamReader.java:758)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.read(XMLStreamReader.java:162)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yy_refill(PiccoloLexer.java:3477)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yynextChar(PiccoloLexer.java:3725)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseCdataLiteral(PiccoloLexer.java:3036)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseQuotedTagValue(PiccoloLexer.java:2936)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseAttributesNS(PiccoloLexer.java:1754)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseOpenTagNS(PiccoloLexer.java:1521)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1362)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4682)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
    	at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264)
    	at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    	at org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:92)
    	at org.openxmlformats.schemas.spreadsheetml.x2006.main.StyleSheetDocument$Factory.parse(Unknown Source)
    	at org.apache.poi.xssf.model.StylesTable.readFrom(StylesTable.java:203)
    	at org.apache.poi.xssf.model.StylesTable.<init>(StylesTable.java:146)
    	... 58 more
    Exception in thread "AWT-EventQueue-0" org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:65)
    	at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:601)
    	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:174)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:249)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:302)
    	at EVENT.UtilityMethods.createTabPanel(UtilityMethods.java:108)
    	at EVENT.UtilityMethods.createJTabbed(UtilityMethods.java:73)
    	at EVENT.ActionEvents.btnLoad_click(ActionEvents.java:64)
    	at EVENT.ActionEvents.actionPerformed(ActionEvents.java:35)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
    	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
    	at javax.swing.JComponent.processKeyBindings(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:62)
    	... 52 more
    Caused by: java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data. This may indicate that the file is used to inflate memory usage and thus could pose a security risk. You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Counter: 827392, cis.counter: 8192, ratio: 0.009900990099009901Limits: MIN_INFLATE_RATIO: 0.01
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.advance(ZipSecureFile.java:258)
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:215)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.fillByteBuffer(XMLStreamReader.java:209)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.access$600(XMLStreamReader.java:35)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader$FastStreamDecoder.read(XMLStreamReader.java:758)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.read(XMLStreamReader.java:162)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yy_refill(PiccoloLexer.java:3477)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yynextChar(PiccoloLexer.java:3725)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseCdataLiteral(PiccoloLexer.java:3036)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseQuotedTagValue(PiccoloLexer.java:2936)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseAttributesNS(PiccoloLexer.java:1754)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseOpenTagNS(PiccoloLexer.java:1521)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1362)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4682)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
    	at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264)
    	at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    	at org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:92)
    	at org.openxmlformats.schemas.spreadsheetml.x2006.main.StyleSheetDocument$Factory.parse(Unknown Source)
    	at org.apache.poi.xssf.model.StylesTable.readFrom(StylesTable.java:203)
    	at org.apache.poi.xssf.model.StylesTable.<init>(StylesTable.java:146)
    	... 58 more
    Exception in thread "AWT-EventQueue-0" org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:65)
    	at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:601)
    	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:174)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:249)
    	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:302)
    	at EVENT.UtilityMethods.createTabPanel(UtilityMethods.java:108)
    	at EVENT.UtilityMethods.createJTabbed(UtilityMethods.java:73)
    	at EVENT.ActionEvents.btnLoad_click(ActionEvents.java:64)
    	at EVENT.ActionEvents.actionPerformed(ActionEvents.java:35)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener$Actions.actionPerformed(Unknown Source)
    	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
    	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
    	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
    	at javax.swing.JComponent.processKeyBindings(Unknown Source)
    	at javax.swing.JComponent.processKeyEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$000(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.awt.EventQueue$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    	at java.lang.reflect.Constructor.newInstance(Unknown Source)
    	at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)
    	at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:62)
    	... 52 more
    Caused by: java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data. This may indicate that the file is used to inflate memory usage and thus could pose a security risk. You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Counter: 827392, cis.counter: 8192, ratio: 0.009900990099009901Limits: MIN_INFLATE_RATIO: 0.01
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.advance(ZipSecureFile.java:258)
    	at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:215)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.fillByteBuffer(XMLStreamReader.java:209)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.access$600(XMLStreamReader.java:35)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader$FastStreamDecoder.read(XMLStreamReader.java:758)
    	at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.read(XMLStreamReader.java:162)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yy_refill(PiccoloLexer.java:3477)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yynextChar(PiccoloLexer.java:3725)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseCdataLiteral(PiccoloLexer.java:3036)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseQuotedTagValue(PiccoloLexer.java:2936)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseAttributesNS(PiccoloLexer.java:1754)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseOpenTagNS(PiccoloLexer.java:1521)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1362)
    	at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4682)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
    	at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
    	at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277)
    	at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264)
    	at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    	at org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:92)
    	at org.openxmlformats.schemas.spreadsheetml.x2006.main.StyleSheetDocument$Factory.parse(Unknown Source)
    	at org.apache.poi.xssf.model.StylesTable.readFrom(StylesTable.java:203)
    	at org.apache.poi.xssf.model.StylesTable.<init>(StylesTable.java:146)
    	... 58 more
    J'ai cru comprendre que c'est à cause de la taille du fichier mais je suis pas sûr, et si c'est le cas comment y remédier ?

  9. #9
    Modérateur
    Avatar de joel.drigo
    Homme Profil pro
    Ingénieur R&D - Développeur Java
    Inscrit en
    Septembre 2009
    Messages
    12 430
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 55
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur R&D - Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2009
    Messages : 12 430
    Points : 29 131
    Points
    29 131
    Billets dans le blog
    2
    Par défaut
    Il vient d'où ce fichier ? Parce qu'une ZipBomb c'est n'est pas normal (certains fichiers malveillants utilisent cette technique): c'est une configuration de compression dont on estime qu'elle va consommer tellement de ressources pour décompresser, que ça risque de provoquer un gel de la machine, ou un dépassement de mémoire.

    On peut ajuster ce paramètre au besoin, comme indiqué dans le message d'erreur :
    You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit. Counter: 827392, cis.counter: 8192, ratio: 0.009900990099009901Limits: MIN_INFLATE_RATIO: 0.01

  10. #10
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    C'est un fichier XLSX qui fait 3,23 Mo sur le disque, et il n'est pas protégé... C'est étrange que ça fasse ça !
    Tant pis, je vais mettre le "ZipSecureFile.setMinInflateRatio()" alors.

  11. #11
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    J'ai fait un :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    double ratio = 0.009900990099009901;
    ZipSecureFile.setMinInflateRatio(ratio);
    dans le main, est toujours le même message, faut-il que je le mette ailleurs ?

  12. #12
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2016
    Messages
    213
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2016
    Messages : 213
    Points : 96
    Points
    96
    Par défaut
    Dis moi je souhaite faire un table.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    Je l'ai mis là où je crée mon JTable.
    Mais mon curseur ne fait rien :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
     
    public JTable createJTableWithExcel(XSSFSheet sheet) {
    		// Create new table
    		JTable table = new JTable();
    		// Reading the excel file
    		// Count the line number
    		int nbRows = sheet.getLastRowNum();
    		// Count the column number
    		int nbColumns = numberMaxColumn(sheet);
    		/*
    		System.out.println("In the sheet " + sheet.getSheetName()
    				+ " there are " + nbRows + " lines and " + nbColumns
    				+ " columns");
    		*/
    		// Create new object array
    		Object[][] obj = new Object[nbRows][nbColumns];
     
    		// Array header
    		String[] title = new String[nbColumns];
    		// Browsing the sheet and retrieves the lines one by one
    		for (int rowContent = 0; rowContent < nbRows; rowContent++) {
    			row = sheet.getRow(rowContent);
     
    			// Browsing the line and retrieves the columns
    			if (row != null) {
    				for (int columnContent = 0; columnContent < nbColumns; columnContent++) {
    					// Retrieves the cell and this value
    					cell = row.getCell((short) columnContent);
    					Object value = contentCell(cell);
     
    					obj[rowContent][columnContent] = value;
     
    					//the title
    					title[columnContent] = (String) obj[0][columnContent];
    					for (String str : title) {
    						System.out.println(str);
    					}
    				}
    			}
    		}
    		//A wait cursor
    		table.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    		table.setModel(new DefaultTableModel(obj, title));
     
    		return table;
    	}

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 3
    Dernier message: 04/11/2014, 16h01
  2. largeur des sous-menu automatique en css
    Par luffyfr dans le forum Mise en page CSS
    Réponses: 3
    Dernier message: 14/04/2010, 18h19
  3. Réponses: 3
    Dernier message: 04/05/2009, 12h35
  4. Générer des sous-domaines automatiquement
    Par cyclopsnet dans le forum Apache
    Réponses: 6
    Dernier message: 23/02/2009, 08h53
  5. Réponses: 2
    Dernier message: 20/05/2008, 10h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo