Combobox with present mode


i have an app that is quite ok; it s a very long and complicated thing but it runs, through a server and with multiple clients && rooms.

I have tested it in a lot of situations; as everything looks fine now i try to export it. If i export it “normally” not any (new!) problem; but i would like (for desktops) to export in present mode.
But if i do so i get a lot of big problems because the app is using multiple JComboBoxes (!editable) with lists (of players, of rooms…); so = if i set the JCombo loc outside of the app i get (MACOSX, sierra) a kernel panic and must restart the computer… but that is not done because even after restarting the app is always here and blockink every action or menu…Of course the stop button does not work…Solution is restarting again and using command line delete the app: not very confortable! -
After that i decided to give to my combos a location inside the app: no more krash and the combos appear at the beginning…Super! except that when you click on the app (and it s needed!) the combos disappear behind the app and i cannot see how to put them in front of the main window. I suppose that all these things are caused by the way P5 makes its present mode (A JFrame???) - anyway my question is : is it possible to use combo (or other java elements like that) with present mode P5. BTW that is probably a question for Peter Lager…
Below a code snippet in order to experiment. Dont change the loc of the combo if you want to avoid the kernel panick!

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JComboBox;
import javax.swing.JPanel;

JComboBox comboConnectes;
String[] items = {"one", "two", "three"};
JFrame frame;
float xcombo =0;

import java.util.Iterator;
import java.util.HashSet;

void setup(){
  xcombo = (displayWidth/2)-612;

public void creeCombo() {
  comboConnectes = new JComboBox(items);
  comboConnectes.setBounds(5, 5, 140, 30);
  Color colo =new Color(175,104,12);
  comboConnectes.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent event) {
      JComboBox<String> combo = (JComboBox<String>) event.getSource();
      String selectedJoueur = (String) combo.getSelectedItem();
      println("le joueur choisi est====" + selectedJoueur);
  frame = new JFrame ();
  frame.setPreferredSize(new Dimension(150, 600));
  frame.setContentPane(new PanelFond());
  frame.add (comboConnectes );
  frame.pack ();
  frame.setLocation(int(xcombo+210), 140);
  frame.setVisible ( true );

public class PanelFond extends JPanel
Image image;
   public PanelFond()
     try{ File(dataPath("")+"/combofondgris.png"));
     }catch (IOException e){
       println("je trouve pas l'image");
   public void paintComponent(Graphics g)
     g.drawImage (image, 0, 0, null); // elle doit etre avant
     //super.paintComponent(g); // lui il s'occupe de redessiner les composant enfant.

ps+++ sorry but my combo is using an image: the name(“combofondgris.png” and size are in the code and you can put what you want instead of mine


This sounds terrible! It also sounds like perhaps a Java / MacOS or Java / FreeBSD issue. Perhaps…?


thanks for replying (this topic has had only one answer: yours! - and yet, when it happens it s rather impressive…) - The first link you provided describes something which seems to be similar: necessity of restarting the computer and killing the process), yet it speaks about actions performed with the JCombo : in my case not any action is performed it s when the JCombo is created that the panic starts, in present mode && when i put its loc outside of the PApplet window: so i think that it could be of interest to look at this “present mode” more in details; as for now i suppose that it is a JFrame (with display size and loc(0,0) to which all other components are added. If it is i can understand what happens: when i put the JCombo inside the app window and before it, processing puts it behind and does not add it to the JFrame, so it disappears and is unreachable; and when i put it outside, as the JCombo is itself added to a JFrame, i suppose that there is some kind of incompatibility. If this is true what work around, i am thinking to that…


Glad that was helpful – good luck!

The issue may be in part that very few forum members mix using javax.swing with their Processing. Instead, they often use combo box elements from e.g. G4P or ControlP5.

It is also the case that a bug that causes a kernel panic isn’t something many people are excited to help test, unless they are core / library maintainers. In this case, it currently seems like this is likely a swing issue, not a Processing issue, so I also doubt you will be able to get much help from posting to Processing github issues (although you could always try) unless you have more information from inspecting the output. Even if there is a problem with the preprocessor, swing should NOT be kernel panicking…