import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Swingiproov extends JApplet implements ActionListener{ JButton nupp1=new JButton("Esimene"); JToggleButton nupp2=new JToggleButton("Teine"); JComboBox valik=new JComboBox(); JLabel silt1=new JLabel("Silt 1"); // JLabel silt2=new JLabel("Silt 2"); ArvuTabeliMudel atm=new ArvuTabeliMudel(); JTable tabel1=new JTable(atm); JSplitPane jaotaja=new JSplitPane( JSplitPane.VERTICAL_SPLIT, silt1, new JScrollPane(tabel1) ); public Swingiproov(){ JPanel ylapaneel=new JPanel(new GridLayout(1, 3)); ylapaneel.add(nupp1); nupp1.addActionListener(this); ylapaneel.add(nupp2); valik.addItem("Juku"); valik.addItem("Kati"); ylapaneel.add(valik); getContentPane().add(ylapaneel, BorderLayout.NORTH); getContentPane().add(jaotaja, BorderLayout.CENTER); tabel1.setPreferredSize(new Dimension(500, 500)); } public void actionPerformed(ActionEvent e){ silt1.setText(valik.getSelectedItem().toString()); } public static void main(String[] arg){ JFrame f=new JFrame("Kujundus"); f.getContentPane().add(new Swingiproov()); f.setSize(400, 400); f.setVisible(true); } }