kokyo Geschrieben 1. November 2005 Geschrieben 1. November 2005 Hallo! Ich habe zwar schon eine recht weite Erfahrung als Programmierer, steige aber gerade neu in Java ein. Langsam fange ich auch an, es sogar ein wenig zu mögen Aber nun gibts ein Problem, bei dem ich nicht weiterkomme: Ich weiss nicht, wie und ob ich ein Fenster(z.B. basierend auf JFrame) modal anzeigen lassen kann. Hat hier jemand einen Rat für mich? Vielen Dank kokyo
Jaraz Geschrieben 1. November 2005 Geschrieben 1. November 2005 Hi, musst du tatsächlich zwischen 2 kompletten Anwendungsfenstern springen oder könnte es sein das ein JDialog, den du durchaus modal setzen kannst, reicht? http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html Gruß Jaraz
kokyo Geschrieben 1. November 2005 Autor Geschrieben 1. November 2005 Danke schonmal für den Vorschlag. Ich will einen Assistenten schreiben - also schon etwas komplexeres - der modal über dem Hauptfenster der Anwendung eingeblendet wird. Ich werde mich gleich heute Abend mal dransetzen und gucken, ob sowas mit JDialog möglich ist.
perdian Geschrieben 2. November 2005 Geschrieben 2. November 2005 Aber nun gibts ein Problem, bei dem ich nicht weiterkomme: Ich weiss nicht, wie und ob ich ein Fenster(z.B. basierend auf JFrame) modal anzeigen lassen kann.JFrame selbst bietet keine Möglichkeit an auf modal gesetzt zu werden. Du könntest JFrame auf alwaysOnTop setzen, aber die einzige Möglichkeit für wirklich modale Dialoge bietet JDialog.
ksg9-sebastian Geschrieben 2. November 2005 Geschrieben 2. November 2005 Schau dir mal das hier an: http://java.sun.com/developer/technicalArticles/GUI/swing/wizard/
Gast -andmaN Geschrieben 20. Dezember 2005 Geschrieben 20. Dezember 2005 Du könntest JFrame auf alwaysOnTop setzen,... Hey! Wie meinst du das genau ... bzw. wie realisiere ich das "alwaysOnTop"??? Thxs...
ksg9-sebastian Geschrieben 20. Dezember 2005 Geschrieben 20. Dezember 2005 Richtiges "always on top"-Verhalten geht in Java nicht. Erzeuge einfach einen Dialog mit deinem JFrame als Owner, dann noch modal setzen (setModal(true)) und gut ist. Oder du schaust dir gleich das Wizard-Framework an dass ich in meinem letzten Beitrag gelinkt hab. Gruß
Gast -andmaN Geschrieben 20. Dezember 2005 Geschrieben 20. Dezember 2005 Vielen Dank für die schnelle Antwort, ABER: Ich will nur mein Frame "allways-on-top" haben... Ich will keine Dialoge... .
perdian Geschrieben 20. Dezember 2005 Geschrieben 20. Dezember 2005 wie realisiere ich das "alwaysOnTop"Gelgentlich hilft es einem enorm weiter sich tatsächlich einmal mit der Dokumentation der Java Klassenbibliothek zu beschäftigen: public final void setAlwaysOnTop(boolean alwaysOnTop) throws SecurityException Changes the always-on-top window state. An always-on-top window is a window that stays above all other windows except maybe other always-on-top windows. If there are several always-on-top windows the order in which they stay relative to each other is not specified and is platform dependent. If some other window already is always-on-top then the relative order between these windows is unspecified (depends on platform). No window can be brought to be over always-on-top window except maybe another always-on-top window. All owned windows of an always-on-top window automatically become always-on-top windows. If a window ceases to be always-on-top its owned windows cease to be always-on-top. When an always-on-top window is sent toBack its always-on-top state is set to false. This method makes the window always-on-top if alwaysOnTop is true. If the window is visible, this includes bringing window toFront, then "sticking" it to the top-most position. If the window is not visible it does nothing other than setting the always-on-top property. If later the window is shown, it will be always-on-top. If the Window is already always-on-top, this call does nothing. If alwaysOnTop is false this method changes the state from always-on-top to normal. The window remains top-most but its z-order can be changed in the normal way as for any other window. Does nothing if this Window is not always-on-top. Has no effect on relative z-order of windows if there are no other always-on-top windows. Note: some platforms might not support always-on-top windows. There is no public API to detect if the platform supports always-on-top at runtime. If a SecurityManager is installed, the calling thread must be granted the AWTPermission "setWindowAlwaysOnTop" in order to set the value of this property. If this permission is not granted, this method will throw a SecurityException, and the current value of the property will be left unchanged. Parameters: alwaysOnTop - new value of always-on-top state of the window Throws: SecurityException - if the calling thread does not have permission to set the value of always-on-top property Since: 1.5
Gast -andmaN Geschrieben 20. Dezember 2005 Geschrieben 20. Dezember 2005 Jaja, is schon klar ... hab sie sogar als Hilfe-Dienst ... :eek ABER: Ich muss das Ding leider noch in 1.4.2 implementieren! *nörv* ...
perdian Geschrieben 20. Dezember 2005 Geschrieben 20. Dezember 2005 Ich muss das Ding leider noch in 1.4.2 implementieren!Dann ist es ganz einfach: Geht nicht!
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren
Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde Dich hier an.
Jetzt anmelden