Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Guten Abend,
Ich habe ein kleines Login System programmiert und jetzt benötige ich eure Hilfe. Denn ich würde es gerne so gestalten, dass es ein bestimmtes Passwort und ein bestimmter Username benötigt wird um, den Login Button zu betätigen. Mein folgender Code
 

public class Menü extends JFrame implements ActionListener {
    
    private JButton login;
    private JButton ende;
    
     public static void main(String [] args) {
         
         Menü frame = new Menü ("Menü");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setSize(400, 600);
         frame.setLocationRelativeTo(null);
         frame.setLayout(null);
         frame.setVisible(true);
         
    }
     
     public Menü (String title) {
         
         super(title);
         
         JTextField name = new JTextField("Username");
         name.setBounds(100, 200, 200, 35);
         name.setVisible(true);
         add(name);
         
         
         JPasswordField passwort = new JPasswordField("Password");
         passwort.setBounds(100, 260, 200, 35);
         passwort.setVisible(true);
         add(passwort);
         
         
         login = new JButton ("Login");
         login.setBounds(120, 420, 160, 40);
         login.addActionListener(this);
         login.setContentAreaFilled(false);
         add(login);
         
         ende = new JButton ("Ende");
         ende.setBounds(290, 510, 80, 40);
         ende.addActionListener(this);
         ende.setContentAreaFilled(false);
         add(ende);         
         
     }     
     
     public static void TT() {
         
         
         JFrame fenster = new JFrame("ToxTalk");
         fenster.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         fenster.setSize(1920, 1080);
         fenster.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
         fenster.setVisible(true);
        
         
    } 
    


    public void actionPerformed(ActionEvent e) {
        
    
        if(e.getSource() == login ) {
            
                TT();    
            
         }
         
         
         if(e.getSource() == ende) {
             System.exit(0);
         }
     }
        
    }
 

Womit willst Du denn das Passwort vergleichen?
Das Passwort müsste ja mit dem dazugehörigen Usernamen in irgendeiner Datenbank o.Ä. gespeichert sein.
Dann vergleichst Du den eingegebenen Passwortstring mit dem String, der in der Datenbank zu dem Usernamen steht. Ist der String der Gleiche, funktioniert der Login.

Bearbeitet von thereisnospace

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.