console-application

JTextArea as console

冷暖自知 提交于 2019-11-28 00:13:25
I have posted two pieces of code below. Both codes work fine individually. Now, when I run the file Easy, and click on the "Start" button, I want the class AddNumber to be implemented. I mean to say that, instead of the AddNumber running on the console, is there any way I could make AddNumber run in the JTextArea i have created in the first class upon clicking the "Start" button? I thought maybe by action listener?(the way we do in case of buttons) But I'm not sure. Is there any other way to make my JTextArea act as a console for the other .java files? import java.awt.*; import javax.swing.*;

How to hide a console application in C#

依然范特西╮ 提交于 2019-11-27 23:27:06
I have a console application in C#, and I want that the user won't be able to see it. How can I do that? Compile it as a Windows Forms application. Then it won't display any UI, if you do not explicitly open any Windows. On ProjectProperties set Output Type as Windows Application. Sounds like you don't want a console application, but a windows GUI application that doesn't open a (visible) window. Create a console application "MyAppProxy" with following code, and put MyAppProxy in start up dir, public static void main(string[] args) { Process p = new Process("MyApp"); ProcessStartUpInfo pinfo =

Non-Blocking read from standard I/O in C# [closed]

╄→尐↘猪︶ㄣ 提交于 2019-11-27 22:46:13
I want a non-blocking read function from console. How do I write that in C#? var buf=new byte[2048]; var inputStream=Console.OpenStandardInput(); //dispose me when you're done inputStream.BeginRead(buf,0,buf.Length,ar=>{ int amtRead=inputStream.EndRead(ar); //buf has what you need. You'll need to decode it though },null); odrm Richard Dutton has a solution on his blog : while (true) { if (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(true); switch (key.Key) { case ConsoleKey.F1: Console.WriteLine("You pressed F1!"); break; default: break; } } // Do something more useful } 来源:

C# full screen console?

五迷三道 提交于 2019-11-27 22:14:40
问题 I have seen that Windows can switch to the very basic console interface when updating the video drivers and I have also seen programs like Borland C++ doing this. I'd really like to know how to make this with a console application in C# (or VB.NET if you prefer), and I don't mind using P/Invoke's (and I bet I must!). 回答1: In older versions of Windows you could put any console into full screen with Alt-Enter (if I remember correctly). With the introduction of the Desktop Window Manager and

Changing font in a Console window in .NET

懵懂的女人 提交于 2019-11-27 21:57:17
I have built a neat little Console app which basically interacts with ASP.NET projects on a users machine. I have a really trivial need, all I need to do is before I show the Console window, I need to have it a black background, a lime green foreground and a Lucida font. I could achieve the color part by using the static methods of Console class. Although there is nothing in the class which talks about changing fonts? Has anyone been able to change Console font programatically? Any help appreciated. Please don't do that on an application that is meant to be used from other users, unless they

C# Count Vowels

会有一股神秘感。 提交于 2019-11-27 21:36:50
I am learning to program C# and I am trying to count the vowels. I am getting the program to loop through the sentence, but instead of returning vowel count, it is just returning the length of the string. Any help would be greatly appreciated. static void Main() { int total = 0; Console.WriteLine("Enter a Sentence"); string sentence = Console.ReadLine().ToLower(); for (int i = 0; i < sentence.Length; i++) { if (sentence.Contains("a") || sentence.Contains("e") || sentence.Contains("i") || sentence.Contains("o") || sentence.Contains("u")) { total++; } } Console.WriteLine("Your total number of

How to determine if GraphicsEnvironment exists

徘徊边缘 提交于 2019-11-27 21:30:28
I have an application that needs user input for password. What i want to do is to either read the password from console (if the OS supports one e.g unix) or display a JOptionPane and ask the user to enter his password (if the OS supports graphical interface e.g windows). Some people may argue that a console will always be available in both the above cases so a console input will be sufficient. But problem is if the Java app starts using javaw.exe then a console is not available. Thus, i need a way to determine if i can do either case. My problem is how to determine if the environment that the

Console application with Java and gradle

时光怂恿深爱的人放手 提交于 2019-11-27 21:01:51
I am writing a console application with Java and gradle. I am using the application plugin and have the required fields correctly configured in build.gradle . In my main class I have BufferedReader linked with System.in . Here's the problem: When I run gradle run in project directory, the reader does not wait for my console input. BufferedReader#readLine instead returns null on the very first call. This behavior is not desirable for what am I doing. What is the solution? Is there a separate console application plugin for gradle or do I need to tweak application plugin somehow to suit my needs?

How does a Spring Boot console based application work?

烂漫一生 提交于 2019-11-27 20:04:24
问题 If I am developing a rather simple Spring Boot console-based application, I am unsure about the placement of the main execution code. Should I place it in the public static void main(String[] args) method, or have the main application class implement the CommandLineRunner interface and place the code in the run(String... args) method? I will use a example as the context. Say I have the following [rudimentary] application ( coded to interfaces, Spring style ): Application.java public class

Invoke or call C# console app from C# web service?

拥有回忆 提交于 2019-11-27 19:05:20
问题 Due to my problem that I am unable to run dos command via my web service. C# web service running batch file or dos command? Since I cannot make my web service run dos command directly, I am now thinking about creating C# console app that will run my dos command, then the console app will be invoked by web service. Is it possible to do so? 回答1: The easiest method to call a .Net console application from another .Net application is to link in the assembly, and invoke the static Main method