does anyone know how to fill the JTable with the binary values such as if we have 2 variables a and b the table should be filled in as follows:

a b
1 1
1 0
0 1
0 0

any suggestions would be useful..

thanks

Recommended Answers

All 4 Replies

does anyone know how to fill the JTable with the binary values such as if we have 2 variables a and b the table should be filled in as follows:

a b
1 1
1 0
0 1
0 0

any suggestions would be useful..

thanks

well to convert a string to binary look here:http://stackoverflow.com/questions/917163/convert-a-string-like-testing123-to-binary-in-java
after that you just use the method in the jTable setValueAt(Object aValue, int row, int column) method to do the rest. Take a look here for more information on JTables:http://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html

i dont want to get the binary representation of a string i need to create a truth table in java?

i dont want to get the binary representation of a string i need to create a truth table in java?

well it would have helped to mention that in your first post, look here for help on that:http://www.roseindia.net/java/master-java/java-truth.shtml however it does not really show how to do this in a table but im sure you can adapt it

oh thank you so much i will look at that .. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.