So I want to have an "Exit" option on my menubar, NP. The JFrame already has the DISPOSE_ON_CLOSE in it's setDefaultCloseOperation method. I've looked around and have yet to find what I believe is a good example... What's a good or right way? A little help please!
As Always...
...
What's the fastest way to draw a Hello World on the screen as a GUI in Java,
1- by using the minimum number of classes.
2- with the least byte code executed
2- the JVM tweaks
so when I double click on the Jar file in Windows, the Hello World appears in no time (assuming the Runtime is not already loaded).
...
I have a JPanel that encapsulates two JPanels, one on top of the other.
The first holds two JLabels which hold the playing cards.
The second holds the player's text (name and score).
However, when I remove the player's cards, the lower JPanel moves up to the top, which i would prefer that it not do. Is there a way to keep it in place...
I'm updating a Java Swing application to support the user switching the app's font from normal size to a larger size (so the user can switch between the two sizes at runtime). One problem I'm having is with a JTree that uses HTML for the tree nodes to underline the text in some nodes (the HTML is just embedded in the JLabel of each tree...
My action listener on a JComboBox invokes a thread. I would like the component to be disabled until the thread completes.
I have tried calling seEnabled(false) when the thread start and setEnabled(true) when it completes. Unfortunately setEnabled(false) clears the combo box list as well.
Is there a way of disabling the component but re...
How do I create a docking panel in Java?
...
I'm just looking for a little guidance as to how i might implement a chat box.
There needs to be a text area for user entry, and a scrolling list of past messages. Is there an easy/standard way of going about doing this?
Thanks
...
We need to place 9 images in a 3 x 3 GridLayout for Java Swing.
We tried placing buttons into the grid, which worked fine. The images are on individual Labels.
These Labels need to be in the grid, which is not working.
Thanks in advance.
...
Hi,
I have a progress bar which inherits from JSlider to provide highlighting functionality. Highlights can be added to the slider at a point (and a Color) and these are then painted onto the control. As follows:
The problem is that I cannot get the highlights in the right place, they need to be in the same location as the markers. I...
in more easy way except the netbeans generated codes because i don't like the codes they generated.
...
I have a general question. I would like to have a window containing some buttons, radio buttons, text fields and so on. So, user can do something (write text, select options and press buttons). As the result of the user activity window should change it structure/appearance some element should disappear and some appear.
How do I program ...
I found one example in which buttons are added to panels (instances of JPanel) then panels are added to the the containers (instances generated by getContentPane) and then containers are, by the construction, included into the JFrame (the windows).
I tried two things:
I got rid of the containers. In more details, I added buttons to a...
Is there any default functionality for arranging JInternalFrames in Java Swing?
I would like to have the Cascade, Tile, etc... functionality within my Java Swing application like this: http://www.codeproject.com/KB/cs/mdiformstutorial.aspx
I could only find code where they did the arranging manually. Is there no support for this in Jav...
Using Swing in Java I wrote a form containing radio buttons, text fields and so on. In the very end I have a "Submit" button.
Now I want to "send" the information given by the user to the program. How do I do that? Is there a good tutorial about that?
Is it kind of similar to PHP? (I am asking just because I know how to do it in PHP....
Hi,
I have an application that is works fine and the JFrame for it is launched in the constructor of a GameInitializer class which takes in some config parameters. I have tried to create a GUI in which allows the user to specify these config parameters and then click submit. When the user clicks submit a new GameInitializer object is cr...
Hi,
I have a problem following from my previous problem. I also have the code SwingUtillities.invokeAndWait somewhere else in the code base, but when I remove this the gui does not refresh. If I dont remove it the error I get is:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Cannot call invokeAndWait from the event dispatcher...
I am trying to create a very simple chat window that simply has the ability to display some text, which I add to from time to time. However I get the following run time error when attempting to append text to the window:
java.lang.ClassCastException: javax.swing.JViewport cannot be cast to javax.swing.JTextPane
at ChatBox.getTextPa...
I have a method running on the EDT and within that I want to make it execute something on a new (non EDT) thread. My current code is follows:
@Override
public void actionPerformed(ActionEvent arg0) {
//gathering parameters from GUI
//below code I want to run in new Thread and then kill this thread/(close the JFrame)
new GameInitial...
I have a component where i want to display a custom jtooltip. That is easy, just change the getTooltip method. Similar for location and text.
However i also want to change the timers. The tooltip should always be displayed if the mouse is over a cellrenderer of the component. If it leaves all of those it should be turned invisible.
I k...
I want button in vertically, for that i can extend the height and shrink the width of that button. But the text of the lable of buttons are in the form of horizontal only. For that can i rotate the whole button vertically and is it possible?
...