Java İle Mors Alfabesinden İngilizceye İngilizceden Mors Alfabesine ÇevirMe
2 posters
1 sayfadaki 1 sayfası
Java İle Mors Alfabesinden İngilizceye İngilizceden Mors Alfabesine ÇevirMe
Artik güvenli ve istediginiz uzunluk ve charecter özellikleri tasiyan sifre genere edebilirsiniz
Kod:
http://1.File: GUI.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class GUI implements MouseListener{
private JFrame frame = null;
private JCheckBox chkBox1 = null;
private JCheckBox chkBox2 = null;
private JCheckBox chkBox3 = null;
private JCheckBox chkBox4 = null;
private JCheckBox chkBox5 = null;
private JTextField txtAnzahlZeichen = null;
private JTextField txtAnzahlPW = null;
private JButton cmdStart = null;
private JPanel panel1 = null;
private JPanel panel2 = null;
private JPanel mainPanel = null;
private JLabel lblTitel1 = null;
private JLabel lblTitel2 = null;
public GUI() {
frame = new JFrame("PWCreator");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.setResizable(false);
chkBox1 = new JCheckBox("a-z");
chkBox2 = new JCheckBox("A-Z");
chkBox3 = new JCheckBox("0-9");
chkBox4 = new JCheckBox("ozel isaretler");
chkBox5 = new JCheckBox("hepsi");
txtAnzahlZeichen = new JTextField();
txtAnzahlPW = new JTextField();
lblTitel1 = new JLabel("Sifrenin uzunlugu");
lblTitel2 = new JLabel("Sifrenin adeti");
cmdStart = new JButton("baslat");
cmdStart.addMouseListener(this);
panel1 = new JPanel(new GridLayout(5, 1));
panel2 = new JPanel(new GridLayout(5, 1));
mainPanel = new JPanel(new GridLayout(1, 2));
panel1.add(chkBox1);
panel1.add(chkBox2);
panel1.add(chkBox3);
panel1.add(chkBox4);
panel1.add(chkBox5);
panel2.add(lblTitel1);
panel2.add(txtAnzahlZeichen);
panel2.add(lblTitel2);
panel2.add(txtAnzahlPW);
panel2.add(cmdStart);
mainPanel.add(panel1);
mainPanel.add(panel2);
frame.setContentPane(mainPanel);
frame.pack();
frame.setVisible(true);
}
public **** mousePressed(MouseEvent e) {
Object source = e.getSource();
CreatePW createPW = null;
if(source == cmdStart) {
try {
int laengePW = Integer.parseInt(txtAnzahlZeichen.getText());
int anzahlPW = Integer.parseInt(txtAnzahlPW.getText());
createPW = new CreatePW("Temp.txt", laengePW, anzahlPW);
if(chkBox1.isSelected()) {
createPW.kleinbuchstaben();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox2.isSelected()) {
createPW.grossbuchstaben();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox3.isSelected()) {
createPW.zahlen();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox4.isSelected()) {
createPW.sonderzeichen();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox5.isSelected()) {
createPW.alle();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}
}catch(Exception exception) {
JOptionPane.showMessageDialog(null, exception.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
}
}
public **** mouseClicked(MouseEvent e) {}
public **** mouseEntered(MouseEvent e) {}
public **** mouseExited(MouseEvent e) {}
public **** mouseReleased(MouseEvent e) {}
}
http://2.File: CreatePW.java
import java.io.*;
public class CreatePW {
private String fileName = null;
private int anzahlPW = 0;
private int laengePW = 0;
private FileWriter fileWriter = null;
private BufferedWriter bufferedWriter = null;
public CreatePW(String fileName, int laengePW, int anzahlPW) throws Exception {
this.fileName = fileName;
if(laengePW <= 0 || anzahlPW <1) {
throw new IllegalArgumentException();
}
this.laengePW = laengePW;
this.anzahlPW = anzahlPW;
}
public **** grossbuchstaben() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 65 && zahl <= 90){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** kleinbuchstaben() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 97 && zahl <= 122){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** zahlen() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 48 && zahl <= 57){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** sonderzeichen() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if((zahl >= 32 && zahl <= 47)|| (zahl >=58 && zahl <=64) || (zahl >= 91 && zahl <= 96) || (zahl >= 123 && zahl <= 126)){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** alle() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 32 && zahl <= 126){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
}
http://3.File: Sub.java
public class Sub {
public static **** main (String[] args) {
new GUI();
}
}
#####################################
Kod:
http://1.File: GUI.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class GUI implements MouseListener{
private JFrame frame = null;
private JCheckBox chkBox1 = null;
private JCheckBox chkBox2 = null;
private JCheckBox chkBox3 = null;
private JCheckBox chkBox4 = null;
private JCheckBox chkBox5 = null;
private JTextField txtAnzahlZeichen = null;
private JTextField txtAnzahlPW = null;
private JButton cmdStart = null;
private JPanel panel1 = null;
private JPanel panel2 = null;
private JPanel mainPanel = null;
private JLabel lblTitel1 = null;
private JLabel lblTitel2 = null;
public GUI() {
frame = new JFrame("PWCreator");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.setResizable(false);
chkBox1 = new JCheckBox("a-z");
chkBox2 = new JCheckBox("A-Z");
chkBox3 = new JCheckBox("0-9");
chkBox4 = new JCheckBox("ozel isaretler");
chkBox5 = new JCheckBox("hepsi");
txtAnzahlZeichen = new JTextField();
txtAnzahlPW = new JTextField();
lblTitel1 = new JLabel("Sifrenin uzunlugu");
lblTitel2 = new JLabel("Sifrenin adeti");
cmdStart = new JButton("baslat");
cmdStart.addMouseListener(this);
panel1 = new JPanel(new GridLayout(5, 1));
panel2 = new JPanel(new GridLayout(5, 1));
mainPanel = new JPanel(new GridLayout(1, 2));
panel1.add(chkBox1);
panel1.add(chkBox2);
panel1.add(chkBox3);
panel1.add(chkBox4);
panel1.add(chkBox5);
panel2.add(lblTitel1);
panel2.add(txtAnzahlZeichen);
panel2.add(lblTitel2);
panel2.add(txtAnzahlPW);
panel2.add(cmdStart);
mainPanel.add(panel1);
mainPanel.add(panel2);
frame.setContentPane(mainPanel);
frame.pack();
frame.setVisible(true);
}
public **** mousePressed(MouseEvent e) {
Object source = e.getSource();
CreatePW createPW = null;
if(source == cmdStart) {
try {
int laengePW = Integer.parseInt(txtAnzahlZeichen.getText());
int anzahlPW = Integer.parseInt(txtAnzahlPW.getText());
createPW = new CreatePW("Temp.txt", laengePW, anzahlPW);
if(chkBox1.isSelected()) {
createPW.kleinbuchstaben();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox2.isSelected()) {
createPW.grossbuchstaben();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox3.isSelected()) {
createPW.zahlen();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox4.isSelected()) {
createPW.sonderzeichen();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox5.isSelected()) {
createPW.alle();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}
}catch(Exception exception) {
JOptionPane.showMessageDialog(null, exception.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
}
}
public **** mouseClicked(MouseEvent e) {}
public **** mouseEntered(MouseEvent e) {}
public **** mouseExited(MouseEvent e) {}
public **** mouseReleased(MouseEvent e) {}
}
http://2.File: CreatePW.java
import java.io.*;
public class CreatePW {
private String fileName = null;
private int anzahlPW = 0;
private int laengePW = 0;
private FileWriter fileWriter = null;
private BufferedWriter bufferedWriter = null;
public CreatePW(String fileName, int laengePW, int anzahlPW) throws Exception {
this.fileName = fileName;
if(laengePW <= 0 || anzahlPW <1) {
throw new IllegalArgumentException();
}
this.laengePW = laengePW;
this.anzahlPW = anzahlPW;
}
public **** grossbuchstaben() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 65 && zahl <= 90){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** kleinbuchstaben() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 97 && zahl <= 122){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** zahlen() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 48 && zahl <= 57){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** sonderzeichen() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if((zahl >= 32 && zahl <= 47)|| (zahl >=58 && zahl <=64) || (zahl >= 91 && zahl <= 96) || (zahl >= 123 && zahl <= 126)){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
public **** alle() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);
for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 32 && zahl <= 126){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}
}
http://3.File: Sub.java
public class Sub {
public static **** main (String[] args) {
new GUI();
}
}
#####################################
Geri: Java İle Mors Alfabesinden İngilizceye İngilizceden Mors Alfabesine ÇevirMe
bunlardan hiç birşey anlamıyorum. bide pc manyagıyım
Batu[han]- Mesaj Sayısı : 30
Kayıt tarihi : 24/06/09
Yaş : 28
Nerden : Uzaydan
1 sayfadaki 1 sayfası
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz