Window « JFrame « Java Swing Q&A





1. How to centre a Window in Java?    stackoverflow.com

What's the easiest way to centre a java.awt.Window, such as a JFrame or a JDialog?

2. Canvas3D not appearing in Swing window    stackoverflow.com

I am attempting to insert a Canvas3D object inside a Swing JPanel, but the code doesn't seem to be working (i.e. nothing happens):

        Canvas3D ...

3. Java Swing packs the window wrong    stackoverflow.com

I'm making a Scorched Earth like game in Java (for my exam project :D), but I have this problem. I'm drawing a window (JFrame), setting layout to BorderLayout, applying an extended ...

4. Is there a Swing hack to query or set Z-order of a window?    stackoverflow.com

We are trying to save the state of the application on exit and restore it on startup. Part of the state is the relative Z-order of all JFrames. Unfortunately, Swing doesn't ...

5. What is the best way to create a smooth notification window in Java?    stackoverflow.com

...similar to those produced by email clients like thunderbird or outlook, sliding up or fading in from the tray.

6. Window z-ordering in java    stackoverflow.com

Is there a way to manage the window z-ordering of JDialog windows within java? I would like to able to assign each window to a layer such that windows on lower layers ...

7. to create X window(X11) in java swing and to get its id    stackoverflow.com

Hi Can anyone help me in creating an X11 window in java swing using eclipse?And also the function to get the x11 id also.What are the basic requirement for creating an X11 ...

8. What is the difference between the ways a Swing window can be initialized?    stackoverflow.com

I am curious as to the differences between the following approaches to creating a Swing window:

  1. Using java.awt.EventQueue.invokeLater() in main();
  2. Using SwingUtilities.invokeLater() in main();
  3. not bothering with threads at all, simply instantiating the JFrame ...

9. Java Beans - creating an inspector window    stackoverflow.com

I'm wondering whether there is an existing Java class that, given a Java bean, uses introspection to find all the publicly modifiable fields, and displays them using default PropertyEditors. I ...





10. How to create an overlay window in Java?    stackoverflow.com

I'm trying to create a HUD style display for a foreign application. To do this, I'd need to make a transparent overlay window, that would be placed on top of the window of ...

11. How do you record keystrokes when operating on another window in Java?    stackoverflow.com

I'm looking to record keystrokes and mouse positions while I'm in a browser window on various websites, but I'm not sure how to do this outside the SWING (or some other ...

12. Should I create a new window or modify the old one?    stackoverflow.com

I am programming a GUI application in Java. I do it for the first time. I would like to have a form (with radio buttons and so on). After the form is ...

13. How to use palette window decorators in Java/Swing?    stackoverflow.com

is there an open solution to use palette window decorators in Java/Swing like in the following screenshot? JNIWrapper can do this but it is neither open nor free.

14. Improving Swing Window Accessibility    stackoverflow.com

I have a single Swing JFrame which contains a couple JLabels, a few read-only JEditorPanes, and a couple buttons. JAWS users are requesting that the application be read with less user ...

15. SystemTray based application without window on Mac OS X    stackoverflow.com

How do I do an application that runs only as a SystemTray TrayIcon on mac os x, (without an awt window and dock icon)? The code I'm using is this:

public class App
{ ...

16. How to make a window look like this in Java?    stackoverflow.com

How do I create a window which looks like this in Java: frame I want that window layout, instead of the standard Windows-borders, and I don't know how this is called. Thank ...





17. Why doesn't a simple Swing application terminate when a window is shown?    stackoverflow.com

Here's some sample code:

import javax.swing.*;

public class MyApplicatin {
    public static void main(String args[]) {
        JFrame window = new JFrame();
   ...

18. Java swing window frame    stackoverflow.com

How to manipulate the window frame with swing in java ? Like how to change the color, how to make it to be not the default style of the PC theme, ...

19. strange java window behaviour    stackoverflow.com

I am trying to write a simple desktop application for managing accounts. I am in the beginning phase. I am running it in my old computer and I sometimes get strange behavior. ...

20. How to make a window smaller than 125 x 50 in Java?    stackoverflow.com

I'm trying to create a 50x50 window in Java but the window won't go smaller than 125x50, even if I try to manually resize it. Here's my code currently:

import javax.swing.*;
public class smallwindow ...

21. JFrame to Window class    stackoverflow.com

i want to know which this line code it really true or is there a better way? can any one help me?

JFrame jframe=new JFrame()
Window window;
jframe.setUndecorated(true);


window=(Window)jframe; //is this line true?
thank you.

22. Java: network settings window    stackoverflow.com

I'm looking for a way to program textfields with dots like the one from Windows network settings dialog: see >> http://i.stack.imgur.com/gayeY.jpg Is there any ready-to-use example on the net? - unfortunately ...

23. Create an inspector style window using Swing/AWT    stackoverflow.com

Is there a way to create a window using Swing or AWT that behaves and looks like an inspector window on Mac OS X? An example of an inspector window would ...

24. dos window    coderanch.com

25. Java Applications & the DOS Window    coderanch.com

I have an application that is run via desktop shortcut (W95/98/NT) which opens a DOS window. While that window can be run minimized, there are still 2 icons on the task bar. Is there any way to run a Java application without opening a DOS window, and without getting the two icons on the task bar? Help appreciated. ------------------

26. How to get a Native Window Handle?    coderanch.com

27. Frame for my window    coderanch.com

Hi everybody.. Well I have some problem in adding a frame to my panel..can anybody help me out in that... I will explain u exaclty what I want.. See there is a user login... as soon as the user submits his login & password.. and if he is a valid user........after validation a frame must pop up...which will have 3 panels ...

28. Window    coderanch.com

29. How to Blink Swing window when it is minimised?    coderanch.com

Hi all, Iam trying to develop some swing application for that Iam use swing window.This is for a messenger, 1) In one user is chatting with multiple user then if one window in minimised and suppose a new message has come.Then Iam put message on that window but user does not know whether message is come or not. 2)For that I ...

30. Console Style window    coderanch.com

31. How to move a window in front    coderanch.com

toFront() moves the window to the front when you call it... that doesn't mean that users can't select other windows that may then be on top of the window you called toFront() on... if you are trying to make a system modal window ( like MS task manager or WinAmp ( when you choose 'Always on top' ) ) you will ...

32. Splash Window    coderanch.com

I created a SplashWindow class to be shown while data is reirieved from database after logonform. I am calling the SpalshWindow class in the OK button action perfomed in my logon form. and making my logonform not visible. But 1)the logon form does not disappear. Even I tried closing the logonform before calling splash window 1) SplashWindow is appearing on the ...

33. How to create a flexible window?    coderanch.com

35. transperent window    coderanch.com

hi ranchers .. i m here again.. can i make a transperent window using swing?. i need a transperant window with some components visible.rest of my window area should show the desktop background.. welcome to all solutions and suggestions can i make a curser like adobe acrobat viewer curser using swing?(a hand grabbing action while dragging the mouse). basha

36. Query on Internal Window??    coderanch.com

37. AWT Window within a Window    coderanch.com

38. only one window opened    coderanch.com

Here, each time you click the button obviously new Windows will be opened. Each of these windows can be closed from inside them only. If your requirement is to avoid the user opening new windows again and again you can extend JDialog for your subframe with the modal true constructor, which forces the control into it and the user will not ...

39. How to add a new window on existing one    coderanch.com

Hi, I'm trying to create an applcation which may contan a login option. want to invoke a logn window thru a button click and when the user name and password is verfied by the server the login window should close and a new post message window should appear on the previous window. now the problem s that whenever i m trying ...

40. Plz help to add new window on current one!    coderanch.com

Here's my code snippet - public class ChatClient extends JFrame implements Serializable{ ChatClient() { super("Chat"); cc=this; JMenuBar bar = new JMenuBar(); setJMenuBar(bar); cntr = getContentPane(); cntr.setLayout( new FlowLayout()); desktop = new JDesktopPane(); cntr.add( desktop ); rs = new ReadServer(this); JMenu loginMenu = new JMenu( "Login"); loginMenu.setMnemonic( 'L'); JMenuItem loginItem = new JMenuItem( "Login..."); loginItem.setMnemonic( 'o' ); loginItem.addActionListener( new ActionListener(){ public void ...

41. Window adjusting question    coderanch.com

Let me tell you that I'm very new to Swing !! I've made a screen it has 4 Radiobutton. I created the window with the following : Toolkit theKit = window.getToolkit(); Dimension wndsize = theKit.getScreenSize(); window.setBounds(wndsize.width/4,wndsize.height/4, wndsize.width/2,wndsize.height/2); window.addWindowListener(new WindowHandler()); window.setVisible(true); then I added my Radiobutton to it by using : radioAdd.setBounds(150,50,150,20); radioEdit.setBounds(150,80,150,20); radioDelete.setBounds(150,110,150,20); radioExit.setBounds(150,140,150,20); when I execute the program, I get ...

42. new window within a program...    coderanch.com

Forgive me, I'm new at this gui stuff with java. What I'm trying to do with this code is to create a new window (that is what the FileButtonHandler class is for) when the file button is clicked with a couple of entry fields and some buttons. The problem is that, when I compile, I get this error message for each ...

43. Can't connect to X11 window    coderanch.com

This is just a common X11 application problem, not a Java thing, really. We can't help you debug it without knowing a bit more about your environment. It actually would be much easier for someone at your end who knew something about X to help you figure out what's going on. One possibility: you've use "telnet" or similar to connect to ...

44. Bringing Window to the front    coderanch.com

Our application has just been rolled out to Windows 2000 and Windows XP after previously only being used on Windows NT 4. We are noticing some different behavior in the toFront() method. Previously, our application would popup with its input over the current active window. Now in Windows 2000/XP, the application title bar in the taskbar starts to flash notifying the ...

45. WINDOW_ACTIVATED for Window    coderanch.com

46. How to ceate a console window...    coderanch.com

47. how to create a Properties Window?    coderanch.com

Hi all, how do you do? I' like to ask how to create a proterties window? i.e. I want to create two frames in the main screen, one of them is a properties window, when I select an object in another window, the properties will be shown in properties window, just like most of the IDEs do. I do not know ...

49. Help! Having trouble animating translucent window.    coderanch.com

What I'm trying to do is have a small window that is over a Frame and is comes out of the right side of the frame and appears bit-by-bit as it moves to the left side. It will be a translucent (NOT transparent) window, so I'm using AlphaComposite (with a float of 0.2f). The problem is that when I draw the ...

50. Initial Window State - JFrame    coderanch.com

51. window decorations    coderanch.com

52. How to create a new window from a java app    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

53. Can you use 8 counters in one window?    coderanch.com

Hi, Could somebody please suggest a way to incorporate up to 8 "counters" (numerical digits counting up) on a Jpanel in a window. I also need to have start/pause/stop JButton control over each counter. Each counter needs to work independently of the others, they may be started/stopped at different times. I have looked into Timer and TimerTask but unsure how to ...

54. Window within window    coderanch.com

Hi, In our application, we need to create a screen which will have four internal screens. We should be in position to minimize, maximize, close these screens indivisually.. Also we should be in a position to move any of these screens independently within the parent screen... Any ideas what exactly I need to do to achieve this. Regards Ashwin

55. So many window Panes in JFrame?    coderanch.com

56. Freeform Window    coderanch.com

57. Window with Address Bar    coderanch.com

58. Window arrays    coderanch.com

Hi, I'm trying to make an application that has a toolbox. The toolbox has a file menu in which there are(or will be) the standard commands of New, Open, Save, etc... My problem is that I want to be able to have multiple document windows open and visible at a time. I'm familar with VB in which you would use an ...

59. Viewing all the outputs in one window    coderanch.com

P = k/L where: P = the probability someone will read your code k = some constant L = length of code Any way to cut out that which is not absolutely essential and still show your point? I have to say that it is a nifty little app. Wish I knew more about swing to be able to help you. ...

60. To find parent window.    coderanch.com

Hi Sujatha, The correct answer to your question depends on how and where you are creating screen C. Here are some possibilities. You can query the event to get the source object with getSource(). This will give you a reference to the button on A or B. You could also just use different event handlers for the buttons on A and ...

61. create a new window in a JFrame    coderanch.com

I would like to have a typical JFrame, and then have a menu to open a new "popup" window. I can handle the main frame and the menu, but the new JFrame? I want to be "attached" to the other JFrame. Examples of these windows are everywhere, I want it to work just like a "Properties box". As it is now, ...

62. How to use AWT/Swing w/o window?    coderanch.com

I've got some example extensions working so I can embed script in my xsl files as per the examples at http://xml.apache.org/xalan-j/samples.html#extensions. I want to write some extensions that will produce SVG code and perform calcuations based on the bounding box for a text string given a font and its position. I have no interest in creating a window: this is strictly ...

63. beginner/why can't I see the window    coderanch.com

64. Swing Window States    coderanch.com

65. Window contained in JFrame    coderanch.com

66. Maximised window goes slow    coderanch.com

Have just noticed that when I maximise the window, it all goes slow as though there's a processor-hungry background process. javascript:%20x() It's not my code cos the following modified simple example from the Sun website shows the problem (sorry about Sun's lengthy disclaimer but thought I'd better leave it in!) Am running Windows XP-Pro v2002 SP3 on a Pentium 4, 1.70GHz ...

67. Graphics2D window not being repaired?    coderanch.com

Here's a trivial test program to illustrate my newbie question. I used NetBeans to do this and it created lots of setup code that's not included here: public class TestFrame extends javax.swing.JFrame { public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TestFrame().setVisible(true); } }); public void paint(Graphics g) // override the JFrame method { super.paint(g); ...

68. Terminal Window in a GUI    coderanch.com

Hello help me please I want to include a terminal window in an exectuable jar file?? Outside the IDE, I can only access my program by command promt, Im not fussed about layout, I just need what appears in the command promt window to be in a terminal window in a jar file. Any help or examples of what im trying ...

69. how will we move from one page to another within the same window in Swing?    coderanch.com

Hi, I am new to Swing. I am trying to understand it. My problem is, I have created one login form which has username and password fields in it, when ever user clicks submit button, it has to show another page within the same window. But for me whenever he clicks submit button in the login form page , another new ...

70. how to use x11 to run the window java program?    coderanch.com

i used Mac OS X 10.4.11 and eclipse installed soylatte16-i386-1.0.3 when i ran a window program i got the problem: Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52) at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:131) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68) ...... how ...

71. Recommendations: Custom App Window    coderanch.com

Maneesh - Thanks! JavaFX looks really cool, and definitely includes some of what I'm after. However, I'm worried about a warning at the bottom of the referenced page: Note: the com.sun.awt.AWTUtilities class is not part of an officially supported API and appears as an implementation detail. The API is only meant for limited use outside of the core platform. It may ...

72. overlay window    coderanch.com

How could I make a frame window that stays on top of all other windows... but at the same time isn't in focus? Like a glass pane that just stays on top of all other windows but does not receive any input focus (all other applications continue as is). For example: the balloon messages in windows. They are always on top ...

73. Rounded rectangle window    coderanch.com

74. How to know the name of the window    coderanch.com

Hi everyone I have 3 frames Fe1, Fe2 and Fe3 The first frame contains two buttons Button 1 << view Fe2 "and button 2 <> I like when I click a button1 it should check if the frame f3 is active when f3 is active then it must close f3 and display frame f2 and the reverse for button 2 ...

75. Sprites disappearing after scaling down window? Aaargh the frustration!    coderanch.com

I am so stumped here! Ok, so I have a chess program that I am writing, and I can't for the life of me figure out what is wrong with my resize code. Any help is greatly appreciated! EDIT: See 2 comments below for a short compilable example. Problem: Every time I resize the window smaller, certain pieces disappear, however this ...

76. frame lefted unpainted after being covered with other window    coderanch.com

Hi.. I hope the topic title makes sense. I have a small question. It is an ordinary code. When I cover my frame with some other window, the circle doesn't get repainted, unless I resize a window. The JLabel "Felix" gets repainted. How can I make the circle gets repainted as well, in case when another window covers the frame, and ...

77. Hand coded Window (or other Swing) templates    coderanch.com

Hello All, A while back I posted a question about the best approach or framework to use when building a rich client. That conversation took an interesting turn and became a discussion about whether to use tools when first starting out or hand coding. I basically landed on hand coding so that I could get a better idea of how things ...

79. How to write a custom alert window?    coderanch.com

Hi all, I am Chaitanya, I am working on a small swing application. Its a billing application. There is a button named "add to cart". When the user clicks this button the details of the current item are stored in a bean and bean is added to a ArrayList. There is another button named "show items". When the user clicks on ...

80. Centering Window    coderanch.com

i used to do it much like the first approach. // centers a JFrame private void center(JFrame frame, int height, int width) { int x; int y; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setSize(screenSize); y = frame.getHeight() / 2 - height / 2; x = frame.getWidth() / 2 - width / 2; frame.setLocation(x, y); frame.setSize(width, height); } i also like the second approach ...

81. Setting an option window    coderanch.com

Hi, I'm new I GUI programming, I'm using netbeans, and need help of getting Input from an option window. My Idea is to make an options window that contains two combo-boxes , OK, and cancel buttons. How can I return the input of this window the main window of the program, will it be a frame or dialog, don't Know. Please ...

82. Regarding issue in frame window    java-forums.org

Java Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class WindowTalk { JDialog dialog; JTextField dialogField = new JTextField(12); private JPanel getContent() { final JTextField textField = new JTextField(12); JButton button = new JButton("send data"); ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent e) { String text = textField.getText(); dialogField.setText(text); if(dialog.isVisible()) { dialog.toFront(); } else { dialog.setVisible(true); } } }; ...

83. how can i move one frame window to another window    java-forums.org

Hi, I have written a piece of code as a sample.As Fubarable said,you should put ur code and ask the doubt.You shouldn't expect a complete code as u can't learn. -Regards Ramya Java Code: import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashMap; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JFrame; public class FrameCommunication{ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() ...

84. Create Window from HINSTANCE    java-forums.org

I have a cross-platform application with a C-Plugin API. I'd like to use Java to ensure platform independency for my plugin. I'm using the JNI API to write my C-Plugin and to implement Java Code. I want to create a Window in Java that is owned from my C-Application. Is that possible?

85. how to check the window has already opened    java-forums.org

To improve your chances of getting decent help you may wish to: 1) Describe in greater detail just what these two windows are supposed to do, what they're currently doing, and what they're not doing that you want them to do. 2) Go into a little more depth describing what this part of the program does from the user's perspective, not ...

86. How do you make another window appear    java-forums.org

Ok, here is the situation. I am working on my final project for my java programing class at school and I have run into a bit of a problem. I need to know how to bring up a new "window" when I click something on the main GUI window. For example, I have a menu item that says help, and I ...

87. Keeping one window above another    java-forums.org

Hi all I have encountered a few GUIs that do this: A new window (maybe in the form of a dialog box but I really would prefer a whole new frame I've created) appears above the previous window and until either the methods this new window is concerned with reporting on are complete or some error occurs the user can't select ...

88. Mac OS X, Swing & Spaces - how to determine on which space given Java window is?    java-forums.org

Hi all, Please, is there any way how to determine position of a JFrame (or any window) in Mac OS X Spaces? It is easy to find position and size on the screen, but I could not find out how to determine the active space. I need to detect that a window has been moved from space to space and move ...

89. Showing each window    java-forums.org

90. How do you duplicate a window?    java-forums.org

Hehe. I guess this is a noob question, but anyway...... I wrote this GUI, and included a button called New Window. Basically, I intended this button to open an EXACT DUPLICATE of the GUI. Here's an example to clarify this: You're surfing this page now. When you click the New Window button on your browser, it opens a new BLANK browser. ...

91. Stubborn Window    java-forums.org

Hello. I am new to both this forum, and java programming in general. I have created a swing window, adding a JPanel to it, and adding a JLabel to that. I have some simple code that my computer tech teacher at my school helped me with, that creates an animation. The animation however, is not appearing. This is less of a ...

92. Help in designing option window    java-forums.org

Hi, I'm new I GUI programming, I'm using netbeans, and need help of getting Input from an option window. My Idea is to make a window that contains two combo-boxes , OK, and cancel buttons. How can I return the input of this window the main window of the program, will it be a frame or dialog, don't Know. Please help. ...

94. Window and JFrame incompatible?    forums.oracle.com

The code comes from the book "Developing Games in Java" and I've contacted the author about it, who states the code should work in Ant. Is there some reason why it would work in Ant or with javac but not in Netbeans? Also, is there any kind of wrapper or something of the like I could use to make it a ...

95. java swing window    forums.oracle.com

97. Swing Window not working properly    forums.oracle.com

One more thing while I have you guys. In my actionPerformed method, I have each button do something different, but I am not getting the desired results. Which is, I want the first two textfields to add together when the add button is pressed, and subtracted when the subtract button is pressed. When I press the add button the third text ...

98. GUI Window Setup    forums.oracle.com

99. Target a Window through GUI?    forums.oracle.com