aus stateChanged ein JLabel adden

Taranis

Mitglied
Hallo liebe Helfer und Mitleidende,

ich habe mir folgendes Programm zusammengestückelt:

Java:
import java.awt.*;
import javax.swing.*;
import java.util.*;
import javax.swing.event.*;

public class SpinnerFrame extends JFrame
{    
    public JSpinner spin1;
    public JSpinner spin2;
	public JSpinner spin3;
	public JSpinner spin4;
	public JSpinner spin5;
	public JSpinner spin6;       
    
    public SpinnerNumberModel spin1Model;
    public SpinnerNumberModel spin2Model;
    public SpinnerNumberModel spin3Model;
    public SpinnerNumberModel spin4Model;
    public SpinnerNumberModel spin5Model;
    public SpinnerNumberModel spin6Model;
    
    //constructor
    public SpinnerFrame()
    {
        super("Neuronales Netz Uebung");
		
        createNumberSpinner();

        //adding Spinners to the frame
                
        JPanel spinPanel1 = new JPanel();
        spinPanel1.add(spin1); 
        spinPanel1.setBounds(99,27,50,30);
        spinPanel1.setOpaque(false);
        this.getContentPane().add(spinPanel1);
        
        JPanel spinPanel2 = new JPanel();
        spinPanel2.add(spin2);
        spinPanel2.setBounds(99,141,50,30);
        spinPanel2.setOpaque(false);
        this.getContentPane().add(spinPanel2);

        JPanel spinPanel3 = new JPanel();
        spinPanel3.add(spin3);
        spinPanel3.setBounds(99,255,50,30);
        spinPanel3.setOpaque(false);
        this.getContentPane().add(spinPanel3);
        
        JPanel spinPanel4 = new JPanel();
        spinPanel4.add(spin4);
        spinPanel4.setBounds(299,63,50,30);
        spinPanel4.setOpaque(false);
        this.getContentPane().add(spinPanel4);
        
        JPanel spinPanel5 = new JPanel();
        spinPanel5.add(spin5);
        spinPanel5.setBounds(299,141,50,30);
        spinPanel5.setOpaque(false);
        this.getContentPane().add(spinPanel5);
        
        JPanel spinPanel6 = new JPanel();
        spinPanel6.add(spin6);
        spinPanel6.setBounds(299,219,50,30);
        spinPanel6.setOpaque(false);
        this.getContentPane().add(spinPanel6);
        
    }    
    
    //method
    public void createNumberSpinner()
    {
        //creating the number spinner 
        spin1 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin2 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 	
        spin3 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin4 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin5 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin6 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
       
        //registrating event and creating output	
        spin1.addChangeListener(new ChangeListener()
        	{
         	public void stateChanged(ChangeEvent e)
         		{
            	String strgwert1 = spin1.getValue().toString();
            	String strgwert2 = spin2.getValue().toString();
            	String strgwert3 = spin3.getValue().toString();
            	String strgwert4 = spin4.getValue().toString();
            	String strgwert5 = spin5.getValue().toString();
            	String strgwert6 = spin6.getValue().toString();
            	int wert1 = Integer.valueOf(strgwert1).intValue();
            	int wert2 = Integer.valueOf(strgwert2).intValue();
            	int wert3 = Integer.valueOf(strgwert3).intValue();
            	int wert4 = Integer.valueOf(strgwert4).intValue();
            	int wert5 = Integer.valueOf(strgwert5).intValue();
            	int wert6 = Integer.valueOf(strgwert6).intValue();
            	int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            	System.out.println("JSpinner_ges: "+wert);
            	            	
            	JLabel textLabel7 = new JLabel();
            	textLabel7.setText("7");
        	textLabel7.setBounds(498,105,200,100); 
            	getContentPane().add(textLabel7);
         		}
      		});  
      	        
        spin2.addChangeListener(new ChangeListener()
        	{
         	public void stateChanged(ChangeEvent e)
         		{
            	String strgwert1 = spin1.getValue().toString();
            	String strgwert2 = spin2.getValue().toString();
            	String strgwert3 = spin3.getValue().toString();
            	String strgwert4 = spin4.getValue().toString();
            	String strgwert5 = spin5.getValue().toString();
            	String strgwert6 = spin6.getValue().toString();
            	int wert1 = Integer.valueOf(strgwert1).intValue();
            	int wert2 = Integer.valueOf(strgwert2).intValue();
            	int wert3 = Integer.valueOf(strgwert3).intValue();
            	int wert4 = Integer.valueOf(strgwert4).intValue();
            	int wert5 = Integer.valueOf(strgwert5).intValue();
            	int wert6 = Integer.valueOf(strgwert6).intValue();
            	int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            	System.out.println("JSpinner_ges: "+wert);
         		}
      		});   
    
        spin3.addChangeListener(new ChangeListener()
        	{
         	public void stateChanged(ChangeEvent e)
         		{
            	String strgwert1 = spin1.getValue().toString();
            	String strgwert2 = spin2.getValue().toString();
            	String strgwert3 = spin3.getValue().toString();
            	String strgwert4 = spin4.getValue().toString();
            	String strgwert5 = spin5.getValue().toString();
            	String strgwert6 = spin6.getValue().toString();
            	int wert1 = Integer.valueOf(strgwert1).intValue();
            	int wert2 = Integer.valueOf(strgwert2).intValue();
            	int wert3 = Integer.valueOf(strgwert3).intValue();
            	int wert4 = Integer.valueOf(strgwert4).intValue();
            	int wert5 = Integer.valueOf(strgwert5).intValue();
            	int wert6 = Integer.valueOf(strgwert6).intValue();
            	int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            	System.out.println("JSpinner_ges: "+wert);
         		}
      		});   
      	        
        spin4.addChangeListener(new ChangeListener()
        	{
         	public void stateChanged(ChangeEvent e)
         		{
            	String strgwert1 = spin1.getValue().toString();
            	String strgwert2 = spin2.getValue().toString();
            	String strgwert3 = spin3.getValue().toString();
            	String strgwert4 = spin4.getValue().toString();
            	String strgwert5 = spin5.getValue().toString();
            	String strgwert6 = spin6.getValue().toString();
            	int wert1 = Integer.valueOf(strgwert1).intValue();
            	int wert2 = Integer.valueOf(strgwert2).intValue();
            	int wert3 = Integer.valueOf(strgwert3).intValue();
            	int wert4 = Integer.valueOf(strgwert4).intValue();
            	int wert5 = Integer.valueOf(strgwert5).intValue();
            	int wert6 = Integer.valueOf(strgwert6).intValue();
            	int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            	System.out.println("JSpinner_ges: "+wert);
         		}
      		});   
        
        spin5.addChangeListener(new ChangeListener()
        	{
         	public void stateChanged(ChangeEvent e)
         		{
            	String strgwert1 = spin1.getValue().toString();
            	String strgwert2 = spin2.getValue().toString();
            	String strgwert3 = spin3.getValue().toString();
            	String strgwert4 = spin4.getValue().toString();
            	String strgwert5 = spin5.getValue().toString();
            	String strgwert6 = spin6.getValue().toString();
            	int wert1 = Integer.valueOf(strgwert1).intValue();
            	int wert2 = Integer.valueOf(strgwert2).intValue();
            	int wert3 = Integer.valueOf(strgwert3).intValue();
            	int wert4 = Integer.valueOf(strgwert4).intValue();
            	int wert5 = Integer.valueOf(strgwert5).intValue();
            	int wert6 = Integer.valueOf(strgwert6).intValue();
            	int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            	System.out.println("JSpinner_ges: "+wert);
         		}
      		});   
      	        
        spin6.addChangeListener(new ChangeListener()
        	{
         	public void stateChanged(ChangeEvent e)
         		{
            	String strgwert1 = spin1.getValue().toString();
            	String strgwert2 = spin2.getValue().toString();
            	String strgwert3 = spin3.getValue().toString();
            	String strgwert4 = spin4.getValue().toString();
            	String strgwert5 = spin5.getValue().toString();
            	String strgwert6 = spin6.getValue().toString();
            	int wert1 = Integer.valueOf(strgwert1).intValue();
            	int wert2 = Integer.valueOf(strgwert2).intValue();
            	int wert3 = Integer.valueOf(strgwert3).intValue();
            	int wert4 = Integer.valueOf(strgwert4).intValue();
            	int wert5 = Integer.valueOf(strgwert5).intValue();
            	int wert6 = Integer.valueOf(strgwert6).intValue();
            	int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            	System.out.println("JSpinner_ges: "+wert);
         		}
      		});
      	}

    
 public static void main(String[] args)
    {
        JLabel textLabel = new JLabel();
        JLabel textLabel1 = new JLabel();
        JLabel textLabel2 = new JLabel();
        JLabel textLabel3 = new JLabel();
        JLabel textLabel4 = new JLabel();
        JLabel textLabel5 = new JLabel();
        JLabel textLabel6 = new JLabel();
        
        JLabel backImg = new JLabel(new ImageIcon("test.jpg")); //Erzeugung des Hintergrundbildes
        
        SpinnerFrame spinnerFrame = new SpinnerFrame();
        spinnerFrame.setLayout(null);
        spinnerFrame.setSize(636, 352);
        spinnerFrame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        
        backImg.setOpaque(false);
        backImg.setBounds(0,0,619,315);
        
        textLabel.setText("Formel = ( [1]*[4] ) + ( [2]*[5] ) + ( [3]*[6] )");
        textLabel.setFont(new Font("Arial", Font.PLAIN, 18));
        textLabel.setBounds(275,250,400,100);
        spinnerFrame.add(textLabel);
        
        textLabel1.setText("[1]");
        textLabel1.setBounds(115,14,200,100);
        spinnerFrame.add(textLabel1);
        
        textLabel2.setText("[2]");
        textLabel2.setBounds(115,127,200,100);
        spinnerFrame.add(textLabel2);
        
        textLabel3.setText("[3]");
        textLabel3.setBounds(115,241,200,100);
        spinnerFrame.add(textLabel3);
        
        textLabel4.setText("[4]");
        textLabel4.setBounds(315,49,200,100);
        spinnerFrame.add(textLabel4);
        
        textLabel5.setText("[5]");
        textLabel5.setBounds(315,125,200,100);
        spinnerFrame.add(textLabel5);
        
        textLabel6.setText("[6]");
        textLabel6.setBounds(315,203,200,100);
        spinnerFrame.add(textLabel6);
        
        spinnerFrame.add(backImg);
        spinnerFrame.setVisible(true);
    }
}

Das Prog funktioniert soweit. Es erzeugt in einem Frame 6 verschedene Spinner, die jeweils durch den ActionListener stateChanged() überwacht werden. In dieser Routine werden bei Änderung eines Spinners alle Spinner abgefragt und durch eine Formel verrechnet.
Den dabei entstehenden Wert möchte ich nun im ursprünglich erzeugten Frame mit einem JLabel anzeigen (siehe ab etwa Zeile 100).
Das funktioniert aber nicht. Habt ihr da eine Lösung für mich?

Ich habe bisher nur im Bereich des spin1.addChangeListener... das entsprechende JLabel erzeugt. Es soll aber auch in den 5 anderen eingefügt werden.

Danke schon mal!
 
Zuletzt bearbeitet:
textLabel7 muss, wie die Spinner, eine Instanzvariable sein, damit man aus den jeweiligen Methoden auf diese zugreifen kann.
Momentan handelt es sich um eine lokale Variable der Methode stateChanged, in der jedensmal eine neue Komponente erzeugt und hinzugefügt wird!!
==> ein JLabel erzeugen und dem Container hinzufügen, die Referenz darauf in einer Instanzvariablen halten.
 
Genauso wie Du die JSpinner als Instanzvariablen deklarierst, musst es auch mit dem JLabel machen.

Hab mal den Code ein bisschen überflogen, schön ist anders ;-)
- die sechs Variablen für die SpinnerNumberModels werden nicht genutzt und sind überflüssig
- die Listener machen alle dasselbe ==> ein gemeinsamer Listener für alle JSpinner
- in der main fügst Du noch weitere Labels zum Frame. Das Layout eines Containers, definiert man in der Klasse selbst und nicht die Hälfte im Konstruktor und die andere Hälfte sonst wo
 
Gut, ich habs etwas umsortiert und übersichtlicher gestaltet...

Java:
import java.awt.*;
import javax.swing.*;
import java.util.*;
import javax.swing.event.*;

public class SpinnerFrame extends JFrame
{    
    public JSpinner spin1;
    public JSpinner spin2;
	public JSpinner spin3;
	public JSpinner spin4;
	public JSpinner spin5;
	public JSpinner spin6;       
    
    //constructor
    public SpinnerFrame()
    {
        super("Neuronales Netz Uebung");
        
        this.setDefaultCloseOperation( EXIT_ON_CLOSE );
		
    }
    
    
    //method
    public void addSpinners()
    {
        //adding Spinners to the frame
        JPanel spinPanel1 = new JPanel();
        spinPanel1.add(spin1); 
        spinPanel1.setBounds(99,27,50,30);
        spinPanel1.setOpaque(false);
        this.getContentPane().add(spinPanel1);
        
        JPanel spinPanel2 = new JPanel();
        spinPanel2.add(spin2);
        spinPanel2.setBounds(99,141,50,30);
        spinPanel2.setOpaque(false);
        this.getContentPane().add(spinPanel2);

        JPanel spinPanel3 = new JPanel();
        spinPanel3.add(spin3);
        spinPanel3.setBounds(99,255,50,30);
        spinPanel3.setOpaque(false);
        this.getContentPane().add(spinPanel3);
        
        JPanel spinPanel4 = new JPanel();
        spinPanel4.add(spin4);
        spinPanel4.setBounds(299,63,50,30);
        spinPanel4.setOpaque(false);
        this.getContentPane().add(spinPanel4);
        
        JPanel spinPanel5 = new JPanel();
        spinPanel5.add(spin5);
        spinPanel5.setBounds(299,141,50,30);
        spinPanel5.setOpaque(false);
        this.getContentPane().add(spinPanel5);
        
        JPanel spinPanel6 = new JPanel();
        spinPanel6.add(spin6);
        spinPanel6.setBounds(299,219,50,30);
        spinPanel6.setOpaque(false);
        this.getContentPane().add(spinPanel6);
      }    
    
    public void createNumberSpinner()
    {
        //creating the number spinner 
        spin1 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin2 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 	
        spin3 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin4 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin5 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin6 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
       
        //registrating event and creating output
        
		ChangeListener changeListener = new ChangeListener() 
			{
      			public void stateChanged(ChangeEvent e) 
      				{
        				String strgwert1 = spin1.getValue().toString();
            			String strgwert2 = spin2.getValue().toString();
            			String strgwert3 = spin3.getValue().toString();
            			String strgwert4 = spin4.getValue().toString();
            			String strgwert5 = spin5.getValue().toString();
            			String strgwert6 = spin6.getValue().toString();
            			int wert1 = Integer.valueOf(strgwert1).intValue();
            			int wert2 = Integer.valueOf(strgwert2).intValue();
            			int wert3 = Integer.valueOf(strgwert3).intValue();
            			int wert4 = Integer.valueOf(strgwert4).intValue();
            			int wert5 = Integer.valueOf(strgwert5).intValue();
            			int wert6 = Integer.valueOf(strgwert6).intValue();
            			int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            			System.out.println("JSpinner_ges: "+wert);
            	            	
            			JLabel textLabel7 = new JLabel();
            			textLabel7.setText("7");
        				textLabel7.setBounds(498,105,200,100); 
            			getContentPane().add(textLabel7);
      				}
    		};
    	
    	spin1.addChangeListener(changeListener);
    	spin2.addChangeListener(changeListener);
    	spin3.addChangeListener(changeListener);
    	spin4.addChangeListener(changeListener);
    	spin5.addChangeListener(changeListener);
    	spin6.addChangeListener(changeListener);
      	}
      	
    public void addHintergrund()
    {
    	JLabel backImg = new JLabel(new ImageIcon("test.jpg")); //Erzeugung des Hintergrundbildes
        backImg.setOpaque(false);
        backImg.setBounds(0,0,619,315);
        this.add(backImg);
    }
    
    public void addText()
    {
    	JLabel textLabel = new JLabel();
        JLabel textLabel1 = new JLabel();
        JLabel textLabel2 = new JLabel();
        JLabel textLabel3 = new JLabel();
        JLabel textLabel4 = new JLabel();
        JLabel textLabel5 = new JLabel();
        JLabel textLabel6 = new JLabel();
            	
    	textLabel.setText("Formel = ( [1]*[4] ) + ( [2]*[5] ) + ( [3]*[6] )");
        textLabel.setFont(new Font("Arial", Font.PLAIN, 18));
        textLabel.setBounds(275,250,400,100);
        this.add(textLabel);
        
        textLabel1.setText("[1]");
        textLabel1.setBounds(115,14,200,100);
        this.add(textLabel1);
        
        textLabel2.setText("[2]");
        textLabel2.setBounds(115,127,200,100);
        this.add(textLabel2);
        
        textLabel3.setText("[3]");
        textLabel3.setBounds(115,241,200,100);
        this.add(textLabel3);
        
        textLabel4.setText("[4]");
        textLabel4.setBounds(315,49,200,100);
        this.add(textLabel4);
        
        textLabel5.setText("[5]");
        textLabel5.setBounds(315,125,200,100);
        this.add(textLabel5);
        
        textLabel6.setText("[6]");
        textLabel6.setBounds(315,203,200,100);
        this.add(textLabel6);
        
    }
}

class NeuroTester
{	
    public static void main(String[] args)
    {
    	
        SpinnerFrame spinnerFrame = new SpinnerFrame();
        spinnerFrame.setLayout(null);
        spinnerFrame.setSize(636, 352);
        
        spinnerFrame.createNumberSpinner();

        spinnerFrame.addSpinners();
        
        spinnerFrame.addHintergrund();
        
        spinnerFrame.addText();
        
        spinnerFrame.setVisible(true);
    }
}

Ist es so besser?
 
Ich habe mein Problem nun auch lösen können, da ich jetzt verstanden habe, was du mir geraten hattest bezüglich der Instanzvariablen.

Hier nochmal der code:

Java:
import java.awt.*;
import javax.swing.*;
import java.util.*;
import javax.swing.event.*;

public class SpinnerFrame extends JFrame
{    
    public JSpinner spin1;
    public JSpinner spin2;
	public JSpinner spin3;
	public JSpinner spin4;
	public JSpinner spin5;
	public JSpinner spin6; 
	public JLabel textLabel7;     
    
    //constructor
    public SpinnerFrame()
    {
        super("Neuronales Netz Uebung");
        
        this.setDefaultCloseOperation( EXIT_ON_CLOSE );
		//this.add(textLabel7);
    }
    
    
    //method
    public void addSpinners()
    {
        //adding Spinners to the frame
        JPanel spinPanel1 = new JPanel();
        spinPanel1.add(spin1); 
        spinPanel1.setBounds(99,27,50,30);
        spinPanel1.setOpaque(false);
        this.getContentPane().add(spinPanel1);
        
        JPanel spinPanel2 = new JPanel();
        spinPanel2.add(spin2);
        spinPanel2.setBounds(99,141,50,30);
        spinPanel2.setOpaque(false);
        this.getContentPane().add(spinPanel2);

        JPanel spinPanel3 = new JPanel();
        spinPanel3.add(spin3);
        spinPanel3.setBounds(99,255,50,30);
        spinPanel3.setOpaque(false);
        this.getContentPane().add(spinPanel3);
        
        JPanel spinPanel4 = new JPanel();
        spinPanel4.add(spin4);
        spinPanel4.setBounds(299,63,50,30);
        spinPanel4.setOpaque(false);
        this.getContentPane().add(spinPanel4);
        
        JPanel spinPanel5 = new JPanel();
        spinPanel5.add(spin5);
        spinPanel5.setBounds(299,141,50,30);
        spinPanel5.setOpaque(false);
        this.getContentPane().add(spinPanel5);
        
        JPanel spinPanel6 = new JPanel();
        spinPanel6.add(spin6);
        spinPanel6.setBounds(299,219,50,30);
        spinPanel6.setOpaque(false);
        this.getContentPane().add(spinPanel6);
      }    
    
    public void createNumberSpinner()
    {
        //creating the number spinner 
        spin1 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin2 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 	
        spin3 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin4 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin5 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        spin6 = new JSpinner(new SpinnerNumberModel(1, 0, 10, 1)); 
        
        textLabel7 = new JLabel();
        textLabel7.setBounds(498,105,200,100);
        
        //registrating event and creating output
        
		ChangeListener changeListener = new ChangeListener() 
			{
      			public void stateChanged(ChangeEvent e) 
      				{
        				String strgwert1 = spin1.getValue().toString();
            			String strgwert2 = spin2.getValue().toString();
            			String strgwert3 = spin3.getValue().toString();
            			String strgwert4 = spin4.getValue().toString();
            			String strgwert5 = spin5.getValue().toString();
            			String strgwert6 = spin6.getValue().toString();
            			int wert1 = Integer.valueOf(strgwert1).intValue();
            			int wert2 = Integer.valueOf(strgwert2).intValue();
            			int wert3 = Integer.valueOf(strgwert3).intValue();
            			int wert4 = Integer.valueOf(strgwert4).intValue();
            			int wert5 = Integer.valueOf(strgwert5).intValue();
            			int wert6 = Integer.valueOf(strgwert6).intValue();
            			int wert = (wert1 * wert4) + (wert2 * wert5) + (wert3 * wert6);
            			String strgwert = ""+wert;
            	        
            			textLabel7.setText(strgwert);

      				}
    		};

    	spin1.addChangeListener(changeListener);
    	spin2.addChangeListener(changeListener);
    	spin3.addChangeListener(changeListener);
    	spin4.addChangeListener(changeListener);
    	spin5.addChangeListener(changeListener);
    	spin6.addChangeListener(changeListener);
    	
    	this.add(textLabel7);
    	
      	}
      	
    public void addHintergrund()
    {
    	JLabel backImg = new JLabel(new ImageIcon("test.jpg")); //Erzeugung des Hintergrundbildes
        backImg.setOpaque(false);
        backImg.setBounds(0,0,619,315);
        this.add(backImg);
    }
    
    public void addText()
    {
    	JLabel textLabel = new JLabel();
        JLabel textLabel1 = new JLabel();
        JLabel textLabel2 = new JLabel();
        JLabel textLabel3 = new JLabel();
        JLabel textLabel4 = new JLabel();
        JLabel textLabel5 = new JLabel();
        JLabel textLabel6 = new JLabel();
            	
    	textLabel.setText("Formel = ( [1]*[4] ) + ( [2]*[5] ) + ( [3]*[6] )");
        textLabel.setFont(new Font("Arial", Font.PLAIN, 18));
        textLabel.setBounds(275,250,400,100);
        this.add(textLabel);
        
        textLabel1.setText("[1]");
        textLabel1.setBounds(115,14,200,100);
        this.add(textLabel1);
        
        textLabel2.setText("[2]");
        textLabel2.setBounds(115,127,200,100);
        this.add(textLabel2);
        
        textLabel3.setText("[3]");
        textLabel3.setBounds(115,241,200,100);
        this.add(textLabel3);
        
        textLabel4.setText("[4]");
        textLabel4.setBounds(315,49,200,100);
        this.add(textLabel4);
        
        textLabel5.setText("[5]");
        textLabel5.setBounds(315,125,200,100);
        this.add(textLabel5);
        
        textLabel6.setText("[6]");
        textLabel6.setBounds(315,203,200,100);
        this.add(textLabel6);
        
    }
}

class NeuroTester
{	
    public static void main(String[] args)
    {
    	
        SpinnerFrame spinnerFrame = new SpinnerFrame();
        spinnerFrame.setLayout(null);
        spinnerFrame.setSize(636, 352);
        
        spinnerFrame.createNumberSpinner();

        spinnerFrame.addSpinners();
        
        spinnerFrame.addHintergrund();
        
        spinnerFrame.addText();
        //spinnerFrame.add(textLabel7);
        
        spinnerFrame.setVisible(true);
    }
}

Super!
Ich danke tausendfach!
 

Zurück
Oben