Please help with Ceaser Cipher in JavaFX!! Here is my code: package testweek8; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import java.io.*; import java.util.List;
Please help with Ceaser Cipher in JavaFX!!
Here is my code:
package testweek8;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.io.*;
import java.util.List;
public class TestWeek8 {
private static int constant;
private static String alphabet;
public static void main (String[]args) {
displayMenu();
getPhrase();
}
private Static ActionListener;
myActionListener;
public void loadData(){
char[] alphabet;
for (char c = 'a';c <= 'z'; ++c) {
alphabet [c - 'a'] = c;
}
}
public static void displayMenu(){
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.setBackground(Color.darkGray);
panel.setLayout(new BoxLayout.LINE _Axis);
JButton button1 = new JButton("Decode a message");
button1.addActionListner(myActionListner);
JButton button2 = new JButton("Encode a message");
button2.addActionListner(myActionListner);
JButton button3 = new JButton("Display a message");
button1.addActionListner(myActionListner);
JButton button4 = new JButton("Exit the program");
button1.addActionListner(myActionListner);
panel1.add(button1);
panel1.add(button2);
panel1.add(button3);
panel1.add(button4);
frame.getContentPane().add(BorderLayout.Center.panel);
frame.setSize(575,300);
frame.setVisible(true);
}
public static void getPhrase(){
JTextField(" ");
System.out.printlnfield.getText());
}
public String encodeMessage(String field) {
int coded;
int temp;
StringBuffer s = new StringBuffer();
String Field;
field = field.toLowerCase();
for(int index = 0; index<field.length();index++){
temp = findNum(field.charAt(index));
if(temp! = -1) {
coded multi = findNum(field.charAt(index))+constant;
if(coded>25) {
temp = coded/26;
coded = coded-(temp*26);}
What I'm trying to do is this: The GUI that you will develop is the “front-end” of the project. The “back-end” is the translate() method that you will (re-)use. I also should mention that this all needs to be done in Netbeans.
I keep getting this message when I run it:
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images