Lissajous.zip

  • PUDN用户
    了解作者
  • Java
    开发工具
  • 51KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 4
    下载次数
  • 2009-12-19 08:08
    上传日期
Lissajous figures - java applet
Lissajous.zip
内容介绍
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * LissaWindow.java * * Created on 2009-04-19, 11:09:48 */ package gui; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Iterator; import javax.imageio.IIOImage; import javax.imageio.ImageIO; import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriter; import javax.imageio.stream.FileImageOutputStream; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; /** * * @author palik */ public class LissaWindow extends javax.swing.JApplet { /** Initializes the applet LissaWindow */ LissaPanel lissaPanel = new LissaPanel(); @Override public void init() { try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { WindowUtilities.setNativeLookAndFeel(); initComponents(); labA.setText(new Integer(sliderA.getValue()).toString()); labB.setText(new Integer(sliderB.getValue()).toString()); labW1.setText(new Float(sliderW1.getValue()/10f).toString()+" Hz"); labW2.setText(new Float(sliderW2.getValue()/10f).toString()+" Hz"); labFi.setText(new Integer(sliderFi.getValue()).toString()+"?"); wykres.add(lissaPanel); repaintWykres(); } }); } catch (Exception ex) { ex.printStackTrace(); } } /** This method is called from within the init() method to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { draganieY = new javax.swing.JPanel(); przyciski = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); sliderA = new javax.swing.JSlider(); labA = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); sliderB = new javax.swing.JSlider(); labB = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); sliderW1 = new javax.swing.JSlider(); labW1 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); sliderW2 = new javax.swing.JSlider(); labW2 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); sliderFi = new javax.swing.JSlider(); labFi = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jSeparator2 = new javax.swing.JSeparator(); jButton1 = new javax.swing.JButton(); sliderTime = new javax.swing.JSlider(); jLabel2 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jSeparator3 = new javax.swing.JSeparator(); drganieX = new javax.swing.JPanel(); wykres = new javax.swing.JPanel(); menu = new javax.swing.JMenuBar(); mPlik = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); mInfo = new javax.swing.JMenu(); javax.swing.GroupLayout draganieYLayout = new javax.swing.GroupLayout(draganieY); draganieY.setLayout(draganieYLayout); draganieYLayout.setHorizontalGroup( draganieYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 100, Short.MAX_VALUE) ); draganieYLayout.setVerticalGroup( draganieYLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 321, Short.MAX_VALUE) ); getContentPane().add(draganieY, java.awt.BorderLayout.LINE_START); przyciski.setMaximumSize(new java.awt.Dimension(250, 400)); przyciski.setMinimumSize(new java.awt.Dimension(250, 400)); przyciski.setPreferredSize(new java.awt.Dimension(250, 400)); jLabel1.setText("A:"); sliderA.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sliderAStateChanged(evt); } }); labA.setText("jLabel2"); jLabel3.setText("B:"); sliderB.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sliderBStateChanged(evt); } }); labB.setText("jLabel2"); jLabel5.setText("w1:"); sliderW1.setMaximum(200); sliderW1.setMinimum(1); sliderW1.setMinorTickSpacing(10); sliderW1.setPaintLabels(true); sliderW1.setPaintTicks(true); sliderW1.setValue(10); sliderW1.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sliderW1StateChanged(evt); } }); labW1.setText("jLabel2"); jLabel7.setText("w2:"); sliderW2.setMaximum(200); sliderW2.setMinimum(1); sliderW2.setMinorTickSpacing(10); sliderW2.setPaintLabels(true); sliderW2.setPaintTicks(true); sliderW2.setValue(10); sliderW2.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sliderW2StateChanged(evt); } }); labW2.setText("jLabel2"); jLabel9.setText("fi:"); sliderFi.setMaximum(360); sliderFi.setMinorTickSpacing(10); sliderFi.setPaintLabels(true); sliderFi.setPaintTicks(true); sliderFi.setSnapToTicks(true); sliderFi.setValue(90); sliderFi.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { sliderFiStateChanged(evt); } }); labFi.setText("jLabel2"); jButton1.setText("Rysuj w czasie"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); sliderTime.setMinimum(2); sliderTime.setMinorTickSpacing(1); sliderTime.setPaintLabels(true); sliderTime.setSnapToTicks(true); sliderTime.setValue(2); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); jLabel2.setText("x(t) = A * sin(w1 * t + fi) "); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); jLabel4.setText("y(t) = B * sin(w2 * t) "); javax.swing.GroupLayout przyciskiLayout = new javax.swing.GroupLayout(przyciski); przyciski.setLayout(przyciskiLayout); przyciskiLayout.setHorizontalGroup( przyciskiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(przyciskiLayout.createSequentialGroup() .addGroup(przyciskiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(przyciskiLayout.createSequentialGroup() .addGap(48, 48, 48) .addGroup(przyciskiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(przyciskiLayout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel4)) .addComponent(jLabel2))) .addGroup(przyciskiLayout.createSequentialGroup() .addContainerGap() .addGro
评论
    相关推荐