import java.awt.*; import java.io.*; import javax.swing.*; import java.awt.event.*; public class Spaigutus extends JPanel implements AdjustmentListener { JButton nupp1=new JButton("nupp1"); JButton nupp2=new JButton("nupp2"); JButton nupp3=new JButton("nupp3"); JCheckBox CB1=new JCheckBox("Esimene", false); JCheckBox CB2=new JCheckBox("Teine", true); JCheckBox CB3=new JCheckBox("Kolmas", false); JScrollBar kerimisriba=new JScrollBar(Scrollbar.HORIZONTAL, 20, 5, 1, 100); JCheckBox CB=new JCheckBox(); JTextArea TA1=new JTextArea(10,10); public Spaigutus() { setLayout(new BorderLayout()); Panel ylemine=new Panel(new GridLayout(1,3)); ylemine.add(nupp1); ylemine.add(nupp2); ylemine.add(nupp3); Panel alumine=new Panel(new BorderLayout()); Panel allsees=new Panel(new GridLayout(1,2)); ButtonGroup CBg=new ButtonGroup(); CBg.add(CB1); CBg.add(CB2); CBg.add(CB3); allsees.add(CB1); allsees.add(CB2); allsees.add(CB3); JComboBox valik=new JComboBox(); valik.addItem("Sinine"); valik.addItem("Punane"); valik.addItem("Kollane"); allsees.add(CB); alumine.add(valik, BorderLayout.WEST); alumine.add(kerimisriba); alumine.add(allsees, BorderLayout.SOUTH); add(ylemine, BorderLayout.NORTH); add(new JScrollPane(TA1), BorderLayout.CENTER); add(alumine, BorderLayout.SOUTH); } public static void main(String arg[]) { JFrame f=new JFrame("Spaigutus"); f.getContentPane().add(new Spaigutus()); f.setSize(640,480); f.setVisible(true); f.addWindowListener(new Raamikuular()); } public void adjustmentValueChanged(AdjustmentEvent e){ TA1.setText(kerimisriba.getValue()+"");} }