Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I recently started using slick2D in my gaming programs and a problem I have is not having the ability to remove the border/titlebar. I usually do this to create my own cutom look/ interface but if I try:

this.setUndecorated(true);

It doesnt work.

How do you acheive this?

share|improve this question
    
Did you try setundecorated(true)?? –  Savlon Mar 26 '13 at 2:41
    
sorry i meant to write true @Savlon but where do i put this? –  Exikle Mar 26 '13 at 3:07
1  
I believe this has to be set before the window is created. So you'll need to create a launcher or somehow relaunch the existing window. –  Byte56 Mar 26 '13 at 4:14

2 Answers 2

up vote 0 down vote accepted

Originally I was using

AppGameContainer app = new AppGameContainer(new Game());

to create my game. However I wanted to set the frame to be undecorated. So I searched around and found that if you changed

AppGameContainer app = new AppGameContainer(new WizardGame());

to

CanvasGameContainerapp = new CanvasGameContainer(new Game());

so that its now a canvas and then add it to a JFrame and set that JFrame to undecorated, you would get a undecorated slick2D program.

CODE:

public static void main(String[] args) throws SlickException {
    JFrame frame = new JFrame();
    CanvasGameContainer app = new CanvasGameContainer(new Game());
    frame.setUndecorated(true);
    frame.setVisible(true);
    frame.add(app);
    frame.setSize(500, 500);
    app.start();
}

The only problem that i have with it is that i have to click it once to render the images. If i don't it just has a black screen. This could be because of my other code but I don't think it should happen for anyone else.

share|improve this answer

Ok so here is a basic application that has the title bar removed

public static void main(String[] args){
    JFrame frame = new JFrame("Without Title Bar Frame");
    frame.setUndecorated(true);
    frame.setSize(400,400);
    frame.setVisible(true);
  }

Paste the above code into a java class

Also be sure to import

import javax.swing.JFrame;

You see how frame.setUndecorated(true); is straight after the instantiation of the frame? Place yours in the same place and you will have no issue at all :)

EDIT: here is what I found which may work.

http://slick.javaunlimited.net/viewtopic.php?f=3&t=4978

http://codebrocken.blogspot.com.au/2012/03/java-creating-undecorated-window-with.html?m=1

But as it states in that post it isn't support yet.

share|improve this answer
    
this would work if i wasnt using slick2D but I am so it won't work because I'm not creating a JFrame –  Exikle Mar 26 '13 at 20:19
    
Hmm I see... So you are using Display to create your window? You can't create a full screen app? Have the surrounding areas of your window black? I'm not sure if Display has a setUndecorated method.. You may have to look through the slick2D API –  Savlon Mar 27 '13 at 1:33
    
i can create a full screen app (I just need to change false to true in this code : "app.setDisplayMode(FRAME_WIDTH, FRAME_HEIGHT, false);" –  Exikle Mar 27 '13 at 3:34
    
I found something that may work... Check my answer again –  Savlon Mar 27 '13 at 4:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.