I'm fairly new to Java coding and I am trying to get a number from a double to display into a JSwing textbox.
The code I'm having trouble with:
txtCounter = new JTextField(); txtCounter.setText(counter); //Error here Jtextcomponent not available for Double txtCounter.setEditable(false); txtCounter.setToolTipText("Shows time that has passed."); txtCounter.setBounds(10, 69, 100, 20); frmTimer.getContentPane().add(txtCounter); txtCounter.setColumns(10);
Is their a different statement I could use for this case?
You'll need to pass a String representation of
setText(). Either of the following lines would work:
txtCounter.setText(counter + "");