//Titel: 3. Vorlesungsuebung //Version: 1,0 //Copyright: Copyright (c) 2013 //Autor: M. Wilhelm //Organisation: HS-Harz //Beschreibung: GridBagLayout mit JSpinner import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; import java.io.*; public class Vorl03 extends JFrame { private JMenuBar menuBar1; private JMenu mainFile; private JMenuItem mnClose; JLabel lArtikel = new JLabel("Artikel"); JTextField artikel = new JTextField(); JLabel lPreis = new JLabel("Preis"); JSpinner preis; // erzeugt in setGUI JLabel lMinMax = new JLabel("Min/Max-Stückzahl"); JSpinner anzmin; // erzeugt in setGUI JSpinner anzmax; // erzeugt in setGUI public Vorl03() { setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); setGUI(); setMenus(); } private void setGUI() { setSize(600, 250); setTitle("Vorlesungsuebung 03"); this.getContentPane().setLayout( new GridBagLayout() ); /* this.getContentPane().add(label1 , new GridBagConstraints( 0, 0, 2, 2, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0)); */ // hier fehlt Code // Nummern-Spinner für Werte von 1 default, min, max, step /* SpinnerNumberModel model1 = new SpinnerNumberModel( 5.0, 0.0, 10.0, 0.4 ); preis = new JSpinner( model1 ); */ //panelTwo.setBackground(Color.RED); // setFont( this.getContentPane() ); } // setGUI // setzt die Menüs private void setMenus() { menuBar1 = new JMenuBar(); // DATEI mainFile = new JMenu("Datei"); // hier fehlt Code menuBar1.add(mainFile); this.setJMenuBar(menuBar1); } // setMenus // hier fehlt Code, Close-Event public static void main(String[] args) { Vorl03 frame = new Vorl03(); frame.setVisible(true); } } // Vorl03