4

How can I make bold the text in eclipse? To be more clear I give an example: we write in syntax

System.out.print("Name: "); String name = in.nextLine(); 

When we run the program the user should input the name: NAME: David I whant to make David bold and change the size

3
  • 1
    Possible of duplicate of stackoverflow.com/questions/6286701/…, or stackoverflow.com/questions/233790/… Commented Dec 14, 2011 at 19:23
  • 1
    "..in eclipse?" Exactly the same way you would do it in Netbeans, or IntelliJ, or notepad.. Or to put that another way, this has absolutely nothing to do with your IDE. Commented Dec 14, 2011 at 19:34
  • 1
    @eboix +1 for the second link Commented Dec 14, 2011 at 20:12

2 Answers 2

4

@Tomasz is completely correct. However, if you want to set a bold font on "most" terminals, you can write out

 private final String setPlainText = "\033[0;0m"; private final String setBoldText = "\033[0;1m"; 

e.g.

 System.out.println (setPlainText + "Prompt>" + setBoldText); 

This isn't quite universal, but it works for most all terminals in popular use. To get any fancier, you'll want to look at something like What's a good Java, curses-like, library for terminal applications? or switch to building a GUI, e.g. perhaps using Swing.

Sign up to request clarification or add additional context in comments.

Comments

1

Actually You can't change size of the font in text terminal. There is no such an information sent to terminal by Your application. (Only plain text is sent through the stream) This is possible and easy in graphic applications, made in Java and managed by Java API. Before You begin with these I advise You to start from some easy books or tutorials about Java essentials.

Essentials of the Java Programming Language, Part 1

By the way this is the code than can make Your task (excluding change of font size or font style)

 import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); String name = br.readLine(); System.out.print("Name: "+name); } } 

Only one thing possible to change using eclipse console is the font color of the output stream and error stream. (Right click on the console screen and preferences)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.