How can I do a simple line break? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How can I do a simple line break?

galvlogalvlo Posts: 17Member
Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.

There is a point in the game where I'd like to have it say:

Game
Over

rather than:

Game Over

How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
«134

Comments

  • zibadianzibadian Posts: 6,349Member
    : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    :
    : There is a point in the game where I'd like to have it say:
    :
    : Game
    : Over
    :
    : rather than:
    :
    : Game Over
    :
    : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    :
    You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    [code]
    lineSeparator = (String) java.security.AccessController.doPrivileged(
    new sun.security.action.GetPropertyAction("line.separator"));
    [/code]
  • galvlogalvlo Posts: 17Member
    : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : :
    : : There is a point in the game where I'd like to have it say:
    : :
    : : Game
    : : Over
    : :
    : : rather than:
    : :
    : : Game Over
    : :
    : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : :
    : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : [code]
    : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : new sun.security.action.GetPropertyAction("line.separator"));
    : [/code]
    :


    Wow, where or how would I implement that?
  • zibadianzibadian Posts: 6,349Member
    [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : :
    : : : There is a point in the game where I'd like to have it say:
    : : :
    : : : Game
    : : : Over
    : : :
    : : : rather than:
    : : :
    : : : Game Over
    : : :
    : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : :
    : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : [code]
    : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : new sun.security.action.GetPropertyAction("line.separator"));
    : : [/code]
    : :
    :
    :
    : Wow, where or how would I implement that?
    :
    Here's a small code based on an applet:
    [code]
    public void init() {
    String lineSeparator = ....
    JLabel label = new JLabel("Hello"+lineSeparator+"world");
    add(label);
    }
    [/code]
    I've omitted the full line for getting the lineSeparator for readability.
    You might want to make a utility class with a static method to get the line separator.


  • galvlogalvlo Posts: 17Member
    : [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : : :
    : : : : There is a point in the game where I'd like to have it say:
    : : : :
    : : : : Game
    : : : : Over
    : : : :
    : : : : rather than:
    : : : :
    : : : : Game Over
    : : : :
    : : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : : :
    : : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : : [code]
    : : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : : new sun.security.action.GetPropertyAction("line.separator"));
    : : : [/code]
    : : :
    : :
    : :
    : : Wow, where or how would I implement that?
    : :
    : Here's a small code based on an applet:
    : [code]
    : public void init() {
    : String lineSeparator = ....
    : JLabel label = new JLabel("Hello"+lineSeparator+"world");
    : add(label);
    : }
    : [/code]
    : I've omitted the full line for getting the lineSeparator for readability.
    : You might want to make a utility class with a static method to get the line separator.
    :
    :
    :


    I appreciate the help...I really do. However I said I was a beginner and assuming I know things like making a utility class still keeps me in the dark :).
  • zibadianzibadian Posts: 6,349Member
    : : [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : : : :
    : : : : : There is a point in the game where I'd like to have it say:
    : : : : :
    : : : : : Game
    : : : : : Over
    : : : : :
    : : : : : rather than:
    : : : : :
    : : : : : Game Over
    : : : : :
    : : : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : : : :
    : : : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : : : [code]
    : : : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : : : new sun.security.action.GetPropertyAction("line.separator"));
    : : : : [/code]
    : : : :
    : : :
    : : :
    : : : Wow, where or how would I implement that?
    : : :
    : : Here's a small code based on an applet:
    : : [code]
    : : public void init() {
    : : String lineSeparator = ....
    : : JLabel label = new JLabel("Hello"+lineSeparator+"world");
    : : add(label);
    : : }
    : : [/code]
    : : I've omitted the full line for getting the lineSeparator for readability.
    : : You might want to make a utility class with a static method to get the line separator.
    : :
    : :
    : :
    :
    :
    : I appreciate the help...I really do. However I said I was a beginner and assuming I know things like making a utility class still keeps me in the dark :).
    :
    Simply make a class, which you set aside from this project, but use in this project. In the next project you can then also use this class and its methods. The methods should be general enough to be useful in any project. For example:
    [code]
    public final class UsefulStrings {

    private static String lineSeparator = (String) java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator"));

    public static String getLineSeparator() {
    return lineSeparator;
    }

    public static String getFilePathSeparator() {
    return filePathSeparator;
    // Returns backslash on windows, slash on linux, etc.
    }

    public static String nextIntegerValueAsString(int value) {
    return Integer.toString(value+1);
    // Example of a general task, if you need that in a lot of projects.
    }
    }
    [/code]
    This way you only need to call:
    [code]
    JLabel l = new JLabel("hello"+UsefulStrings.getLineSeparator()+"world");
    [/code]
    to make a multiline label.
  • galvlogalvlo Posts: 17Member
    : : : [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : : : : :
    : : : : : : There is a point in the game where I'd like to have it say:
    : : : : : :
    : : : : : : Game
    : : : : : : Over
    : : : : : :
    : : : : : : rather than:
    : : : : : :
    : : : : : : Game Over
    : : : : : :
    : : : : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : : : : :
    : : : : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : : : : [code]
    : : : : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : : : : new sun.security.action.GetPropertyAction("line.separator"));
    : : : : : [/code]
    : : : : :
    : : : :
    : : : :
    : : : : Wow, where or how would I implement that?
    : : : :
    : : : Here's a small code based on an applet:
    : : : [code]
    : : : public void init() {
    : : : String lineSeparator = ....
    : : : JLabel label = new JLabel("Hello"+lineSeparator+"world");
    : : : add(label);
    : : : }
    : : : [/code]
    : : : I've omitted the full line for getting the lineSeparator for readability.
    : : : You might want to make a utility class with a static method to get the line separator.
    : : :
    : : :
    : : :
    : :
    : :
    : : I appreciate the help...I really do. However I said I was a beginner and assuming I know things like making a utility class still keeps me in the dark :).
    : :
    : Simply make a class, which you set aside from this project, but use in this project. In the next project you can then also use this class and its methods. The methods should be general enough to be useful in any project. For example:
    : [code]
    : public final class UsefulStrings {
    :
    : private static String lineSeparator = (String) java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator"));
    :
    : public static String getLineSeparator() {
    : return lineSeparator;
    : }
    :
    : public static String getFilePathSeparator() {
    : return filePathSeparator;
    : // Returns backslash on windows, slash on linux, etc.
    : }
    :
    : public static String nextIntegerValueAsString(int value) {
    : return Integer.toString(value+1);
    : // Example of a general task, if you need that in a lot of projects.
    : }
    : }
    : [/code]
    : This way you only need to call:
    : [code]
    : JLabel l = new JLabel("hello"+UsefulStrings.getLineSeparator()+"world");
    : [/code]
    : to make a multiline label.
    :


    Ok, by making a class, is that an individual file all by itself which can be called upon ever time I need the line separator or would the code you put above need to be included in the file that I need the lines separated? If so, where in the file should it go? And if it is a separate file, what should it be called?

    Thanks for replying to me :).
  • galvlogalvlo Posts: 17Member
    : : : : [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : : : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : : : : : :
    : : : : : : : There is a point in the game where I'd like to have it say:
    : : : : : : :
    : : : : : : : Game
    : : : : : : : Over
    : : : : : : :
    : : : : : : : rather than:
    : : : : : : :
    : : : : : : : Game Over
    : : : : : : :
    : : : : : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : : : : : :
    : : : : : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : : : : : [code]
    : : : : : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : : : : : new sun.security.action.GetPropertyAction("line.separator"));
    : : : : : : [/code]
    : : : : : :
    : : : : :
    : : : : :
    : : : : : Wow, where or how would I implement that?
    : : : : :
    : : : : Here's a small code based on an applet:
    : : : : [code]
    : : : : public void init() {
    : : : : String lineSeparator = ....
    : : : : JLabel label = new JLabel("Hello"+lineSeparator+"world");
    : : : : add(label);
    : : : : }
    : : : : [/code]
    : : : : I've omitted the full line for getting the lineSeparator for readability.
    : : : : You might want to make a utility class with a static method to get the line separator.
    : : : :
    : : : :
    : : : :
    : : :
    : : :
    : : : I appreciate the help...I really do. However I said I was a beginner and assuming I know things like making a utility class still keeps me in the dark :).
    : : :
    : : Simply make a class, which you set aside from this project, but use in this project. In the next project you can then also use this class and its methods. The methods should be general enough to be useful in any project. For example:
    : : [code]
    : : public final class UsefulStrings {
    : :
    : : private static String lineSeparator = (String) java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator"));
    : :
    : : public static String getLineSeparator() {
    : : return lineSeparator;
    : : }
    : :
    : : public static String getFilePathSeparator() {
    : : return filePathSeparator;
    : : // Returns backslash on windows, slash on linux, etc.
    : : }
    : :
    : : public static String nextIntegerValueAsString(int value) {
    : : return Integer.toString(value+1);
    : : // Example of a general task, if you need that in a lot of projects.
    : : }
    : : }
    : : [/code]
    : : This way you only need to call:
    : : [code]
    : : JLabel l = new JLabel("hello"+UsefulStrings.getLineSeparator()+"world");
    : : [/code]
    : : to make a multiline label.
    : :
    :
    :
    : Ok, by making a class, is that an individual file all by itself which can be called upon ever time I need the line separator or would the code you put above need to be included in the file that I need the lines separated? If so, where in the file should it go? And if it is a separate file, what should it be called?
    :
    : Thanks for replying to me :).
    :


    Did a little playing around and I think I see what you're getting at. But what if I wanted to just include it in the file where it was needed? Could I use a snippet of code from the example you gave in the file I need?
  • zibadianzibadian Posts: 6,349Member
    : : : : : [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : : : : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : : : : : : :
    : : : : : : : : There is a point in the game where I'd like to have it say:
    : : : : : : : :
    : : : : : : : : Game
    : : : : : : : : Over
    : : : : : : : :
    : : : : : : : : rather than:
    : : : : : : : :
    : : : : : : : : Game Over
    : : : : : : : :
    : : : : : : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : : : : : : :
    : : : : : : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : : : : : : [code]
    : : : : : : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : : : : : : new sun.security.action.GetPropertyAction("line.separator"));
    : : : : : : : [/code]
    : : : : : : :
    : : : : : :
    : : : : : :
    : : : : : : Wow, where or how would I implement that?
    : : : : : :
    : : : : : Here's a small code based on an applet:
    : : : : : [code]
    : : : : : public void init() {
    : : : : : String lineSeparator = ....
    : : : : : JLabel label = new JLabel("Hello"+lineSeparator+"world");
    : : : : : add(label);
    : : : : : }
    : : : : : [/code]
    : : : : : I've omitted the full line for getting the lineSeparator for readability.
    : : : : : You might want to make a utility class with a static method to get the line separator.
    : : : : :
    : : : : :
    : : : : :
    : : : :
    : : : :
    : : : : I appreciate the help...I really do. However I said I was a beginner and assuming I know things like making a utility class still keeps me in the dark :).
    : : : :
    : : : Simply make a class, which you set aside from this project, but use in this project. In the next project you can then also use this class and its methods. The methods should be general enough to be useful in any project. For example:
    : : : [code]
    : : : public final class UsefulStrings {
    : : :
    : : : private static String lineSeparator = (String) java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator"));
    : : :
    : : : public static String getLineSeparator() {
    : : : return lineSeparator;
    : : : }
    : : :
    : : : public static String getFilePathSeparator() {
    : : : return filePathSeparator;
    : : : // Returns backslash on windows, slash on linux, etc.
    : : : }
    : : :
    : : : public static String nextIntegerValueAsString(int value) {
    : : : return Integer.toString(value+1);
    : : : // Example of a general task, if you need that in a lot of projects.
    : : : }
    : : : }
    : : : [/code]
    : : : This way you only need to call:
    : : : [code]
    : : : JLabel l = new JLabel("hello"+UsefulStrings.getLineSeparator()+"world");
    : : : [/code]
    : : : to make a multiline label.
    : : :
    : :
    : :
    : : Ok, by making a class, is that an individual file all by itself which can be called upon ever time I need the line separator or would the code you put above need to be included in the file that I need the lines separated? If so, where in the file should it go? And if it is a separate file, what should it be called?
    : :
    : : Thanks for replying to me :).
    : :
    :
    :
    : Did a little playing around and I think I see what you're getting at. But what if I wanted to just include it in the file where it was needed? Could I use a snippet of code from the example you gave in the file I need?
    :
    You can import the class and then call all of its methods, without needing to copy-paste anything. Just like the example in my last code.
  • galvlogalvlo Posts: 17Member
    : : : : : : [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : : : : : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : : : : : : : :
    : : : : : : : : : There is a point in the game where I'd like to have it say:
    : : : : : : : : :
    : : : : : : : : : Game
    : : : : : : : : : Over
    : : : : : : : : :
    : : : : : : : : : rather than:
    : : : : : : : : :
    : : : : : : : : : Game Over
    : : : : : : : : :
    : : : : : : : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : : : : : : : :
    : : : : : : : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : : : : : : : [code]
    : : : : : : : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : : : : : : : new sun.security.action.GetPropertyAction("line.separator"));
    : : : : : : : : [/code]
    : : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : : Wow, where or how would I implement that?
    : : : : : : :
    : : : : : : Here's a small code based on an applet:
    : : : : : : [code]
    : : : : : : public void init() {
    : : : : : : String lineSeparator = ....
    : : : : : : JLabel label = new JLabel("Hello"+lineSeparator+"world");
    : : : : : : add(label);
    : : : : : : }
    : : : : : : [/code]
    : : : : : : I've omitted the full line for getting the lineSeparator for readability.
    : : : : : : You might want to make a utility class with a static method to get the line separator.
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : :
    : : : : :
    : : : : : I appreciate the help...I really do. However I said I was a beginner and assuming I know things like making a utility class still keeps me in the dark :).
    : : : : :
    : : : : Simply make a class, which you set aside from this project, but use in this project. In the next project you can then also use this class and its methods. The methods should be general enough to be useful in any project. For example:
    : : : : [code]
    : : : : public final class UsefulStrings {
    : : : :
    : : : : private static String lineSeparator = (String) java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator"));
    : : : :
    : : : : public static String getLineSeparator() {
    : : : : return lineSeparator;
    : : : : }
    : : : :
    : : : : public static String getFilePathSeparator() {
    : : : : return filePathSeparator;
    : : : : // Returns backslash on windows, slash on linux, etc.
    : : : : }
    : : : :
    : : : : public static String nextIntegerValueAsString(int value) {
    : : : : return Integer.toString(value+1);
    : : : : // Example of a general task, if you need that in a lot of projects.
    : : : : }
    : : : : }
    : : : : [/code]
    : : : : This way you only need to call:
    : : : : [code]
    : : : : JLabel l = new JLabel("hello"+UsefulStrings.getLineSeparator()+"world");
    : : : : [/code]
    : : : : to make a multiline label.
    : : : :
    : : :
    : : :
    : : : Ok, by making a class, is that an individual file all by itself which can be called upon ever time I need the line separator or would the code you put above need to be included in the file that I need the lines separated? If so, where in the file should it go? And if it is a separate file, what should it be called?
    : : :
    : : : Thanks for replying to me :).
    : : :
    : :
    : :
    : : Did a little playing around and I think I see what you're getting at. But what if I wanted to just include it in the file where it was needed? Could I use a snippet of code from the example you gave in the file I need?
    : :
    : You can import the class and then call all of its methods, without needing to copy-paste anything. Just like the example in my last code.
    :


    I tried that. I tried to create an entire new class with the code you gave and I kept getting an error on the line:

    return filePathSeparator;

    Still, could I use a bit of the code in the file where I need the line break as needed? If so, how can I do this? I'm trying to learn this and I'd like to see what my options are, what else will work, etc.
  • zibadianzibadian Posts: 6,349Member
    : : : : : : : [b][red]This message was edited by zibadian at 2007-4-13 2:18:39[/red][/b][hr]
    : : : : : : : : : : Sounds simple enough but for the life of me I can't find anything to show me how to do this no matter how much I search. I mentioned in another thread that I am a beginning Java programmer and I am picking apart simple open source games (in this case, Tetris) to see how they work.
    : : : : : : : : : :
    : : : : : : : : : : There is a point in the game where I'd like to have it say:
    : : : : : : : : : :
    : : : : : : : : : : Game
    : : : : : : : : : : Over
    : : : : : : : : : :
    : : : : : : : : : : rather than:
    : : : : : : : : : :
    : : : : : : : : : : Game Over
    : : : : : : : : : :
    : : : : : : : : : : How can I do this? I believe C++ has something to the effect of "/n" to accomplish this.
    : : : : : : : : : :
    : : : : : : : : : You can do the same in Java, although the problem is that the various OSes have different line endings. You can get the line ending using this code:
    : : : : : : : : : [code]
    : : : : : : : : : lineSeparator = (String) java.security.AccessController.doPrivileged(
    : : : : : : : : : new sun.security.action.GetPropertyAction("line.separator"));
    : : : : : : : : : [/code]
    : : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : : Wow, where or how would I implement that?
    : : : : : : : :
    : : : : : : : Here's a small code based on an applet:
    : : : : : : : [code]
    : : : : : : : public void init() {
    : : : : : : : String lineSeparator = ....
    : : : : : : : JLabel label = new JLabel("Hello"+lineSeparator+"world");
    : : : : : : : add(label);
    : : : : : : : }
    : : : : : : : [/code]
    : : : : : : : I've omitted the full line for getting the lineSeparator for readability.
    : : : : : : : You might want to make a utility class with a static method to get the line separator.
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : :
    : : : : : :
    : : : : : : I appreciate the help...I really do. However I said I was a beginner and assuming I know things like making a utility class still keeps me in the dark :).
    : : : : : :
    : : : : : Simply make a class, which you set aside from this project, but use in this project. In the next project you can then also use this class and its methods. The methods should be general enough to be useful in any project. For example:
    : : : : : [code]
    : : : : : public final class UsefulStrings {
    : : : : :
    : : : : : private static String lineSeparator = (String) java.security.AccessController.doPrivileged(new sun.security.action.GetPropertyAction("line.separator"));
    : : : : :
    : : : : : public static String getLineSeparator() {
    : : : : : return lineSeparator;
    : : : : : }
    : : : : :
    : : : : : public static String getFilePathSeparator() {
    : : : : : return filePathSeparator;
    : : : : : // Returns backslash on windows, slash on linux, etc.
    : : : : : }
    : : : : :
    : : : : : public static String nextIntegerValueAsString(int value) {
    : : : : : return Integer.toString(value+1);
    : : : : : // Example of a general task, if you need that in a lot of projects.
    : : : : : }
    : : : : : }
    : : : : : [/code]
    : : : : : This way you only need to call:
    : : : : : [code]
    : : : : : JLabel l = new JLabel("hello"+UsefulStrings.getLineSeparator()+"world");
    : : : : : [/code]
    : : : : : to make a multiline label.
    : : : : :
    : : : :
    : : : :
    : : : : Ok, by making a class, is that an individual file all by itself which can be called upon ever time I need the line separator or would the code you put above need to be included in the file that I need the lines separated? If so, where in the file should it go? And if it is a separate file, what should it be called?
    : : : :
    : : : : Thanks for replying to me :).
    : : : :
    : : :
    : : :
    : : : Did a little playing around and I think I see what you're getting at. But what if I wanted to just include it in the file where it was needed? Could I use a snippet of code from the example you gave in the file I need?
    : : :
    : : You can import the class and then call all of its methods, without needing to copy-paste anything. Just like the example in my last code.
    : :
    :
    :
    : I tried that. I tried to create an entire new class with the code you gave and I kept getting an error on the line:
    :
    : return filePathSeparator;
    :
    : Still, could I use a bit of the code in the file where I need the line break as needed? If so, how can I do this? I'm trying to learn this and I'd like to see what my options are, what else will work, etc.
    :
    I'm guessing the gravitational constant is wrong at the location of your computer, so moving your computer to a different room might solve the problem. Or if I'm wrong then it might not. Anyways reading the error should explain what you're doing wrong, and what a solution might be.
    Note: I'm not psychic or a hacker, so I don't know the error unless you tell me.
«134
Sign In or Register to comment.