PopUp-Fenster ? Gibts das?

  • Themenstarter Themenstarter olaf
  • Beginndatum Beginndatum
Status
Nicht offen für weitere Antworten.
O

olaf

Gast
Sers,
ich komme von der Vb SChiene und wunder mich, das er keine masbox kennt 🙁

gibt es soetwas ähnliches in java2 ?

LG Olaf aus München
 
sorry, ja, eine msgbox wie in vb

also son kleines popup fenster, was ich einstellen kann (welche buttons, welche aktionen auf welchen buttons, welche meldung...)
 
bummerland hat gesagt.:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JOptionPane.html
hm...werd nicht ganz schlau draus..er kann mit "frame" nichts anfangen...über strg+shift+O sind alle nötigen libarys eingebunden, weiß also nicht woran es liegt 🙁
 
olaf hat gesagt.:
bummerland hat gesagt.:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JOptionPane.html
hm...werd nicht ganz schlau draus..er kann mit "frame" nichts anfangen...über strg+shift+O sind alle nötigen libarys eingebunden, weiß also nicht woran es liegt 🙁

Aus diesen Sätzen wird auch niemand schlau.

Was genau ist deine Situation und wo liegt das Problem?
 
Vielleicht sollte man es einfach mit nem super() versuchen, somit hat er schonmal das Fenster und kann sich JButtons und JFrames erstellen so viel wie er will / brauch!?

mfg
m3D
 
AlArenal hat gesagt.:
Was genau ist deine Situation und wo liegt das Problem?
das problem liegt dabei, das ich mit diesem PopUp-Fenster von Java nicht ganz zurecht komme.

Code:
						JOptionPane.showMessageDialog(frame,
					    "Eggs aren't supposed to be green.");
das hab ich mir von dem link gezogen. ich arbeite mit swt, deswegen finde ich es schon "merkwürdig" dass das optionpane ein swing import ist :"import javax.swing.JOptionPane;"

mein problem liegt gerade an dem "frame", was in meinem code-tag zu sehen ist. "frame cannot be resolved"
habe versucht den namen der Shell dort einzufügen, doch das kam aufs selbe hinaus.doch auf dieser seite
http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html
finde ich nichts, wie ich das mit dem "frame" lösen kann..

ich wollte hier eigentlich nur wissen, wie ich (ähnlich wie in vb) messege PopUps erstelle und auswerte, sorry für schlechte formulierungen
 
Anonymous hat gesagt.:
. . .
arbeite mit swt
. . .


Ich denke, du suchst das hier:

PopupDialog(Shell parent, int shellStyle, boolean takeFocusOnOpen, boolean persistBounds, boolean showDialogMenu, boolean showPersistAction, String titleText, String infoText) ;

. . .

Parameters:
parent - The parent shell.
shellStyle - The shell style.
takeFocusOnOpen - A boolean indicating whether focus should be taken by this popup when it opens.
persistBounds - A boolean indicating whether the bounds should be persisted upon close of the dialog. The bounds can only be persisted if the dialog settings for persisting the bounds are also specified. If a menu action will be provided that allows the user to control this feature, then the last known value of the user's setting will be used instead of this flag.
showDialogMenu - A boolean indicating whether a menu for moving and resizing the popup should be provided.
showPersistAction - A boolean indicating whether an action allowing the user to control the persisting of the dialog bounds should be shown in the dialog menu. This parameter has no effect if showDialogMenu is false.
titleText - Text to be shown in an upper title area, or null if there is no title.
infoText - Text to be shown in a lower info area, or null if there is no info area.

edited by bummerland: hier sind quote-tags besser ;-)
 
sliwalker hat gesagt.:
Probier mal...

Code:
JOptionPane.showMessageDialog(null, 
                   "Eggs aren't supposed to be green.");

greetz
SLi

cool, danke, aber woran lags? also sag jetzt nicht an "null", sondern erklär mir bitte, warum ich dort null statt etwas anderes eingeben musste? null hat ja ne sonderstellung in java
 
wenn du swt nimmst, solltest du die methode von flanker benutzen.
bei showMessageDialog ist der erste parameter das fenster, das den dialog aufgeruft. dadurch ist der dialog dann modal. wenn man null übergibt ist der dialog eben nicht modal.
 
Hoi,

ja mit swt arbeite ich nicht sorry.

null funktioniert hier so wie mein Vorredner beschrieben hat.
Wenn man den Dialog in einem JFrame oder Frame aufruft, so übergibt man "this".

greetz
SLi
 
bummerland hat gesagt.:
wenn du swt nimmst, solltest du die methode von flanker benutzen.
bei showMessageDialog ist der erste parameter das fenster, das den dialog aufgeruft. dadurch ist der dialog dann modal. wenn man null übergibt ist der dialog eben nicht modal.
das von flanker funktioniert nicht. er kennt popup.dialog nicht! und was meinst du mit modal? würde es gerne an meine MeinForm "anklemmen", doch weiß ja nicht wie 😉
 
Anonymous hat gesagt.:
bummerland hat gesagt.:
wenn du swt nimmst, solltest du die methode von flanker benutzen.
bei showMessageDialog ist der erste parameter das fenster, das den dialog aufgeruft. dadurch ist der dialog dann modal. wenn man null übergibt ist der dialog eben nicht modal.
das von flanker funktioniert nicht. er kennt popup.dialog nicht! und was meinst du mit modal? würde es gerne an meine MeinForm "anklemmen", doch weiß ja nicht wie 😉

Modal heißt, dass das Programm nicht weiterläuft, bis der Dialog beendet wird. Also das was Du als "anklemmen" bezeichnest, wenn ich das richtig deute 😉

greetz
SLi
 
hatte mich verguckt, dachte du nutzt swt. :-/
du musst als erstes argument eben dein JFrame oder womit auch immer du den dialog aufrufst übergeben. wenn das aus der klasse geschieht, eben mit this. modal heisst, dass der dialog dann immer im vordergrund ist.
 
bummerland hat gesagt.:
hatte mich verguckt, dachte du nutzt swt. :-/
du musst als erstes argument eben dein JFrame oder womit auch immer du den dialog aufrufst übergeben. wenn das aus der klasse geschieht, eben mit this. modal heisst, dass der dialog dann immer im vordergrund ist.
ich arbeite auch mit swt, jedenfalls soweit das möglich ist..doch son joptionpane gibbet wohl im swt nicht...deswegen mischmasch..
ist denn swt so schlimm??dahcte das wäre das neuere, im gegensatz zu swing und awt... 🙁

der dialog steht im quelltext auch in einer klasse, in der klasse, wo die shell kreiert wird...doch this() kennt er auch nicht...versteh das alles nciht wirklich...finde ja gut das es mit null geht, aber wenn es so ist, wie ihr sagt, und es somit nicht modal ist, und das programm im hintergrund weiterläuft...was es aber nicht soll..

ich fühl mich voll blöd :cry:
 
SWT entstand zwar nach Swing, aber deswegen muss nicht "besser" sein. Es gilt als nicht so umfangreich und flexibel wie Swing. Existenzberechtigung erhält es hauptsächlich in Zusammenhang mit dem Eclipse Projekt.
 
also sollte ich auf swing umsteigen? hatte swt nur gewählt, um ne evtl standalone anwendung zu schreiben, doch das hat sich im laufe erledigt, da das programm später über ne batch aufgerufen werden soll...
 
nicht this() sondern this.
Und die Klasse, in der Du das OptionePane aufrufst, welchen Typ hat die? Nu zeig doch bitte mal ein Stück zusammenhängenden Code´😉
 
Anonymous hat gesagt.:
doch son joptionpane gibbet wohl im swt nicht...deswegen mischmasch..

dir wurde bereits geantwortet:

flanker hat gesagt.:
Ich denke, du suchst das hier:

PopupDialog(Shell parent, int shellStyle, boolean takeFocusOnOpen, boolean persistBounds, boolean showDialogMenu, boolean showPersistAction, String titleText, String infoText) ;

. . .

Parameters:
parent - The parent shell.
shellStyle - The shell style.
takeFocusOnOpen - A boolean indicating whether focus should be taken by this popup when it opens.
persistBounds - A boolean indicating whether the bounds should be persisted upon close of the dialog. The bounds can only be persisted if the dialog settings for persisting the bounds are also specified. If a menu action will be provided that allows the user to control this feature, then the last known value of the user's setting will be used instead of this flag.
showDialogMenu - A boolean indicating whether a menu for moving and resizing the popup should be provided.
showPersistAction - A boolean indicating whether an action allowing the user to control the persisting of the dialog bounds should be shown in the dialog menu. This parameter has no effect if showDialogMenu is false.
titleText - Text to be shown in an upper title area, or null if there is no title.
infoText - Text to be shown in a lower info area, or null if there is no info area.
 
Roar hat gesagt.:
Anonymous hat gesagt.:
doch son joptionpane gibbet wohl im swt nicht...deswegen mischmasch..

dir wurde bereits geantwortet:

flanker hat gesagt.:
Ich denke, du suchst das hier:

PopupDialog(Shell parent, int shellStyle, boolean takeFocusOnOpen, boolean persistBounds, boolean showDialogMenu, boolean showPersistAction, String titleText, String infoText) ;

. . .

Parameters:
parent - The parent shell.
shellStyle - The shell style.
takeFocusOnOpen - A boolean indicating whether focus should be taken by this popup when it opens.
persistBounds - A boolean indicating whether the bounds should be persisted upon close of the dialog. The bounds can only be persisted if the dialog settings for persisting the bounds are also specified. If a menu action will be provided that allows the user to control this feature, then the last known value of the user's setting will be used instead of this flag.
showDialogMenu - A boolean indicating whether a menu for moving and resizing the popup should be provided.
showPersistAction - A boolean indicating whether an action allowing the user to control the persisting of the dialog bounds should be shown in the dialog menu. This parameter has no effect if showDialogMenu is false.
titleText - Text to be shown in an upper title area, or null if there is no title.
infoText - Text to be shown in a lower info area, or null if there is no info area.

und ich habe drauf reagiert!!das es nicht funktioniert!

ich werde morgen erstmal alles nochmal im swing machen, und dann meld ich mich nochmal 😉 (mit code^^)
 
Status
Nicht offen für weitere Antworten.

Zurück
Oben