Java Ile Paralel Devrede Akım Ve Voltaj Hesabı Programı
Dönem Ödevi
Java ile Paralel Devrede Akım ve Voltaj Hesabı Programı
package desktopapplication2;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class DesktopApplication2View extends FrameView {
int toplama;
int çarpma;
int sonuç;
public DesktopApplication2View(SingleFrameApplication app) {
super(app);
initComponents();
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
messageTimer = new Timer(messageTimeout, new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusMessageLabel.setText("");
}
});
messageTimer.setRepeats(false);
int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
for (int i = 0; i < busyIcons.length; i++) {
busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
}
busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
public void actionPerformed(ActionEvent e) {
busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
}
});
idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if ("started".equals(propertyName)) {
if (!busyIconTimer.isRunning()) {
statusAnimationLabel.setIcon(busyIcons[0]);
busyIconIndex = 0;
busyIconTimer.start();
}
progressBar.setVisible(true);
progressBar.setIndeterminate(true);
} else if ("done".equals(propertyName)) {
busyIconTimer.stop();
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
progressBar.setValue(0);
} else if ("message".equals(propertyName)) {
String text = (String) (evt.getNewValue());
statusMessageLabel.setText((text == null) ? "" : text);
messageTimer.restart();
} else if ("progress".equals(propertyName)) {
int value = (Integer) (evt.getNewValue());
progressBar.setVisible(true);
progressBar.setIndeterminate(false);
progressBar.setValue(value);
}
}
});
}
@Action
public void showAboutBox() {
if (aboutBox == null) {
JFrame mainFrame = DesktopApplication2.getApplication().getMainFrame();
aboutBox = new DesktopApplication2AboutBox(mainFrame);
aboutBox.setLocationRelativeTo(mainFrame);
}
DesktopApplication2.getApplication().show(aboutBox);
}
@SuppressWarnings("unchecked")
private void jTextField5KeyPressed(java.awt.event.KeyEvent evt) {
}
private void jTextField5KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jTextField6KeyPressed(java.awt.event.KeyEvent evt) {
}
private void jTextField6KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jTextField10KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jTextField11KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jButton7MouseClicked(java.awt.event.MouseEvent evt) {
int voltaj;
voltaj = sonuç * Integer.parseInt(jTextField10.getText());
jLabel10.setText(Integer.toString(voltaj));
}
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
jLabel9.setText(Integer.toString(Integer.parseInt(jTextField11.getText()) / sonuç));
}
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
çarpma = Integer.parseInt(jTextField5.getText()) *fethi Integer.parseInt(jTextField6.getText());
toplama = Integer.parseInt(jTextField5.getText()) + Integer.parseInt(jTextField6.getText());
sonuç = çarpma / toplama;
jLabel7.setText(Integer.toString(sonuç));
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton7;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator10;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JSeparator jSeparator4;
private javax.swing.JSeparator jSeparator5;
private javax.swing.JSeparator jSeparator6;
private javax.swing.JSeparator jSeparator7;
private javax.swing.JSeparator jSeparator8;
private javax.swing.JSeparator jSeparator9;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JPanel mainPanel;
private javax.swing.JProgressBar progressBar;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
private javax.swing.JSeparator statusPanelSeparator;
// End of variables declaration
private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;
private JDialog aboutBox;
private void JEditorPane(String string) {
throw new UnsupportedOperationException("Not yet implemented");
}
}
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class DesktopApplication2View extends FrameView {
int toplama;
int çarpma;
int sonuç;
public DesktopApplication2View(SingleFrameApplication app) {
super(app);
initComponents();
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
messageTimer = new Timer(messageTimeout, new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusMessageLabel.setText("");
}
});
messageTimer.setRepeats(false);
int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
for (int i = 0; i < busyIcons.length; i++) {
busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
}
busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
public void actionPerformed(ActionEvent e) {
busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
}
});
idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if ("started".equals(propertyName)) {
if (!busyIconTimer.isRunning()) {
statusAnimationLabel.setIcon(busyIcons[0]);
busyIconIndex = 0;
busyIconTimer.start();
}
progressBar.setVisible(true);
progressBar.setIndeterminate(true);
} else if ("done".equals(propertyName)) {
busyIconTimer.stop();
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
progressBar.setValue(0);
} else if ("message".equals(propertyName)) {
String text = (String) (evt.getNewValue());
statusMessageLabel.setText((text == null) ? "" : text);
messageTimer.restart();
} else if ("progress".equals(propertyName)) {
int value = (Integer) (evt.getNewValue());
progressBar.setVisible(true);
progressBar.setIndeterminate(false);
progressBar.setValue(value);
}
}
});
}
@Action
public void showAboutBox() {
if (aboutBox == null) {
JFrame mainFrame = DesktopApplication2.getApplication().getMainFrame();
aboutBox = new DesktopApplication2AboutBox(mainFrame);
aboutBox.setLocationRelativeTo(mainFrame);
}
DesktopApplication2.getApplication().show(aboutBox);
}
@SuppressWarnings("unchecked")
private void jTextField5KeyPressed(java.awt.event.KeyEvent evt) {
}
private void jTextField5KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jTextField6KeyPressed(java.awt.event.KeyEvent evt) {
}
private void jTextField6KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jTextField10KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jTextField11KeyReleased(java.awt.event.KeyEvent evt) {
}
private void jButton7MouseClicked(java.awt.event.MouseEvent evt) {
int voltaj;
voltaj = sonuç * Integer.parseInt(jTextField10.getText());
jLabel10.setText(Integer.toString(voltaj));
}
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
jLabel9.setText(Integer.toString(Integer.parseInt(jTextField11.getText()) / sonuç));
}
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
çarpma = Integer.parseInt(jTextField5.getText()) *fethi Integer.parseInt(jTextField6.getText());
toplama = Integer.parseInt(jTextField5.getText()) + Integer.parseInt(jTextField6.getText());
sonuç = çarpma / toplama;
jLabel7.setText(Integer.toString(sonuç));
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton7;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator10;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JSeparator jSeparator4;
private javax.swing.JSeparator jSeparator5;
private javax.swing.JSeparator jSeparator6;
private javax.swing.JSeparator jSeparator7;
private javax.swing.JSeparator jSeparator8;
private javax.swing.JSeparator jSeparator9;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JPanel mainPanel;
private javax.swing.JProgressBar progressBar;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
private javax.swing.JSeparator statusPanelSeparator;
// End of variables declaration
private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;
private JDialog aboutBox;
private void JEditorPane(String string) {
throw new UnsupportedOperationException("Not yet implemented");
}
}
Çıkış Şekli ;
Direnç Hesaplama
Akım Hesaplama
Voltaj Hesaplama
Melike KORKMAZ
Yorumunuzu Ekleyin