⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thermometerdemo.java

📁 这是一个segy数据显示程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    this.thermo[2].setOutlinePaint(null);    this.thermo[0].setUnits(0);    this.thermo[1].setUnits(1);    this.thermo[2].setUnits(2);    //thermo[0].setFont(new Font("SansSerif", Font.BOLD, 20));    this.thermo[0].setShowValueLines(true);    this.thermo[0].setFollowDataInSubranges(true);    this.thermo[1].setValueLocation(1);    this.thermo[1].setForeground(Color.blue);    this.thermo[2].setForeground(Color.pink);    this.thermo[0].setRange(-10.0, 40.0);    this.thermo[0].setSubrangeInfo(0, -50.0, 20.0, -10.0, 22.0);    this.thermo[0].setSubrangeInfo(1, 20.0, 24.0, 18.0, 26.0);    this.thermo[0].setSubrangeInfo(2, 24.0, 100.0, 22.0, 40.0);    this.thermo[0].addSubtitle("Sea Water Temp");    this.thermo[1].addSubtitle("Air Temp", new Font("SansSerif", Font.PLAIN, 16));    this.thermo[2].addSubtitle("Ship Temp",                          new Font("SansSerif", Font.ITALIC + Font.BOLD, 20));    this.thermo[1].setValueFormat(new DecimalFormat("#0.0"));    this.thermo[2].setValueFormat(new DecimalFormat("#0.00"));    this.pickShow[0] = this.pickShow0;    this.pickShow[1] = this.pickShow1;    this.pickShow[2] = this.pickShow2;    this.pickAxis[0] = this.pickAxis0;    this.pickAxis[1] = this.pickAxis1;    this.pickAxis[2] = this.pickAxis2;    this.pickAxis[0].setSelectedIndex(2);    this.pickAxis[1].setSelectedIndex(2);    this.pickAxis[2].setSelectedIndex(2);    setLayout(this.gridLayout1);    this.butDown3.setText("<");    this.butDown3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setValue(2, -1);      }    });    this.butUp3.setText(">");    this.butUp3.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setValue(2, 1);      }    });    this.jPanel1.setLayout(this.borderLayout2);    this.jPanel3.setLayout(this.borderLayout3);    this.butDown2.setText("<");    this.butDown2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setValue(1, -1);      }    });    this.butUp2.setText(">");    this.butUp2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setValue(1, 1);      }    });    this.butUp1.setText(">");    this.butUp1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setValue(0, 1);      }    });    this.butDown1.setText("<");    this.butDown1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setValue(0, -1);      }    });    this.jPanel5.setLayout(this.borderLayout1);    this.pickShow0.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setShowValue(0);      }    });    this.pickShow1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setShowValue(1);      }    });    this.pickShow2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setShowValue(2);      }    });    this.pickAxis0.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setShowAxis(0);      }    });    this.pickAxis1.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setShowAxis(1);      }    });    this.pickAxis2.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setShowAxis(2);      }    });    this.jPanel9.setLayout(this.gridLayout2);    this.gridLayout2.setColumns(1);    this.jPanel8.setLayout(this.gridLayout3);    this.jPanel7.setLayout(this.gridLayout4);    this.jPanel5.setBorder(BorderFactory.createEtchedBorder());    this.jPanel3.setBorder(BorderFactory.createEtchedBorder());    this.jPanel1.setBorder(BorderFactory.createEtchedBorder());    this.jPanel6.setBackground(Color.white);    this.jPanel2.setBackground(Color.white);    this.jPanel9.setBackground(Color.white);    this.jPanel10.setLayout(this.borderLayout4);    this.butDown4.setText("<");    this.butDown4.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setMeterValue(-1.1);      }    });    this.butUp4.setText(">");    this.butUp4.addActionListener(new java.awt.event.ActionListener() {      public void actionPerformed(final ActionEvent e) {        setMeterValue(1.1);      }    });    this.jPanel1.add(this.thermo3, BorderLayout.CENTER);    this.jPanel1.add(this.jPanel2, BorderLayout.SOUTH);    this.jPanel2.add(this.butDown3, null);    this.jPanel2.add(this.butUp3, null);    this.jPanel1.add(this.jPanel9, BorderLayout.NORTH);    this.jPanel9.add(this.pickShow2, null);    this.jPanel9.add(this.pickAxis2, null);    add(this.jPanel10, null);    this.jPanel10.add(this.jPanel11, BorderLayout.SOUTH);    this.jPanel11.add(this.butDown4, null);    this.jPanel11.add(this.butUp4, null);    this.jPanel4.add(this.butDown2, null);    this.jPanel4.add(this.butUp2, null);    this.jPanel3.add(this.jPanel8, BorderLayout.NORTH);    this.jPanel8.add(this.pickShow1, null);    this.jPanel8.add(this.pickAxis1, null);    this.jPanel3.add(this.thermo2, BorderLayout.CENTER);    this.jPanel3.add(this.jPanel4, BorderLayout.SOUTH);    add(this.jPanel5, null);    this.jPanel5.add(this.thermo1, BorderLayout.CENTER);    this.jPanel5.add(this.jPanel6, BorderLayout.SOUTH);    this.jPanel6.add(this.butDown1, null);    this.jPanel6.add(this.butUp1, null);    this.jPanel5.add(this.jPanel7, BorderLayout.NORTH);    this.jPanel7.add(this.pickShow0, null);    this.jPanel7.add(this.pickAxis0, null);    add(this.jPanel3, null);    add(this.jPanel1, null);    this.jPanel10.add(this.panelMeter, BorderLayout.CENTER);  }  /**   * Starting point for the demo application.   *   * @param args  ignored.   */  public static void main(final String[] args) {    final ThermometerDemo panel = new ThermometerDemo();    final JFrame frame = new JFrame();    frame.getContentPane().setLayout(new BorderLayout(5, 5));    frame.setDefaultCloseOperation(3);    frame.setTitle("Thermometer Test");    frame.getContentPane().add(panel, BorderLayout.CENTER);    frame.setSize(700, 400);    final Dimension d = Toolkit.getDefaultToolkit().getScreenSize();    frame.setLocation((d.width - frame.getSize().width) / 2,                      (d.height - frame.getSize().height) / 2);    frame.setVisible(true);  }  /**   * Sets the value of one of the thermometers.   *   * @param thermometer  the thermometer index.   * @param value  the value.   */  private void setValue(final int thermometer, final double value) {    if ((thermometer >= 0) && (thermometer < 3)) {      try {        this.thermo[thermometer].setValue(            this.thermo[thermometer].getValue().doubleValue() + value        );      }      catch (Exception ex) {        ex.printStackTrace();      }    }  }  /**   * Sets the meter value.   *   * @param value  the value.   */  private void setMeterValue(final double value) {    try {      double newValue = value;      if (this.data.getValue() != null) {        newValue += this.data.getValue().doubleValue();      }      this.data.setValue(new Double(newValue));    }    catch (Exception ex) {      System.err.println(ex.getMessage());    }  }  /**   * Sets the value label position for one of the thermometers.   *   * @param thermometer  the thermometer index.   */  private void setShowValue(final int thermometer) {    if ((thermometer >= 0) && (thermometer < 3)) {        this.thermo[thermometer].setValueLocation(this.pickShow[thermometer].                                           getSelectedIndex());    }  }  /**   * Sets the axis position for one of the thermometers.   *   * @param thermometer  the thermometer index.   */  private void setShowAxis(final int thermometer) {    if ((thermometer >= 0) && (thermometer < 3)) {        this.thermo[thermometer].setShowAxisLocation(this.pickAxis[thermometer].                                           getSelectedIndex());    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -