Always on Top Frame

HI, I have search a lot about Always on Top Frame, but couldn't found the solution of my problem.
My application has a PropertyWindow, the problem is, I want my PropertyWindow always on Top. Please suggest me which container should I use, because If I use JFrame as a PropertyWindow, another frame is created and windows toolbar have two windows.
If I use JPanel, I dont found the functionalities like WindowClosing, Settitle etc etc.
Please help me to get rid of this annoying problem. I want exactly something like JBuilder or Photoshop functionality where property windows are always on top and also seperate with the application.

But I got this error while using 1.5
"ConnectionPool.java": cannot access java.lang.Object,bad class file: C:\Program Files\Java\j2sdk1.5.0\jre\lib\rt.jar\java\lang\Object.class,class file has wrong version 49.0, should be 48.0,Please remove or make sure it appears in the correct subdirectory of the classpath. at line 13, column 11
"DBIdentifier.java": cannot access java.lang.String,bad class file: C:\Program Files\Java\j2sdk1.5.0\jre\lib\rt.jar\java\lang\String.class,class file has wrong version 49.0, should be 48.0,Please remove or make sure it appears in the correct subdirectory of the classpath. at line 12, column 11
Everything works fine in 1.4
Please Help
Thanks

Similar Messages

  • Frame be always on top

    Hi
    Can I create a Frame with these properties?
    1 - Be always on the top of the desktop even on the taskbar.
    2 - Disable all desk top mnemonics such as F1, F2, F12, Alt, windows start and so on.
    Thanks in advance.

    Loads of discusson on Always on Top Frame.
    http://onesearch.sun.com/search/developers/index.jsp?col=devforums&qp_name=Swing&qp=forum%3A57&qt=Always+on+Top+Frame

  • How to Create Always on Top Window OR Frame

    hi i m hasan, i m using windows 98, and i want to know that how to create a Window OR Frame, which should remain always on top. In windows 98 by pressing windows+D key hides all windows and dailog boxes. But I want it should remain always on top even if some one press windows+D key it should not be minimized.

    Try this code. It should be work on all windows which are inherited from java.awt.Window
    * Call this from class consructor
    public void initialize() {
    TopThread top = new TopThread();
    top.start();
    * Keep JWindow on top (inner class)
    class TopThread extends Thread {
    public void run() {
    while(true) {
    toFront();
    * Let 10 milliseconds for other code to execute
    try {
    Thread.sleep(10);
    catch(Exception e) {
    // Nothing to do

  • Always On Top Internal Frames

    Dear Friends,
    How we set Always on Top option for Internal Frames.
    Or User can't Do anything without closing that dialog(frame).
    Thankx.

    no, an internal frame can not be on top of anything that doesn't exist inside that frame.
    Maybe they can be forced on top of other content of the same frame, but that's as far as it goes.

  • Frame (popup )always on top

    Hi,
    i want to know how can i keep my frame always on top from other frames.
    thanks in advance,
    kimos

    Always check the JDK first before asking trivial questions.
    setAlwaysOnTop(true)Ted.

  • JInternalframe always on top instead of overlapping

    Hello guys,
    I have some JInternalFrames but one window paints its content above all, even overlapping frames. The code looks like this:
    package visnav.bachelor.gallery;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Insets;
    import java.awt.ScrollPane;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Vector;
    import java.lang.Math;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.UIManager;
    import javax.swing.SwingUtilities;
    import javax.swing.border.EtchedBorder;
    import visnav.bachelor.DataLoader;
    import visnav.bachelor.preview.PreviewMap_Ext;
    import visnav.common.Config;
    import visnav.common.DBListener;
    import visnav.common.Options;
    import visnav.common.Photo;
    * The class Gallery adds a window in which all selected Photos (=their
    * thumbnails) can be seen.
    * @author Florian Kratschmann
    public class Gallery extends ScrollPane implements DBListener {
         private static Vector<Photo> selectedPhotos;
         private static Gallery instance;
         public JPanel content = new JPanel(new ModifiedFlowLayout(
                   ModifiedFlowLayout.LEFT, 6, 6));
         public String filename = "";
          * Constructor which creates a new Gallery object.
         public Gallery() {
              selectedPhotos = DataLoader.getInstance().getSelectedPhotos();
              this.updateGUI(selectedPhotos);
         public static Gallery getInstance() {
              if (instance == null)
                   instance = new Gallery();
              return instance;
         public void collectionChanged() {
              selectedPhotos = DataLoader.getInstance().getSelectedPhotos();
              this.updateGUI(selectedPhotos);
         public void selectionChanged() {
              selectedPhotos = DataLoader.getInstance().getSelectedPhotos();
              this.updateGUI(selectedPhotos);
         public void valueChanged() {
              selectedPhotos = DataLoader.getInstance().getSelectedPhotos();
              this.updateGUI(selectedPhotos);
         public void updateGUI(Vector<Photo> data) {
              content.removeAll();
              removeAll();
              for (int i = 0; selectedPhotos.size() > i; i++) {
                   filename = Gallery_Ext.getFileName(selectedPhotos.get(i)
                             .getFileLocation());
                   final int j = i;
                   ImageIcon icon = (new ImageIcon(selectedPhotos.get(i)
                             .getThumbLocation()));
                   if (filename.length() > 15) {
                        filename = filename.substring(0, 15) + "...";
                   JButton thumb = new JButton("<html><p align=\"center\">" + filename
                             + "<br>[" + (i + 1) + "/" + selectedPhotos.size()
                             + "]<br></p></html>", icon);
                   thumb.setContentAreaFilled(false);
                   thumb.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             Gallery_Ext.openMIME(selectedPhotos.get(j)
                                       .getFileLocation());
                   thumb.setVerticalTextPosition(JLabel.BOTTOM);
                   thumb.setHorizontalTextPosition(JLabel.CENTER);
                   thumb.setBorder(new EtchedBorder());
                   thumb.setPreferredSize(new Dimension(140, 140));
                   content.add(thumb);
              add(content);
          * A modified version of FlowLayout that allows containers using this Layout
          * to behave in a reasonable manner when placed inside a JScrollPane
          * Workaround made to fit size of screen on first updateGUI firing
          * @author Babu Kalakrishnan
          * @author Florian Kratschmann
         public class ModifiedFlowLayout extends FlowLayout {
              public ModifiedFlowLayout() {
                   super();
              public ModifiedFlowLayout(int align) {
                   super(align);
              public ModifiedFlowLayout(int align, int hgap, int vgap) {
                   super(align, hgap, vgap);
              public Dimension minimumLayoutSize(Container target) {
                   return computeSize(target, false);
              public Dimension preferredLayoutSize(Container target) {
                   return computeSize(target, true);
              private Dimension computeSize(Container target, boolean minimum) {
                   synchronized (target.getTreeLock()) {
                        int hgap = getHgap();
                        int vgap = getVgap();
                        int w = target.getWidth();
                        if (w == 0) {
                             Dimension size = new Dimension(0, 0);
                             int noOfTn = selectedPhotos.size();
                             try {
                                  size = (Config.getDimension("InternalFrameSize4",
                                            new Dimension(0, 0)));
                                                 if (size.width==0){size.setSize(300, 200);}
                                  int noOfRows = (int) Math.ceil(size.width / 140);
                                  int heightNeeded = (int) ((noOfTn*1.25 / noOfRows) * 140);
                                  size.setSize(140, heightNeeded);
                             } catch (Exception ex) {
                                  ex.printStackTrace();
                                  int peter = 2;
                                  int heightNeeded = ((noOfTn / peter) * 280)+140;
                                  size.setSize(140, heightNeeded + 100);                    
                             return size;
                        } else {
                             // w = Integer.MAX_VALUE;
                             Insets insets = target.getInsets();
                             if (insets == null)
                                  insets = new Insets(0, 0, 0, 0);
                             int reqdWidth = 0;
                             int maxwidth = w - (insets.left + insets.right + hgap * 2);
                             int n = target.getComponentCount();
                             int x = 0;
                             int y = insets.top;
                             int rowHeight = 0;
                             for (int i = 0; i < n; i++) {
                                  Component c = target.getComponent(i);
                                  if (c.isVisible()) {
                                       Dimension d = minimum ? c.getMinimumSize() : c
                                                 .getPreferredSize();
                                       if ((x == 0) || ((x + d.width) <= maxwidth)) {
                                            if (x > 0) {
                                                 x += hgap;
                                            x += d.width;
                                            rowHeight = Math.max(rowHeight, d.height);
                                       } else {
                                            x = d.width;
                                            y += vgap + rowHeight;
                                            rowHeight = d.height;
                                       reqdWidth = Math.max(reqdWidth, x);
                             y += rowHeight;
                             return new Dimension(
                                       reqdWidth + insets.left + insets.right, (int) (y*1.2));
                             // return new Dimension(120, 300);
    }Any idea why it's content is always on top?
    Cheers,
    Flo

    As the title I can have inside a JDesktopPane some JinternalFrame "always on top" compared to one that makes the background?You might get better help by explaining what you want to achieve, rather than how you want to achieve it.
    You can do custom painting in a JDesktopPane, you know.
    db

  • JOptionPane show Message Dialog always on top found a Solution

    just thought of a solution for the age old java problem with message boxes / dialogs / input .
    It's funny when you google it you'll find like a million people asking for a solution but none or very few that gives an answer that works.
    this is probly not a new solution but i came up with this yesterday and thought i would "share".
    dunno why the java developers hasnt made a always on top function for this since there seems to be a very high demand for it.
    this hax will hopefully work at all times.
    hope google will find this thread, i searched for a solution yesterday and found none? which is surprising and im a pro googler too.
    import javax.swing.*;
    public class main{
         public static void main(String args[]){
              JFrame j=new JFrame();
              j.setAlwaysOnTop(true);
              j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              j.setVisible(true);
              j.setVisible(false);
              JOptionPane.showMessageDialog(j,"hi");
              System.exit(0);
    }

    I didn't realize it was an "age old problem." The JOptionPane's showXXX methods just show an ordinary modal dialog. If you want to set the alwaysOnTop property of said dialog then you just need to obtain a reference and call the method in question.
    JOptionPane op = new JOptionPane("hi",JOptionPane.INFORMATION_MESSAGE);
    JDialog dialog = op.createDialog("Message Dialog");
    dialog.setAlwaysOnTop(true); //<-- this line
    dialog.setModal(true);
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);No need for an intermediate frame.

  • How to have Always on top

    Am using a JInternalFrame to have my tools. i open new JInternalFrames with canvas for painting with tools from my first JInternalFrame. Now my problem is i want to have my InternalFrame with tools to be always in front, so that i can select tools. can i make that InternalFrame as always on top.. Or else suggest me some other option to obtain such scenario..

    Well a JDesktopPane is a layered pane. This means that the components added to it have an associated z coordinate. You can add the floating internal frame at a higher layer then the other internal frames.
    myDesktopPane.add(myToolbarFrame,JLayeredPane.PALETTE_LAYER,0);

  • "Always on Top" of jdk 1.5 is not working when...

    I created a sample application that has Frame/Window and displays some text. Then i needed to make the window always visible on top of any other application or windows. But then when i opened applications like Battle Realms, Counter Strike, or any other games, the window is blocked by the previously run application.
    Can you help me on how can i provide solution with this?
    Thanks in advance.

    This might help you!!!
    About setAlwaysOnTop()
    Changes the always-on-top window state. An always-on-top window is a window that stays above all other windows except maybe other always-on-top windows. If there are several always-on-top windows the order in which they stay relative to each other is not specified and is platform dependent.
    If some other window already is always-on-top then the relative order between these windows is unspecified (depends on platform). No window can be brought to be over always-on-top window except maybe another always-on-top window.
    All owned windows of an always-on-top window automatically become always-on-top windows. If a window ceases to be always-on-top its owned windows cease to be always-on-top.
    When an always-on-top window is sent toBack its always-on-top state is set to false.
    This method makes the window always-on-top if alwaysOnTop is true. If the window is visible, this includes bringing window toFront, then "sticking" it to the top-most position. If the window is not visible it does nothing other than setting the always-on-top property. If later the window is shown, it will be always-on-top. If the Window is already always-on-top, this call does nothing.
    If alwaysOnTop is false this method changes the state from always-on-top to normal. The window remains top-most but its z-order can be changed in the normal way as for any other window. Does nothing if this Window is not always-on-top. Has no effect on relative z-order of windows if there are no other always-on-top windows.

  • "always on top" in fullscreen mode; disable switching away

    Hi,
    I am trying to write a mode for emacs that will keep out as many distractions as possible.  When activated, I can't switch away from the file I'm working on.
    Unfortunately, I can *easily* switch away from my fullscreen Emacs to my webbrowser or email program, and Gnome notifications appear on my screen on top of the Emacs window.
    Is there a way for me to push a fullscreen Emacs window (what Emacs users call a frame) to the top of the windowing stack and DISABLE SWITCHING AWAY FROM IT, while also stopping other windows from poppint above it in the stack?  I'm using Gnome right now, so something gnome-specific would be great, as would any generic solution for X.  There is an "always on top" option for windows in gnome (I am using the default window manager, whatever it is now -- metacity?  compiz? I don't even know anymore!), but it is disabled for fullscreen windows.  that makes sense, normally, but I would like to suspend some of the computer's functionality when I'm writing. 
    Also:  perhaps this deserves its own thread, but it would be nice if notification windows didn't overlay themselves on top of the window that I make this way.
    Thank you!
    Matt

    Hi,
    You say you're using gnome so the default window manager for that would be mutter. The gnome notifications can be turned off from
    gnome-control-center
      I don't know if that's an acceptable solution for you. As for disabling switching to other windows, I've had look in
    dconf-editor
    org --> gnome --> desktop --> wm --> preferences but I don't think I can much that's relevant there. Would disabling raise-on-click deliver the desired behaviour? Otherwise, you could try seeing whether there is an extension at https://extensions.gnome.org/.
    Hope you find what you're looking for
    Last edited by Chazza (2014-03-15 11:47:37)

  • Always on Top, IS THERE A WAY!?!?!!?

    I've searched through th forumns for a way that makes a window always on top, and have yet to find one.
    What I have is a JFRAME that is actually a JMENU in which every everyone window in my application access the same object, the same JMENU. And the frame is seperate from any other window, sorta like a mac. But the problem is, the key accelrators like
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK));
    only work when the frame is in focus. So is there a way to have that frame always in focus and always on top?

    Thnx, that article is helpful. Now I just need to understand the code and implement it.
    Infact if this works like I'm reading, why wasn't this made a lil more known? This is like the cure for AIDS kept secret.
    Do you think it would better as an interface or as an static object in the menubar?
    Message was edited by:
    blackmage

  • "Always on top" behavior for Navigator Window?

    Greetings,
    Several of our users have asked for an "Always on Top" feature for the OHJ help navigator window. We are using OHJ 4.2.3, on Windows platforms. Our application displays help topics from certain dialog buttons and menu items (using CshManager.showTopic()). If the help windows are currently displayed from a previous help request and the user maximizes the application window, any new help requests are not seen as the help windows do not top themselves.
    Is there any way to force the OHJ window to top itself when a new help topic is displayed? Our users are also asking for the help window to always be on top (a la Task Manager on windows) so they know where it is especially if they're performing a complex task and relying on a set of instructions in the help topic...
    thanks,
    Elizabeth Dyer.

    Elizabeth,
    As part of the showTopic() implementation OHJ calls toFront()
    to bring the help window to the front. If this isn't working
    in a particular case, please let us know. I don't think any
    permanent "on top" feature is feasible, since OHJ windows are
    normal Java dialogs and frames and selecting another Java
    window will activate it instead of OHJ.
    - Ryan (again with quoting from Jeff Stephenson)

  • Always on top feature for inspector window

    Are there any ability to enable/disable 'Always on top' feature for inspector shown in separate window in Mac OS ? On my laptop not always comfortable to keep inspector in browser window. On Ubuntu window managers allow to pin windows always on top but mac os has no abilities to do it. (using firefox developer edition)

    Elizabeth,
    As part of the showTopic() implementation OHJ calls toFront()
    to bring the help window to the front. If this isn't working
    in a particular case, please let us know. I don't think any
    permanent "on top" feature is feasible, since OHJ windows are
    normal Java dialogs and frames and selecting another Java
    window will activate it instead of OHJ.
    - Ryan (again with quoting from Jeff Stephenson)

  • Make modal dialog box "Always on Top"

    i know there has been discussion about Frame always on top etc. but i have a slightly different problem.
    I have a Modal Dialog box which goes to the background when the parent window loses focus and gains it back.
    i am working on java version1.4. So the new methof in 1.5 version is of no use. Also i am working on Windows XP SP1.
    Do i have to make the dialogbox extend OptionPane instead of JDialo, which i am doing rt now?
    but OptionPane comes with a baggage and unnecessary code which i have to implement etc.
    Is there any easier way to solve this issue.
    Thanks
    PM

    This solution works for me under J2SDK v1.4.2_03. If you were to use it on a large scale, you'd probably want to develop a bit more of a formalized framework for it.
            final JFrame test_frame = new JFrame("Test");
            test_frame.getContentPane().setLayout(new BoxLayout(test_frame.getContentPane(), BoxLayout.Y_AXIS));
            JPanel panel = new JPanel(new FlowLayout());
            test_frame.getContentPane().add(panel);
            final JDialog[] modal_dialog = new JDialog[]{null};
            final JDialog d = new JDialog(test_frame, "Bah", true);
            JButton close = new JButton("Close");
            d.getContentPane().add(close);
            close.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    d.setVisible(false);
                    modal_dialog[0] = null;
            FocusListener fl = new FocusAdapter()
                public void focusGained(FocusEvent e)
                    if (modal_dialog[0]!=null)
                        modal_dialog[0].requestFocus();
            test_frame.addFocusListener(fl);
            JButton open = new JButton("Open");
            panel.add(open);
            open.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    modal_dialog[0] = d;
                    d.pack();
                    d.setLocationRelativeTo(test_frame);
                    d.setVisible(true);
            test_frame.pack();
            test_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            AWTUtilities.centerWindow(test_frame, null);
            test_frame.setVisible(true);

  • Making a Message Box always on top

    Hi all,
    I want a solution so that the message box I show on the screen should remain always on top of all the windows. Just like the common windows operating system modal dialog boxes so that the user cannot proceed unless and untill he closes the message box.
    I have tried with the JDialog by calling the method
    setModal(true);
    but unable to fix it.
    Thanx in advance,
    With regards
    Yuvraj
    Mumbai.

    If you instanciate your JDialog with the parent Frame, it will be always on top of it.
    JFrame fra = new JFrame();
    fra.setVisible(true);
    JDialog dia = new JDialog(fra);
    dia.setModal(true);
    dia.setVisible(true);
    Happy programming !

Maybe you are looking for