Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 136,408 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,459 people online right now. Registration is fast and FREE... Join Now!




embarrasing question

 
Reply to this topicStart new topic

embarrasing question

ic3e
15 Oct, 2008 - 07:38 AM
Post #1

New D.I.C Head
*

Joined: 13 Oct, 2008
Posts: 18

CODE
import javax.swing.JOptionPane;
public class My {
  public static void main(String[] args) {
    // Display the table heading
    String output = "K";
    

    // Display the number title
    output += " 1    ";
    

    // Display result
    JOptionPane.showMessageDialog(null, output);
  }
}

im trying to format my 1 to be under k but i dont know how.
User is offlineProfile CardPM
+Quote Post

g00se
RE: Embarrasing Question
15 Oct, 2008 - 07:51 AM
Post #2

D.I.C Regular
Group Icon

Joined: 19 Sep, 2008
Posts: 455



Thanked: 38 times
My Contributions
Try

CODE
String output = "<html>K<br>1</html";

User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Embarrasing Question
15 Oct, 2008 - 07:53 AM
Post #3

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,022



Thanked: 81 times
Dream Kudos: 1175
My Contributions
Well, considering that the second parameter is the text for the window, you could do it like so:

Change this:
CODE
output += " 1    ";


To this:
CODE
output += "\n1    ";


\n is the new line character, so that should help.

User is offlineProfile CardPM
+Quote Post

ic3e
RE: Embarrasing Question
17 Oct, 2008 - 02:23 PM
Post #4

New D.I.C Head
*

Joined: 13 Oct, 2008
Posts: 18

thanks for the help guys.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 12:12PM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month