import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; /** * Sliders panel displaying perspective coeficients. */ public class OntoSliders extends JPanel implements ChangeListener, MouseListener, ItemListener, ActionListener{ OntoApp oa; int currentNr=-1; JLabel[] labels; JSlider[] sliders; JTextField[] tfs; // JSlider[] namesliders; //Yhe rea omaduste jaoks JProgressBar[] namesliders; JSlider masterSlider=new JSlider(0, 100, 0); boolean wasNull=true; JLabel lab1=new JLabel("Self"); JLabel lab2=new JLabel("View"); JComboBox cmbusernames=new JComboBox(); JButton bsavesettings=new JButton("Save parameters"); String currentusername="Not user"; // JTextField[] stfs; public OntoSliders(OntoApp oa){ this.oa=oa; } public void initialize(){ int masterNr=(oa.odf.bzmasterview.isSelected()?4:1000000); //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)+ (oa.odf.bzuserslidersview.isSelected()?1:0),1)); labels=new JLabel[oa.od.params.length]; sliders=new JSlider[oa.od.params.length]; tfs=new JTextField[oa.od.params.length]; // namesliders=new JSlider[oa.od.params.length]; namesliders=new JProgressBar[oa.od.params.length]; // stfs=new JTextField[oa.od.params.length]; if(oa.odf.bzuserslidersview.isSelected()){ JPanel pu=new JPanel(new GridLayout(1, 2)); pu.add(cmbusernames); pu.add(bsavesettings); add(pu); cmbusernames.addItemListener(this); bsavesettings.addActionListener(this); } 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)); 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; void resetSliders(){ bigMoving=true; for(int i=0; i