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.

JOptionPane

Empfohlene Antworten

Ich kann mit


String s = JOptionPane.showInputDialog("Wo hin willst du gehen");

einen String eingeben

kann ich damit auch einen Ausgeben ??

Jupp wenn dann mit dem ShowMessageDialog meine ich

gut habe vor das anders zu lösen

mein eigendlíches prob ist


contentPane.add(new JButton("Button 1"));

bin zwar in der Lage ein haufen Knöpfe zu basteln

nur fehlt mir dasich auf die Eingabe reagieren kann

z.b Button 1 wird gedrückt und weiter ?

z.b Button 1 wird gedrückt und weiter ?
Die Ereignisverarbeitung für diesen Button startet. Besorg dir ein Swing Tutorial und fang bei Kapitel 1 an - dort werden genau diese Fragen alle beantwortet.

Hast du nen link dafür

habe nur 2 Java bücher und da werden die Themen nur kurz angeschnitten

So damit es nicht so aussieht als würde ich hier auf ergebnisse warten

ich habs geschaft




import javax.swing.*;

import java.awt.*;

import java.awt.event.*;


 public class Systems

 extends JFrame


 {





     public Systems()

   {


	 super("Auswahl treffen");



     Container contentPane = getContentPane();

     contentPane.setLayout(new GridLayout(3, 1));




     JButton a1 = new JButton("Button1");

     JButton a2 = new JButton("Button2");

     JButton a3 = new JButton("Button3");

     a1.setActionCommand("but1");

     a2.setActionCommand("but2");

     a3.setActionCommand("but3");


     MyButtonListener myButLis = new MyButtonListener();

     a1.addActionListener(myButLis);

     a2.addActionListener(myButLis);

     a3.addActionListener(myButLis);

     contentPane.add(a1);

     contentPane.add(a2);

     contentPane.add(a3);



   }


   public static void tom(String[] args)

   {

     Systems wnd = new Systems();

     wnd.setLocation(100, 100);

     wnd.setSize(300, 200);

     wnd.setVisible(true);

   }


   private class MyButtonListener implements ActionListener {

	 String s="";






   public void MyButtonListener() { }

   public void actionPerformed ( ActionEvent e ) {

   String entry = e.getActionCommand();

   if(entry.equals("but1"))

      s ="button1";

   else if(entry.equals("but2") )

     s ="button2";

   else if(entry.equals("but3"))

      s="button3";   

   System.out.println(s);



}}}

wenn noch was zu verbessern ist dann bitte

danke

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.