0 Members and 1 Guest are viewing this topic.
What's so special about it?
What was ashbad's challenge? and downloaded, they look niceedit: though i'd suggest looking through the input strings to make sure you didn't put in ABCDEF and tried to convert it from binary to decimal.edit2: what was the source, by the way?
//Importsimport javax.swing.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class Main { public static void main(String[] args) { JFrame frame= new JFrame("MagiConverter"); JPanel panel=new JPanel(); final JLabel title = new JLabel("MagiConverter - Binary to Decimal"); JLabel empty = new JLabel(" "); final JTextField inputDecimal = new JTextField(25); final JTextField outputBinary = new JTextField(25); JButton convertButton = new JButton("Convert"); convertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String inputDecimalString = inputDecimal.getText(); int inputDecimalNumber; inputDecimalNumber = Integer.parseInt(inputDecimalString); int outputBinaryNumber = Integer.parseInt(inputDecimalString,2); outputBinary.setText(Integer.toString(outputBinaryNumber)); } }); frame.add(panel); panel.add(title); panel.add(empty); panel.add(empty); panel.add(inputDecimal); panel.add(convertButton); panel.add(outputBinary); frame.setSize(300,220); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);; } }
//Importsimport javax.swing.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class Main { public static void main(String[] args) { JFrame frame= new JFrame("MagiConverter"); JPanel panel=new JPanel(); final JLabel title = new JLabel("MagiConverter - Decimal to Binary"); JLabel empty = new JLabel(" "); final JTextField inputDecimal = new JTextField(25); final JTextField outputBinary = new JTextField(25); JButton convertButton = new JButton("Convert"); convertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String inputDecimalString = inputDecimal.getText(); int inputDecimalNumber; inputDecimalNumber = Integer.parseInt(inputDecimalString); String outputBinaryNumber = Integer.toBinaryString(inputDecimalNumber); outputBinary.setText(outputBinaryNumber); } }); frame.add(panel); panel.add(title); panel.add(empty); panel.add(empty); panel.add(inputDecimal); panel.add(convertButton); panel.add(outputBinary); frame.setSize(300,220); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);; } }
Nice I guess that can be kinda useful sometimes when you don't want to search for a converter site everytime you want to convert a huge string of data to hex to paste in an Axe program.