Using a CN1 Eclipse project from another one?
up vote
1
down vote
favorite
In Eclipse, I created one CN1 project and one normal Java project, which depends on the former. The latter contains some utilities (e.g., source code generation) and some JUnit tests. I use the following simple hack:
CodenameOneImplementation impl = new JavaSEPort();
Util.setImplementation(impl);
Display.init(impl);
It works, but there's a fullscreen window shown and the program doesn't terminate when main
is done. I know, that it's the normal behavior for GUI applications, but I don't need any GUI as I only initialized Display
, in order for Display#getResource
to work.
- How can I get rid of the window (or at least make it small)?
- How can I terminate the program without having to call
System.exit
(i.e., something like running the event handling thread as daemon)? - Is there more to set up?
java codenameone
add a comment |
up vote
1
down vote
favorite
In Eclipse, I created one CN1 project and one normal Java project, which depends on the former. The latter contains some utilities (e.g., source code generation) and some JUnit tests. I use the following simple hack:
CodenameOneImplementation impl = new JavaSEPort();
Util.setImplementation(impl);
Display.init(impl);
It works, but there's a fullscreen window shown and the program doesn't terminate when main
is done. I know, that it's the normal behavior for GUI applications, but I don't need any GUI as I only initialized Display
, in order for Display#getResource
to work.
- How can I get rid of the window (or at least make it small)?
- How can I terminate the program without having to call
System.exit
(i.e., something like running the event handling thread as daemon)? - Is there more to set up?
java codenameone
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In Eclipse, I created one CN1 project and one normal Java project, which depends on the former. The latter contains some utilities (e.g., source code generation) and some JUnit tests. I use the following simple hack:
CodenameOneImplementation impl = new JavaSEPort();
Util.setImplementation(impl);
Display.init(impl);
It works, but there's a fullscreen window shown and the program doesn't terminate when main
is done. I know, that it's the normal behavior for GUI applications, but I don't need any GUI as I only initialized Display
, in order for Display#getResource
to work.
- How can I get rid of the window (or at least make it small)?
- How can I terminate the program without having to call
System.exit
(i.e., something like running the event handling thread as daemon)? - Is there more to set up?
java codenameone
In Eclipse, I created one CN1 project and one normal Java project, which depends on the former. The latter contains some utilities (e.g., source code generation) and some JUnit tests. I use the following simple hack:
CodenameOneImplementation impl = new JavaSEPort();
Util.setImplementation(impl);
Display.init(impl);
It works, but there's a fullscreen window shown and the program doesn't terminate when main
is done. I know, that it's the normal behavior for GUI applications, but I don't need any GUI as I only initialized Display
, in order for Display#getResource
to work.
- How can I get rid of the window (or at least make it small)?
- How can I terminate the program without having to call
System.exit
(i.e., something like running the event handling thread as daemon)? - Is there more to set up?
java codenameone
java codenameone
asked Nov 21 at 1:48
maaartinus
26.5k2193221
26.5k2193221
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Use something like this:
JavaSEPort.setDefaultInitTarget(new JPanel());
This would draw the UI of the display into the blank JPanel
.
About exiting the app you would need to use System.exit(0)
as the EDT loop and native GUI loop are running. You can stop the EDT but that might not work well for the desktop port so just using exit is easy and common practice.
This didn't work, but brought me to the relevant code and withDisplay.init(new JPanel())
, the windows is gone.System.exit
is something, I can live with.
– maaartinus
Nov 21 at 16:31
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Use something like this:
JavaSEPort.setDefaultInitTarget(new JPanel());
This would draw the UI of the display into the blank JPanel
.
About exiting the app you would need to use System.exit(0)
as the EDT loop and native GUI loop are running. You can stop the EDT but that might not work well for the desktop port so just using exit is easy and common practice.
This didn't work, but brought me to the relevant code and withDisplay.init(new JPanel())
, the windows is gone.System.exit
is something, I can live with.
– maaartinus
Nov 21 at 16:31
add a comment |
up vote
1
down vote
accepted
Use something like this:
JavaSEPort.setDefaultInitTarget(new JPanel());
This would draw the UI of the display into the blank JPanel
.
About exiting the app you would need to use System.exit(0)
as the EDT loop and native GUI loop are running. You can stop the EDT but that might not work well for the desktop port so just using exit is easy and common practice.
This didn't work, but brought me to the relevant code and withDisplay.init(new JPanel())
, the windows is gone.System.exit
is something, I can live with.
– maaartinus
Nov 21 at 16:31
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Use something like this:
JavaSEPort.setDefaultInitTarget(new JPanel());
This would draw the UI of the display into the blank JPanel
.
About exiting the app you would need to use System.exit(0)
as the EDT loop and native GUI loop are running. You can stop the EDT but that might not work well for the desktop port so just using exit is easy and common practice.
Use something like this:
JavaSEPort.setDefaultInitTarget(new JPanel());
This would draw the UI of the display into the blank JPanel
.
About exiting the app you would need to use System.exit(0)
as the EDT loop and native GUI loop are running. You can stop the EDT but that might not work well for the desktop port so just using exit is easy and common practice.
answered Nov 21 at 5:08
Shai Almog
38.8k52553
38.8k52553
This didn't work, but brought me to the relevant code and withDisplay.init(new JPanel())
, the windows is gone.System.exit
is something, I can live with.
– maaartinus
Nov 21 at 16:31
add a comment |
This didn't work, but brought me to the relevant code and withDisplay.init(new JPanel())
, the windows is gone.System.exit
is something, I can live with.
– maaartinus
Nov 21 at 16:31
This didn't work, but brought me to the relevant code and with
Display.init(new JPanel())
, the windows is gone. System.exit
is something, I can live with.– maaartinus
Nov 21 at 16:31
This didn't work, but brought me to the relevant code and with
Display.init(new JPanel())
, the windows is gone. System.exit
is something, I can live with.– maaartinus
Nov 21 at 16:31
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404222%2fusing-a-cn1-eclipse-project-from-another-one%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown