Canvas/Undecorated JFrame Trouble

TIA for any light on the following thing.
I'm trying to add a java.awt.Canvas to the Center of a JPanel which is in turn in the Center of the JFrame. When the JGrame uses the default decorations (setUndecorated(false)), everything works OK, including the layout and resizing.
When I switch to Swing- provided window decorations (setUndecorated(true)), there apperars a strange problem with resizing. The frame can me maximixed, restored and enlarged by a mouse drag quite successfully, but it can't be made smaller by mouse drag on the resize corners.
What happens, and is there any fix?
TIA Gary

I have the same problem...
I've set in my JFrame setUndecorated(true), plus adding a Panel with GridBagLayout to its ContentPane. Whenever I use GridBagConstraints.BOTH, this problem would happen..
Anyboy gets an idea?
Thanks!

Similar Messages

  • How to create 3 Fullscreen Undecorated JFrame with TextField and Button on

    I want to design a GUI which consists of Fullscreen Undecorated JFrame and It must be running like a kiosk
    So how to deal with as each Jframe will create a new object and it is impossible to manage the heap sapce

    harshal_2010 wrote:
    I want to design a GUI which consists of Fullscreen Undecorated JFrame Good for you, what have you done so far.
    and It must be running like a kiosksee reply #1
    So how to deal with as each Jframe will create a new object
    MyJFrame f = new JFrame("MyJFrame #1");
    and it is impossible to manage the heap sapceYes, you make sure you remove all references to your objects when you no longer need them and Java will do the rest with the GC.

  • Undecorated jframe resize problem

    i created a custom jframe look by setting a jframe to undecorated and designing my own maximize/minimize/close buttons and other things to improve its appearence
    the problem is that when set to undercorated all the default resizing/move methods are gone
    i tried implementing my own resize methods, they seem to work but it flashes like crazy while resizing
    anyone have any idea how to stop all the flashing or a better way to implement this?
    the following is a small example of the problem i am having, i only implemented the north resize part so the code can be easier to read.
    thnx in advance
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.imageio.*;
    import java.io.*;
    import java.awt.image.BufferedImage;
    public class TestFrame extends JFrame implements MouseMotionListener, MouseListener
         Point sp;
         int     compStartHeight;
         int minHeight = 100;
         JPanel frameContent = new JPanel();
         public TestFrame()
              super("testing frame");
              setSize(600, 600);
              setContentPane(frameContent);
              frameContent.setBackground(Color.black);
              frameContent.setLayout(new BoxLayout(frameContent, BoxLayout.Y_AXIS));     
              setUndecorated(true);
              addMouseMotionListener(this);
              addMouseListener(this);
              JButton testButton = new JButton("TEST");
              JButton testButton2 = new JButton ("TEST2");
              frameContent.add(testButton);
              frameContent.add(Box.createVerticalGlue());
              frameContent.add(testButton2);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setVisible(true);
         public void mouseMoved(MouseEvent e)
              Point p = e.getPoint();
              if (p.y > e.getComponent().getSize().height - 5)
                   setCursor( Cursor.getPredefinedCursor( Cursor.N_RESIZE_CURSOR ));
              else
                   setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR));
         public void mouseDragged(MouseEvent e)
              Point p = e.getPoint();
              int compWidth = getSize().width;
              if (getCursor().getType() == Cursor.N_RESIZE_CURSOR)
                   int nextHeight = compStartHeight+p.y-sp.y;
                   if (nextHeight > minHeight)
                        setSize(compWidth,nextHeight);
                        validate();
              else
                   int x = getX()+p.x-sp.x;     
                   int y = getY()+p.y-sp.y;     
                   setLocation(x,y);
         public void mousePressed(MouseEvent e)
              sp = e.getPoint();
              compStartHeight = getSize().height;
         public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
              if (sp == null)
                   setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR));
        public void mouseClicked(MouseEvent e)
        public void mouseReleased(MouseEvent e)
              sp = null;
         public static void main(String[] args)
         new TestFrame();
    }

    I doubt there is a faster / easier way to resize.
    Have you tried adding
    public boolean isDoubleBuffered()
      return true;
    }To over-ride Component.isDoubleBuffered. This should sort out your flickering problem.
    Bamkin

  • Maximize undecorated JFrame on linux

    Hello every one!
    I have a problem with maximizing undecorated window on all Linux OS. When I try to maximize my jFrame, it maximized for all screen size and cover task bar.
    How calculate screen bounds insets on linux? It's possible at all?
    JFrame jFrame = new JFrame();
    jFrame.setUndecorated(true);
    jFrame.setExtendedState(MAXIMIZED_BOTH);
    jFrame.setVisible(true);

    Strange. I once had the opposite problem on Windows...
    According to [this post|http://forums.sun.com/thread.jspa?messageID=10803082#10803082] , the following should return the size of the desktop screen, save for the task bar if any:
    GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()You could then explicitly set the frame's bounds to this value. However I would assume that's already what setExtendedState(MAXIMIZED_BOTH) does...
    Edited by: jduprez on Apr 29, 2010 9:34 AM

  • Undecorated JFrame in Swing editor

    I am creating an application which doesn't require window decorations and I use the appropriate call in the JFrame class to turn them off. The problem is that the swing editor in JDeveloper always has the decorations present so it's hard to get the placement of object and the sizing of the JFrame correct. Is there a setting in JDeveloper to modify this behaviour? As an aside there isn't a property to set or clear the decorations in the properties pane either.
    Any help would be most appreciated.

    dialog works pretty well
    here's a more complete example
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Logon {
       public static void main(String[] a){
          JFrame f = new JFrame();
          f.setSize(400,400);
          f.show();
          LogonDial ld = new LogonDial(f,true);
          ld.setLocationRelativeTo(null);
          ld.show();
          if(ld.isAccept()){
             JOptionPane.showMessageDialog(null,"you are now logged on");
          else
             JOptionPane.showMessageDialog(null,"logon failed");
          ld.dispose();
          f.dispose();
          System.exit(0);
    import javax.swing.*;
    import java.awt.event.*;
    public class LogonDial extends JDialog{
       private boolean accept = false;
       private JButton logonButton;
       public LogonDial(JFrame f, boolean modal){
          super(f,modal);
          init();
       private void init(){
          setSize(200,200);
          logonButton = new JButton("logon");
          logonButton.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent ae){
                   //if logon is correct
                   accept = true;
                   hide();
          getContentPane().add(logonButton);
          addWindowListener(new WindowAdapter(){
                public void windowClosing(WindowEvent we){
                   accept = false;
                   hide();
       public boolean isAccept(){
          return accept;
    }you should run it and see if it works for you.

  • Disabling "window menu" of undecorated JFrame

    [JDK 1.4.2 on Windows XP.]
    Using frame.setUndecorated(true) to disable window border and other window decorations.
    But pressing Alt-SPACE still displays Windows "window menu" (i.e. the one with "Restore", "Move", "Minimize", "Maximize", "Close").
    Is there a way to disable this?

    Used to use JWindow but had to switch to JFrame since (I could be wrong) JWindows do not receive keyboard focus in JDK 1.4.2. My main window/frame contains text fields, buttons and other components that need to receive keyboard focus for input.

  • Dragging undecorated jframe

    Hai,
    I'm creating a basic dock application, and I'm stumped. How can I drag it around if i've declared
    setUndecorated(true);I don't want a toolbar on it, seeing as it is a toolbar. I won't bother posting the code, and you shouldn't either. Point me in the direction so that I can learn for myself, if at all possible. Thanks in advance =]
    Edited by: Pattylulz on Aug 5, 2008 9:25 PM

    Search the forum.
    For example: [http://forums.sun.com/thread.jspa?threadID=5270203&messageID=10129637]

  • JFrame undecorated

    How can I create undecorated JFrame ?
    I am trying to use it to show the progress while my program is loading,
    but I can't get rid of the frame decoration.
    JFrame.setUndecorated(true) can be used only if the frame is not dispayable.
    Thanks

    Use a JWindow. This also has the advantage of staying "on top" - i.e it makes a splash screen which is I guess what you are trying to achieve.
    Regards,
    Tim

  • JFrame setlocation problems on linux

    When you drag a JFrame, you can move it anywhere you want, even if some of its boundary goes outside the screen...
    Fortunately It's true on windows, mac and linux SUN JREs.
    On windows and mac, you get the same effect if you decide to do it programatically with for example :
    package testframe;
    import javax.swing.JFrame;
    public class Main {
        public static void main(String[] args) {
        JFrame jf=new JFrame();
        jf.setVisible(true);
        jf.setSize(400, 400);
        jf.setLocation(-300, 50);
    }But this code doesn't work as expected on linux distros. I tried on kde, gnome and xfce, and I always get the same problem : the JRE (probably because of calls to window manager) refuses to place the window a little bit outside the screen boundaries. So in my example, jf.setLocation(-300,50) have the same effect as jf.setLocation(0,50).
    Of course, when the windows appear at the (0,50) coordinates, it's always possible on linux to move it manually to a negative x-coordinate place.
    setBounds method will lead to the same trouble...
    Of course this piece of code is only here to show exactly what's wrong on linux sun jre's. In my "real code", I need to deal with undecorated Jframes, so I have to manage myself the mousepressed and mousedragged events on my custom titlebar, and I would really want the linux version of my application behave the same as windows and mac versions ...
    The weird thing is that if I try to do that with JWindows in place of JFrames, it work's fine on Linux as well. But the problem is not here : in my case I need JFrames...
    Anyone knows how to fix this on linux ?

    When you drag a JFrame, you can move it anywhere you want, even if some of its boundary goes outside the screen...
    Fortunately It's true on windows, mac and linux SUN JREs.
    On windows and mac, you get the same effect if you decide to do it programatically with for example :
    package testframe;
    import javax.swing.JFrame;
    public class Main {
        public static void main(String[] args) {
        JFrame jf=new JFrame();
        jf.setVisible(true);
        jf.setSize(400, 400);
        jf.setLocation(-300, 50);
    }But this code doesn't work as expected on linux distros. I tried on kde, gnome and xfce, and I always get the same problem : the JRE (probably because of calls to window manager) refuses to place the window a little bit outside the screen boundaries. So in my example, jf.setLocation(-300,50) have the same effect as jf.setLocation(0,50).
    Of course, when the windows appear at the (0,50) coordinates, it's always possible on linux to move it manually to a negative x-coordinate place.
    setBounds method will lead to the same trouble...
    Of course this piece of code is only here to show exactly what's wrong on linux sun jre's. In my "real code", I need to deal with undecorated Jframes, so I have to manage myself the mousepressed and mousedragged events on my custom titlebar, and I would really want the linux version of my application behave the same as windows and mac versions ...
    The weird thing is that if I try to do that with JWindows in place of JFrames, it work's fine on Linux as well. But the problem is not here : in my case I need JFrames...
    Anyone knows how to fix this on linux ?

  • Cannot set the initial size of nested JFrame in NetBeans 5.5.

    For some background; I'm trying to design a small configurable, multi-market clock for Traders of foreign currency. Several international market times will be displayed and each will change color as that market opens and closes. The user will be able to select specific foreign markets and configure several options such as color and size.
    I was trying to use a JFrame for the initial window and an undecorated JFrame to hold the clocks and their labels. In the GUI builder for the initial JFrame, I dragged a JFrame and dropped it outside the original to add an (other Component). My problem is that I can't set the prefereedSize or the minimumSize properties for the nested JFrame. When I run the program, a button sets the second JFrame visible but at (0,0) size which when undecorated is invisible, and when decorated shows only the Min/Max/Close buttons. Am I just going about this all wrong or is this a bug
    I am running Java Version 1.5.0 (build 1.5.0_08-b03)
    Rick

    I have tried to use several different components but I have not been able to get them to appear as a component, undocked from the main window.
    Another idea that I tried was to have the whole program run from the same frame and then just set the window as undecorated and hide the menu bar. Unfortunately decorated state cannot be changed after it is displayable or packed. Besides that, how do you then make it moveable when there is no title bar? So many questions? Any other suggestions?

  • JFrame decorations problem

    Greetings:
    I've found searching at the net, that it is suggested "that the L&F (rather than the system) decorate all windows. This must be invoked before creating the JFrame. Native look and feels will ignore this hint". The command that does this is the static JFrame.setDefaultLookAndFeelDecorated(true); .
    If I install Metal L&F as default, and then go to Full Screen and change the L&F, it partially WORKS (the Metal L&Fdecorations are set like in an InternalFrame); but if I set the System L&F as default and change the L&F, the new L&F does not recive its propper decorations but rather the system ones.
    Could anyone help me in this issue?
    Thanks a lot in advanced.
    Javier
    // java scope
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import com.sun.java.swing.plaf.motif.*;
    public abstract class LandFTest {
       public static void main(String[] args) {
          try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } //UIManager.getCrossPlatformLookAndFeelClassName()
          catch (Exception e) { }
          SwingUtilities.invokeLater(new Runnable() {
             public void run() { JFrame.setDefaultLookAndFeelDecorated(true);
                                 MainWin myWindow = new MainWin(" Look & Feel Test");
                                 myWindow.pack();
                                 myWindow.setVisible(true); }
    class MainWin extends JFrame {
          public Box mainLayout = new MainComponent(this);
             public JScrollPane mainLayoutScrollPane = new JScrollPane(mainLayout);
          public Boolean FullScrnOn=false;
       public MainWin (String mainWin_title) {
          Container framePanel = this.getContentPane();
          this.setTitle(mainWin_title);
          this.setLocationRelativeTo(null);
          this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          framePanel.add(mainLayoutScrollPane,BorderLayout.CENTER);
    class MainComponent extends Box {
          Box controls_Box = Box.createHorizontalBox();
          Box lfControl_Box = Box.createVerticalBox();
          JRadioButton landfRadioButton1 = new JRadioButton(" Metal skin (Java)"),
                       landfRadioButton2 = new JRadioButton(" System skin",true),
                       landfRadioButton3 = new JRadioButton(" Motif skin");
          ButtonGroup lanfFButtonGroup = new ButtonGroup();
          JButton fullScrnButton = new JButton("Full Screen On");
    public MainComponent(MainWin refFrame){
          super(BoxLayout.Y_AXIS);
          this.initMainCompopent(refFrame);
          this.setMainComponent();
       public void initMainCompopent (MainWin refFrame) {
           LookAndFeel_ActionListener landFListener = new LookAndFeel_ActionListener(lanfFButtonGroup, refFrame);
           FullScreen_ActionListener fullSCrnListener = new FullScreen_ActionListener(refFrame);
          lfControl_Box.setBorder(BorderFactory.createTitledBorder(" Look & Feel Control "));
          landfRadioButton1.setActionCommand("Java");
             landfRadioButton1.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton1);
          landfRadioButton2.setActionCommand("System");
             landfRadioButton2.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton2);
          landfRadioButton3.setActionCommand("Motif");
             landfRadioButton3.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton3);
          fullScrnButton.addActionListener(fullSCrnListener);
          fullScrnButton.setAlignmentX(Component.CENTER_ALIGNMENT);
       public void setMainComponent () {
          controls_Box.add(Box.createHorizontalGlue());
          controls_Box.add(lfControl_Box);
             lfControl_Box.add(landfRadioButton1);
             lfControl_Box.add(landfRadioButton2);
             lfControl_Box.add(landfRadioButton3);
          controls_Box.add(Box.createHorizontalGlue());
          this.add(Box.createVerticalGlue());
          this.add(controls_Box);
          this.add(Box.createVerticalGlue());
          this.add(fullScrnButton);
          this.add(Box.createVerticalGlue());
    class LookAndFeel_ActionListener implements ActionListener {
          private ButtonGroup eventButtonGroup;
          private MainWin eventFrame;
       public LookAndFeel_ActionListener (ButtonGroup buttonGroup, MainWin eventFrame) {
          this.eventButtonGroup = buttonGroup;
          this.eventFrame = eventFrame;
       public void actionPerformed(ActionEvent event) {
          String command = eventButtonGroup.getSelection().getActionCommand();
          GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
          eventFrame.dispose();
          if (command.equals("System")) {
            try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
            catch (Exception e) { }
          else { if (command.equals("Java")) {
                   try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());}
                   catch (Exception e) { }
                 else { if (command.equals("Motif")) {
                          try { UIManager.setLookAndFeel(new MotifLookAndFeel()); }
                          catch (Exception e) { }
                        else { }
          SwingUtilities.updateComponentTreeUI(eventFrame);
          if (eventFrame.FullScrnOn){ try {scrnDevice.setFullScreenWindow(eventFrame); }
                                      finally {  }
          } else { JFrame.setDefaultLookAndFeelDecorated(true); }
          eventFrame.setVisible(true);
          //eventFrame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    class FullScreen_ActionListener implements ActionListener {
          private MainWin eventFrame;
       public FullScreen_ActionListener (MainWin eventFrame) {
          this.eventFrame = eventFrame;
       public void actionPerformed(ActionEvent event) {
             MainComponent mainFrameLayout = (MainComponent)eventFrame.mainLayout;
             GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
          if (!eventFrame.FullScrnOn){
             if (scrnDevice.isFullScreenSupported()) {
                // Enter full-screen mode with an undecorated JFrame
                eventFrame.dispose();
                eventFrame.setUndecorated(true);
                eventFrame.setResizable(false);
                mainFrameLayout.fullScrnButton.setText("Full Screen Off");
                eventFrame.FullScrnOn=!eventFrame.FullScrnOn;
                try {scrnDevice.setFullScreenWindow(eventFrame); }
                finally {  }
             } else { JOptionPane.showMessageDialog(eventFrame, "Full Screen mode is not allowed \nby the system in this moment.",
                                                                " Full Screen Info", JOptionPane.INFORMATION_MESSAGE); }
          else { // Return to Windowed mode mode with JFrame decorations
                  eventFrame.dispose();
                  eventFrame.setUndecorated(false);
                  eventFrame.setResizable(true);
                  mainFrameLayout.fullScrnButton.setText("Full Screen On");
                  eventFrame.FullScrnOn=!eventFrame.FullScrnOn;
                  try { scrnDevice.setFullScreenWindow(null); }
                  finally { }
          eventFrame.setVisible(true);
    }

    Greetings:
    Thanks a lot for your kind answer:
    After reading your reply, I've done some studies directly in the API in how does the L&F's are managed. Of what I've understood (please correct me if I'm wrong), the things are as follow:
    i) System and Motif Look and Feel's does NOT support decorations, so that's why you should let the JVM do the decoration work (that is, use myFrame.setUndecorated(false); ).
    In this case, it does not matter if you use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of the frame: it won't show decorations if you don't use the command mentioned.
    ii) Metal (Java) Look and Feel DOES support decorations; that's why, if you use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of the frame, you'll see it's own decorations. In this case, you should use myFrame.setUndecorated(true); so the L&F does all the decorating work, avoiding the weird sitiuation of showing double decorating settings (L&F's and native system's).
    iii) So, the real problem here would be if you want to have, as a user choice, that the System/Motif L&F's will be available together with the Java's (Metal). I've made the next variation to my code, so that this will be possible:
    class LookAndFeel_ActionListener implements ActionListener {
    private ButtonGroup eventButtonGroup;
    private MainWin eventFrame;
    public LookAndFeel_ActionListener (ButtonGroup buttonGroup, MainWin eventFrame) {
    this.eventButtonGroup = buttonGroup;
    this.eventFrame = eventFrame;
    public void actionPerformed(ActionEvent event) {
    String command = eventButtonGroup.getSelection().getActionCommand();
    GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    eventFrame.dispose();
    if (command.equals("System")) {
    try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    eventFrame.setUndecorated(false); // make sure the native system controls decorations as this L&F doesnt's manage one's.
    catch (Exception e) { }
    else { if (command.equals("Java")) {
    try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); }
    catch (Exception e) { }
    eventFrame.setUndecorated(true); // make sure the L&F controls decorations as it actually has one's.
    else { if (command.equals("Motif")) {
    try { UIManager.setLookAndFeel(new MotifLookAndFeel()); }
    catch (Exception e) { }
    eventFrame.setUndecorated(false); // make sure the native system controls decorations as this L&F doesnt's manage one's.
    else { }
    SwingUtilities.updateComponentTreeUI(eventFrame);
    if (eventFrame.FullScrnOn){ try {scrnDevice.setFullScreenWindow(eventFrame); }
    finally { }
    } else { }
    eventFrame.setVisible(true);
    }iv) The issue here is that, as I needed to use myFrame.dispose() (the JVM says that it is not possible to use setUndecorated(false); in a displayable frame), I recieve and error:
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Buffers have not been created
    at sun.awt.windows.WComponentPeer.getBackBuffer(WComponentPeer.java:846)
    at java.awt.Component$FlipBufferStrategy.getBackBuffer(Component.java:3815)
    at java.awt.Component$FlipBufferStrategy.updateInternalBuffers(Component.java:3800)
    at java.awt.Component$FlipBufferStrategy.revalidate(Component.java:3915)
    at java.awt.Component$FlipBufferStrategy.revalidate(Component.java:3897)
    at java.awt.Component$FlipBufferStrategy.getDrawGraphics(Component.java:3889)
    at javax.swing.BufferStrategyPaintManager.prepare(BufferStrategyPaintManager.java:508)
    at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:264)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1220)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    and, yet, the Metal (Java's) L&F keeps without decorations. Is it there a way to solve this without having to create a new instance of the frame and use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of such new instance of the frame for the Metal's (Java) L&F?
    Thanks again for al lthe help: this was, definetelly, something not obvious to figure out (or to find a hint on the net).
    Regards,

  • JPanel without JFrame / JApplet / Window

    hello,
    I want to show a JPanel as an output without JFrame / JApplet / Window in background. My program ran successfully but without showing output.
    Actually I dont want title bar in an output, thats why i have selected JPanel.
    If anybody have idea about this plz tell me.
    Regards
    Nikhil

    This code works for me,
    import java.awt.Color;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class Forum extends JFrame {
         public Forum()
              setUndecorated(true);
              setBounds(100,100,400,400);
              JPanel pnl = new JPanel();
              JLabel lbl = new JLabel("THIS IS A LABEL IN A JPANEL IN AN UNDECORATED JFRAME");
              pnl.setBounds(0,0,400,300);
              pnl.setBackground(Color.CYAN);
              lbl.setBounds(0,0,200,100);
              pnl.add(lbl);
              getContentPane().add(pnl);
              setVisible(true);
         public static void main(String[] args) {
              Forum f = new Forum();
    }Just a quick and dirty example to show it's possible;
    ~Tim

  • How do i remove the taskbar icon for a JFrame from a windows taskbar?

    I have an undecorated JFrame (no titlebar, minimize, restore, close buttons) and i want to remove it being shown on the windows taskbar. is there a way in Swing to do this?
    If not is there any other way i can show some content that appears free floating on the desktop and does not show up on the taskbar.

    GauravTaneja wrote:
    Can the JDialog be undecorated? as in i don't want the little close button or the title bar on the dialog. just the content pane to display something.I don't know. Check the API.
    Also, i want this to be on top of all windows.So make it a modal JDialog.

  • Using Frame & Canvas together

    Hi,
    I am trying to write develop an independant appl where I will have a frame. On the frame, I need a canvas & few buttons like add, delete, save & open. when I click on add, a rectangle should appear onthe canvas & delete sould remove that rectangle. I should be able to drag the rectangle inside the canvas. When clicked on save button, the positions of all the rectangles should be saved in a .txt file & next time if I open that .txt file, the same canvas should be displayed.
    I am able to create a frame as standalone appl & I think, instead of canvas, I should use Jcomponent. but I am not able to relate all these things properly. Can someone help me please or at least provide me some source where I can get some help?

    In short, which component replaces Frame & canvas? JFrame & JPanel (via overriding paintComponent(..))
    the swing tutorial has a section on custom painting

  • JMenu is behind Canvas. problem ?

    I have created a JFrame with a JMenuBar,
    I have added a ImageCanvas (sub class of Canvas) in the center of the JFrame
    but whenever i click on Menu it appears behind the canvas
    what to do pls help?

    Hey,
    Canvas is an awt component meaning it is a heavyweight
    component. The swing components are lightweight.
    Thats the problem.
    Have a look at the following URL.
    http://java.sun.com/products/jfc/tsc/articles/mixing/
    It should explain about mixing heavyweight/lightweight
    components
    Basically you either need to use Frame, Menu and
    canvas or JFrame, JMenu and JPanel.
    nesAnd heres the important part:
    "When a lightweight component overlaps a heavyweight component, the heavyweight component is always on top,
    regardless of the relative z-order of the two components."
    Use JPanel instead of canvas if your using swing.
    regards,
    Tim

Maybe you are looking for