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
| public static int createMessageBox(String title, Icon icone, String message, int buttons)
{
DialogBox d = new DialogBox();
d.text = message.split("\n");
d.title = title;
d.icone = icone;
d.btn = buttons;
Main.getInstance().setModal(d);
Main.getInstance().addWindow(d);
d.initialize();
EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
long lastStringUpdt = System.currentTimeMillis();
System.out.println(Thread.currentThread());
//Now on boucle:
while(d.exit == 0)
{
try
{
AWTEvent e = eq.getNextEvent();
if(e.getSource() instanceof Component)
((Component)e.getSource()).dispatchEvent(e);
else
Main.getInstance().getParent().dispatchEvent(e);
if(System.currentTimeMillis() - lastStringUpdt > 20)
{
Main.getInstance().repaint();
lastStringUpdt = System.currentTimeMillis();
}
Thread.sleep(1);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
d.dispose();
System.out.println("Test");
return d.exit;
} |
Partager