tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
0
ZUGRIFFE
315
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Avatar von mtk-flo
    mtk-flo mtk-flo ist offline Mitglied Gold
    Registriert seit
    Jan 2005
    Ort
    Hessen
    Beiträge
    192
    Hallo,

    ich habe eine HauptShell, in der ich alles anzeige, was für den User wichtig ist.
    Nun möchte ich eine AdminShell öffnen, in der Administratoren Dinge eingeben können.
    Jedoch bekomm ich es nicht hin, dass die AdminShell geöffnet wird.

    Hier ist ein Teil von meinem Code:

    Konstruktor:
    Code :
    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
    
    [SIZE=2]
    [/SIZE][SIZE=2][COLOR=#0000c0]display[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] Display();
     
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] Shell([/SIZE][SIZE=2][COLOR=#0000c0]display[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff]"Prüfungskatalog"[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].setSize(800, 600); 
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].setLocation(50, 50);
     
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminShell[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] Shell([/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminShell[/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff]"Prüfungskatalog"[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminShell[/COLOR][/SIZE][SIZE=2].setSize(600, 400);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminShell[/COLOR][/SIZE][SIZE=2].setLocation(100, 100);
    [/SIZE] 
    [SIZE=2][/SIZE][SIZE=2][COLOR=#0000c0]menuBar[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] Menu([/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2], SWT.[/SIZE][I][SIZE=2][COLOR=#0000c0]BAR[/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][/SIZE][SIZE=2][COLOR=#0000c0]katalogMenuHeader[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] MenuItem([/SIZE][SIZE=2][COLOR=#0000c0]menuBar[/COLOR][/SIZE][SIZE=2], SWT.[/SIZE][I][SIZE=2][COLOR=#0000c0]CASCADE[/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogMenuHeader[/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff]"&Prüfungskatalog"[/COLOR][/SIZE][SIZE=2]); 
    [/SIZE][/COLOR][/SIZE][SIZE=2]
    [/SIZE]
    [SIZE=2][/SIZE][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE] 
    [SIZE=2][COLOR=#0000c0]katalogMenu[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] Menu([/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2], SWT.[/SIZE][I][SIZE=2][COLOR=#0000c0]DROP_DOWN[/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogMenuHeader[/COLOR][/SIZE][SIZE=2].setMenu([/SIZE][SIZE=2][COLOR=#0000c0]katalogMenu[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogOpenItem[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] MenuItem([/SIZE][SIZE=2][COLOR=#0000c0]katalogMenu[/COLOR][/SIZE][SIZE=2], SWT.[/SIZE][I][SIZE=2][COLOR=#0000c0]PUSH[/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogOpenItem[/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff]"Ansehen"[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogOpenItem[/COLOR][/SIZE][SIZE=2].addSelectionListener([/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] katalogShowItemListener());
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminItem[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] MenuItem([/SIZE][SIZE=2][COLOR=#0000c0]katalogMenu[/COLOR][/SIZE][SIZE=2], SWT.[/SIZE][I][SIZE=2][COLOR=#0000c0]PUSH[/COLOR][/SIZE][/I][SIZE=2][COLOR=#0000c0][/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminItem[/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff]"Administration"[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminItem[/COLOR][/SIZE][SIZE=2].addSelectionListener([/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] katalogAdminItemListener());[/SIZE]
    [SIZE=2][/SIZE] 
    [SIZE=2][SIZE=2][/SIZE][SIZE=2][COLOR=#3f7f5f]// Menu anzeigen
    [/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].setMenuBar([/SIZE][SIZE=2][COLOR=#0000c0]menuBar[/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#3f7f5f]// shell anzeigen
    [/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].open();
     
    [/SIZE][SIZE=2][COLOR=#3f7f5f]// Warten bis shell geschlossen wird
    [/COLOR][/SIZE][SIZE=2][/SIZE][B][SIZE=2][COLOR=#7f0055]while[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2](![/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].isDisposed()) {
    [/SIZE][SIZE=2][COLOR=#3f7f5f]// Prüfe ob Ereignisse warten
    [/COLOR][/SIZE][SIZE=2][/SIZE][B][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2](![/SIZE][SIZE=2][COLOR=#0000c0]display[/COLOR][/SIZE][SIZE=2].readAndDispatch())
    [/SIZE][SIZE=2][COLOR=#0000c0]display[/COLOR][/SIZE][SIZE=2].sleep();
    }
    [/SIZE][/SIZE]

    Der katalogAdminItemListener:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    [SIZE=2]
    [/SIZE][B][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] katalogAdminItemListener [/SIZE][B][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] baummenu [/SIZE][B][SIZE=2][COLOR=#7f0055]implements[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] SelectionListener {
    [/SIZE][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055] void[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] widgetSelected(SelectionEvent event) {
     
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminShell[/COLOR][/SIZE][SIZE=2].open();
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].setEnabled([/SIZE][B][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2]);
     
    [/SIZE][B][SIZE=2][COLOR=#7f0055]while[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2](![/SIZE][SIZE=2][COLOR=#0000c0]katalogAdminShell[/COLOR][/SIZE][SIZE=2].isDisposed()) {
    [/SIZE][SIZE=2][COLOR=#3f7f5f]// Prüfe ob Ereignisse warten
    [/COLOR][/SIZE][SIZE=2][/SIZE][B][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2](![/SIZE][SIZE=2][COLOR=#0000c0]display[/COLOR][/SIZE][SIZE=2].readAndDispatch()) {
    [/SIZE][SIZE=2][COLOR=#0000c0]display[/COLOR][/SIZE][SIZE=2].sleep();
    }
    }
     
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].setEnabled([/SIZE][B][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2]);
    [/SIZE][SIZE=2][COLOR=#0000c0]katalogShell[/COLOR][/SIZE][SIZE=2].setFocus(); 
     
    }
     
    [/SIZE][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] [/SIZE][B][SIZE=2][COLOR=#7f0055] void[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] widgetDefaultSelected(SelectionEvent event) {
    [/SIZE][SIZE=2][COLOR=#3f7f5f]// leer
    [/COLOR][/SIZE][SIZE=2]}
    } 
    [/SIZE]

    Was mach ich falsch?
    Geändert von mtk-flo (11.12.06 um 10:38 Uhr)
     

Ähnliche Themen

  1. Fehlendes Verständniss von Shells
    Von JB4You im Forum Swing, Java2D/3D, SWT, JFace
    Antworten: 1
    Letzter Beitrag: 23.05.08, 16:37
  2. Shells
    Von exitboy im Forum Linux & Unix
    Antworten: 2
    Letzter Beitrag: 18.02.06, 23:37
  3. mehrere URL's per Batch öffnen
    Von loddarmattheus im Forum Microsoft Windows
    Antworten: 2
    Letzter Beitrag: 18.05.05, 10:23
  4. Problem mit mehreren Shells und dispose
    Von MrSado im Forum Swing, Java2D/3D, SWT, JFace
    Antworten: 0
    Letzter Beitrag: 14.01.05, 18:11
  5. Warum werden die Shells minimiert?
    Von Joghurt im Forum Swing, Java2D/3D, SWT, JFace
    Antworten: 0
    Letzter Beitrag: 06.10.04, 11:47