简体   繁体   中英

How to convert Decimal to Binary Numbers in Java using JFrame?

I've been searching for all codes in the internet, but all I see is for Buffered Reader. Is it possible to have it in a JFrame format? I am new to Java and I wanted to create this program which will convert a decimal number to binary and vice versa. Can you help me how to do it?

Converting and rendering (displaying) are completely unrelated issues.

To convert, use Integer.parseInt() and Integer.toBinaryString() :

String input = "10"; // some number as your input
int i = Integer.parseInt(input);
String binary = Integer.toBinaryString(i);

To display, put that String into the display area (too trivial to bother with here)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM