Ich habe ein Problem, und zwar will ich ein kleines Programm schreiben bei der Zahlen in Hexcode umgewandelt werden können aber ich krieg es nich nicht den wert aus comp in comp2 umzuwandeln.
Hier ist mein Code:
Ich hoffe auf eure Hilfe.
Hier ist mein Code:
Java:
import javax.swing.*;
import java.awt.*;
public class Hexwindow{
JFrame jf;
int compinhalt2;
String compinhalt;
Hexwindow(){
jf = new JFrame();
jf.getContentPane().setLayout(null);
JTextArea comp = new JTextArea(Integer.toString(compinhalt2));
comp.setBounds(20,20,100,20);
JTextArea comp2 = new JTextArea(Integer.toHexString(compinhalt2));
comp2.setBounds(200,20,100,20);
comp2.setEditable(false);
jf.getContentPane().add(comp);
jf.getContentPane().add(comp2);
jf.getContentPane().setBackground(SystemColor.control);
jf.setSize(400,200);
jf.setTitle("Hexrechner");
jf.setVisible(true);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args){
new Hexwindow();
}
}
Zuletzt bearbeitet: