• Post Reply Bookmark Topic Watch Topic
  • New Topic

Floating window - How to

 
Dean Reedy
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create a floating window that will always be on top, and non-modal. How can it been done in java or using html/javascript. Any ideas would be great.
Note: This floating window will only display information and it will need to have a close window abaility. Nothing fancy in this window.
 
King Tan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sample code:
JFrame f = new JFrame();
JTextArea ta = new JTextArea("Hello there");
JTextArea ta2 = new JTextArea();
ta2.setDocument(ta.getDocument());
f.getContentPane().add(ta);
f.setSize(600, 400);
f.setVisible(true);

JDialog floatOnParent = new JDialog(f, false);
floatOnParent.getContentPane().add(ta2);

floatOnParent.setBounds(300, 100, 200, 200);
floatOnParent.setVisible(true);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!