Hello,
How can I get rid of the header of a JFrame or a JInternalFrame?
For example, instead of having this kind of window:
=========
Title [-][x]
=========
Content
=========
I would like something like this
=========
Content
=========
I just need a container with borders which can be resizable by the user.
Just to elaborate the main problem that I'm looking for a solution now: I have a number of JInternalFrames inside a JDesktopPane which in turn is inside a JApplet. What I would like to do now is to get rid of the headers whilst the user could still drag them about, and resize them. It would not matter, for now, whether the desktop pane should be the parent or the applet should be the parent of the topless frames.
Some have advised me to use JWindows, however apparently they can't be child components of an applet. The .setUndecorated(true) method works only for a JFrame which again cannot be added into a JApplet. JInternalFrames do not possess .setUndecorated(boolean boo) method.
Any further ideas?
Thanks,
LD
Topless JFrame
Started by ld_pvl, Jul 15 2009 05:17 PM
9 replies to this topic
#1
Posted 15 July 2009 - 05:17 PM
|
|
|
#2
Posted 15 July 2009 - 09:42 PM
ld_pvl said:
Hello,
How can I get rid of the header of a JFrame or a JInternalFrame?
For example, instead of having this kind of window:
=========
Title [-][x]
=========
Content
=========
I would like something like this
=========
Content
=========
I just need a container with borders which can be resizable by the user.
Just to elaborate the main problem that I'm looking for a solution now: I have a number of JInternalFrames inside a JDesktopPane which in turn is inside a JApplet. What I would like to do now is to get rid of the headers whilst the user could still drag them about, and resize them. It would not matter, for now, whether the desktop pane should be the parent or the applet should be the parent of the topless frames.
Some have advised me to use JWindows, however apparently they can't be child components of an applet. The .setUndecorated(true) method works only for a JFrame which again cannot be added into a JApplet. JInternalFrames do not possess .setUndecorated(boolean boo) method.
Any further ideas?
Thanks,
LD
How can I get rid of the header of a JFrame or a JInternalFrame?
For example, instead of having this kind of window:
=========
Title [-][x]
=========
Content
=========
I would like something like this
=========
Content
=========
I just need a container with borders which can be resizable by the user.
Just to elaborate the main problem that I'm looking for a solution now: I have a number of JInternalFrames inside a JDesktopPane which in turn is inside a JApplet. What I would like to do now is to get rid of the headers whilst the user could still drag them about, and resize them. It would not matter, for now, whether the desktop pane should be the parent or the applet should be the parent of the topless frames.
Some have advised me to use JWindows, however apparently they can't be child components of an applet. The .setUndecorated(true) method works only for a JFrame which again cannot be added into a JApplet. JInternalFrames do not possess .setUndecorated(boolean boo) method.
Any further ideas?
Thanks,
LD
I guess you want something like this?
import java.io.*;
import javax.swing.*;
public class TestDialog extends JWindow {
static JWindow jw = new JWindow();
JPanel JP = new JPanel();
JLabel JL = new JLabel();
public TestDialog(JWindow JW) {
JW.setSize(640,480);
JW.setLocationRelativeTo(null);
JW.add(JP);
JP.add(JL);
JL.setText("Hello!");
JW.setVisible(true);
JW.show();
}
public static void main(String[] arg) throws IOException {
new TestDialog(jw);
}
}
[ATTACH]1774[/ATTACH]Cheers !
Attached Files
#3
Posted 15 July 2009 - 09:46 PM
Using JWindows does solve one matter but not the whole problem because I can't make JWindows as child components of an applet. What I would like is to have a main applet, in which I there are 4 windows, each of which is topless =]. As I explained in the previous post.
I have been trying to find the solution but yet to succeed in that.
Regards,
LD
I have been trying to find the solution but yet to succeed in that.
Regards,
LD
#4
Posted 15 July 2009 - 09:53 PM
ld_pvl said:
Using JWindows does solve one matter but not the whole problem because I can't make JWindows as child components of an applet. What I would like is to have a main applet, in which I there are 4 windows, each of which is topless =]. As I explained in the previous post.
I have been trying to find the solution but yet to succeed in that.
Regards,
LD
I have been trying to find the solution but yet to succeed in that.
Regards,
LD
Well here is one not mine.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Try
{
public void buildGUI()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame f = new JFrame();
f.setResizable(true);
removeMinMaxClose(f);
JPanel p = new JPanel(new GridBagLayout());
JButton btn = new JButton("Exit");
p.add(btn,new GridBagConstraints());
f.getContentPane().add(p);
f.setSize(400,300);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
System.exit(0);
}
});
}
public void removeMinMaxClose(Component comp)
{
if(comp instanceof AbstractButton)
{
comp.getParent().remove(comp);
}
if (comp instanceof Container)
{
Component[] comps = ((Container)comp).getComponents();
for(int x = 0, y = comps.length; x < y; x++)
{
removeMinMaxClose(comps[x]);
}
}
}
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable(){
public void run(){
new Try().buildGUI();
}
});
}
}
SourceHow to deactivate close, minimise and resizable from a window say frame? (Swing / AWT / SWT / JFace forum at JavaRanch)
#5
Posted 15 July 2009 - 10:47 PM
I tried your code but it's still doesn't give me the expected result. It still possess a header.
The code you gave me for the JWindow gives me exactly what I want it to look like, the only thing is I cannot put a JWindow into an applet.
I have been trying to find the solution all over the web and many other different forums. But yet, in vain.
Is there a way to remove some rootpane components from the JFrame or JInternalFrames themselves, so that we can remove the header?
The code you gave me for the JWindow gives me exactly what I want it to look like, the only thing is I cannot put a JWindow into an applet.
I have been trying to find the solution all over the web and many other different forums. But yet, in vain.
Is there a way to remove some rootpane components from the JFrame or JInternalFrames themselves, so that we can remove the header?
#6
Posted 15 July 2009 - 11:11 PM
ld_pvl said:
I tried your code but it's still doesn't give me the expected result. It still possess a header.
The code you gave me for the JWindow gives me exactly what I want it to look like, the only thing is I cannot put a JWindow into an applet.
I have been trying to find the solution all over the web and many other different forums. But yet, in vain.
Is there a way to remove some rootpane components from the JFrame or JInternalFrames themselves, so that we can remove the header?
The code you gave me for the JWindow gives me exactly what I want it to look like, the only thing is I cannot put a JWindow into an applet.
I have been trying to find the solution all over the web and many other different forums. But yet, in vain.
Is there a way to remove some rootpane components from the JFrame or JInternalFrames themselves, so that we can remove the header?
Well I tried one thing, it made the whole JFrame disappear !
#7
Posted 16 July 2009 - 03:51 AM
what about: Removing the title bar of the Frame in Java, How to Remove Title Bar in Java Awt
?
Don't hava java installed here so can't test to see it.
?
Don't hava java installed here so can't test to see it.
#8
Posted 16 July 2009 - 06:36 AM
I just tested it but it comes to what Turk4n has already done.
But anyway, thanks for your help a lot.
The case is closed =].
But anyway, thanks for your help a lot.
The case is closed =].
#9
Posted 17 July 2009 - 12:53 AM
I have been discussing on the same topic in another forum. Please visit this link for more information.
I apologize for not posting it earlier: Swing - Topless JFrame
I apologize for not posting it earlier: Swing - Topless JFrame
#10
Posted 19 July 2009 - 02:46 PM
The problem has been solved and an example is given in Sun's forums. Please follow the link above if you're interested.
Regards,
LD
Regards,
LD


Sign In
Create Account


Back to top










