F
F
first_kiss2014-11-26 19:26:02
Java
first_kiss, 2014-11-26 19:26:02

How to find out in a Java program which mode is running: console or GUI?

My program is written in Swing (i.e. there are forms that open when the program starts). I also need to run the program in console mode without running these forms. I implemented this using the xvfb program. It launches the program and executes the code, but only what I wrote with System.out.println() or the like is displayed in the console. It is necessary for me to execute one function in the program either on pressing of the button, or at start from the console. I would like to know how to find out which mode is running? (in the program code)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mamkaololosha, 2014-11-26
@first_kiss

Write 2 implementations and, by the cmd parameter, launch either new Frame or some console one.

R
relgames, 2014-11-27
@relgames

https://docs.oracle.com/javase/7/docs/api/java/awt...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question