Autor Beitrag
mk2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Mo 27.12.04 14:18 
Hallo Leute,

ist zwar eigentlich ne Java Frage (deshalb auch OT) aber ich dachte hier sind so viele kompetente Leute, da kann mir bestimmt einer helfen :) . Wie kann ich bei nem Java Applet eine Meldung in einem kleinem Messagefenster ausgeben, also was ich bei Delphi z.B. mit ShowMessage('Hallo'); machen würde ? Geht das auch mehrzeilig ?

MfG mk2
Spatz
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

WIN 2k
D7E
BeitragVerfasst: Mo 27.12.04 14:36 
schau dir mal JOptionPane an... (gibt noch viele andere bereits vordefinierte Message-Dialoge
ausblenden Quelltext
1:
public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType)					


Wobei messageType folgende Werte haben kann: INFORMATION_MESSAGE, QUESTION_MESSAGE, WARNING_MESSAGE, ERROR_MESSAGE, PLAIN_MESSAGE

für mehrzeilig:

in delphi: s := '1.Linie' + #13 + #10 + '2.Linie'
in java: s = "1.Linie" + '\n' + '\r' + "2.Linie"
mk2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Mo 27.12.04 15:03 
dankeschön ...
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Mo 27.12.04 15:16 
[quote="Spatz"in java: s = "1.Linie" + '\n' + '\r' + "2.Linie"[/quote]


Äh, wieso denn nicht:
ausblenden Quelltext
1:
s = "1. Line\n\r2.Line";					


Und \n\r ist auch eine seltsame Reihenfolge, meintest \r\n (Windows) oder war das Absicht? Ist sowieso doof bei Java, da ist man schon plattformunabhängig, überlässt es dem Programmierer aber, die (plattfrkamabhängingen) Zeilenumbrüche richtig zu bestimmen...
Deshalb nach Möglichkeit immer xxxLn benutzen.

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind