import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; /** * Sliders panel displaying perspective coeficients. */ public class OntoSliders extends JPanel implements ChangeListener, MouseListener{ OntoApp oa; int currentNr=-1; JLabel[] labels; JSlider[] sliders; JSlider[] namesliders; //Yhe rea omaduste jaoks JSlider masterSlider; // JTextField[] stfs; public OntoSliders(OntoApp oa){ this.oa=oa; } public void initialize(){ int masterNr=4; //Sellest alates näidatakse removeAll(); // setLayout(new GridLayout(oa.od.parameters.length+((oa.od.parameters.length>masterNr)?1:0),1)); setLayout(new GridLayout(oa.od.params.length+((oa.od.params.length>masterNr)?1:0)+(oa.odf.bznameslidersview.isSelected()?1:0),1)); labels=new JLabel[oa.od.params.length]; sliders=new JSlider[oa.od.params.length]; namesliders=new JSlider[oa.od.params.length]; // stfs=new JTextField[oa.od.params.length]; if(sliders.length>masterNr){ masterSlider=new JSlider(0, 100, 0); JPanel p=new JPanel(new BorderLayout()); JPanel p2=new JPanel(new BorderLayout()); p2.add(masterSlider, BorderLayout.CENTER); p2.add(new JLabel(" "), BorderLayout.EAST); p.add(p2, BorderLayout.SOUTH); p.add(new JLabel("Master slider"), BorderLayout.NORTH); masterSlider.addChangeListener(this); add(p); } if(oa.odf.bznameslidersview.isSelected()){ JPanel p=new JPanel(new BorderLayout()); p.add(new JLabel("Parameter")); JPanel p2=new JPanel(new GridLayout(1, 2)); JLabel lab1=new JLabel("Self"); JLabel lab2=new JLabel("View"); lab1.setPreferredSize(new Dimension(70, 20)); lab2.setPreferredSize(new Dimension(70, 20)); p2.add(lab1); p2.add(lab2); p.add(p2, BorderLayout.EAST); add(p); } for(int i=0; i oa.getHeight())?30*sliders.length+20:oa.getHeight()-50); } boolean bigMoving=false; public void stateChanged(ChangeEvent e){ if(e.getSource()==masterSlider){ bigMoving=true; for(int i=0; i