I have a dialog. Every time I create it and then dispose, it stays in memory.
It seems to be a memory leak somewhere, but I can't figure it out.
Do you have any ideas? See the screenshot of heap dump for more information.
Thanks in advance.
http://img441.imageshack.us/img441/5764/leak.png
...
I use outputPanel.setLayout(new BoxLayout(outputPanel, BoxLayout.Y_AXIS)); and then I add elements (for example JLabels, JButtons) to the outputPanel. For example: outputPanel.add(submitButton);.
I see that all added elements are "centered". It is good, because I do want my elements to be in the center. When I write "center" I mean "equ...
For no apparent reason all my Swing GUI forms using components linked to org.jdesktop.beansbinding.Converter started generating errors when trying to open the Design View:
Error
Error in loading component property: [JPanel]->filterTextField->converter.
Cannot load property type class org.jdesktop.beansbinding.Converter.
The property can...
I have code like that:
JPanel myPanel = new JPanel();
myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));
JButton button = new JButton("My Button");
JLabel label = new JLabel("My label!!!!!!!!!!!");
myPanel.add(button);
myPanel.add(label);
In this way I get elements with no distance between them. I m...
I've always been a little fuzzy on the difference between the glass pane and a layered pane. Is the glass pane essentially just "the very top layer of the root pane," or does it behave differently? When would you use a layered pane instead of the glass pane?
...
When creating a new project in netbeans, if i select JAVA Desktop application, it creates some code which I DO NOT RECOGNISE AT ALL as what i had learnt in swing.
It imports packages such as :
org.jdesktop.application.SingleFrameApplication;
also, the declaration for main() looks like this :
public static void main(String[] args) {
...
I have a subclass of JLabel that forms a component of my GUI. I have implemented the ability to drag and drop the component from one container to another, but without any visual effects. I want to have this JLabel follow the cursor during the drag of the item from one container to another. I figured that I could just create a glass pa...
hi!
i hav a panel and i m trying to remove labels from it which were added to it during run-time.
but when labels are removed succesfully i m not able to use the space,left by that label,again to add any label to it.
thanks in anticipation of the solution.
here is the relevant code snippet:
to add label to the panel:
JLabel jl = new...
hi,
I'm using Swing GroupLayout and I'm confused about the values GroupLayout.DEFAULT_SIZE and GroupLayout.PREFERRED_SIZE. I never know when to use each one of them in methods like GroupLayout.addComponent(Component, int, int, int).
suppose I have this code:
GroupLayout l = ...;
l.setHorizontalGroup(l.createSequentialGroup()
.add...
I have various Java Swing applications that are used by multiple users. My deployment strategy is to locate the .jar file on a network share, and users create shortcuts to that file. When the user launches an application, the file is copied to their machine and executed locally. This method allows for a single copy of the code and easy u...
My understanding is that if I start up another thread to perform some actions, I would need to SwingUtilities.invokeAndWait or SwingUtilities.invokeLater to update the GUI while I'm in said thread. Please correct me if I'm wrong.
What I'm trying to accomplish is relatively straightforward: when the user clicks submit, I want to (before ...
I'm not sure what I am doing wrong, but the text for my JPanels is not showing up. I just get the question number text, but the question is not showing up. Any ideas what I am doing wrong?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
class NewFrame extends JFrame {
JPanel centerpanel...
I'm am using JEditorPane to render basic HTML. But it renders self-closing tags incorrectly, specifically br tags, e.g. <br /> is bad but <br> is good. I would like to use String.replaceAll(regex, "<br>") to fix the HTML, where regex is a regular expression matching any self-closing br tag with case-insensitivity and zero to infinity n...
I have a set of vertically ordered elements. They are displayed with the following code:
JPanel myPanel = new JPanel();
myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));
JButton button = new JButton("My Button");
JLabel label = new JLabel("My label!!!!!!!!!!!");
myPanel.add(button);
myPanel.add(label);
I would like to put a...
With the introduction of the HTML5 <canvas> element, could Swing theoretically be implemented in Google Web Toolkit (GWT) by using the <canvas> tag for drawing?
I'm aware of efforts to port source code from using Swing calls to GWT calls, but what I'm after is a pure behind the scenes port where a Swing application would compile under G...
In my Swing app, users can click a button to open a dialog panel and enter some values, then they can click "Ok" on that panel to close it and return to the main program, but how can I pass the values they enter to the main program without saving them to a file first ?
...
I'm creating a simple labyrinth game with Java + Swing. The game draws a randomized labyrinth on the screen, places a figure in the middle, and the player is then supposed to find the way out by moving the figure with arrow-keys. As for now, I'm using a plain background and drawing the walls of the labyrinth with Graphics.drawLine(). I h...
Hi,
In my application I have a frame, with toolbar (the toolbar contains some actions).
I want the toolbar to be visible only when the window is focused.
So, I registered a windowFocusListener on the window.
The problem is-
when the window is not focused and I click on the place where a tool bar action should be- the action is performed...
Hello, everyone!
When using a JTree, a "user object" of a DefaultMutableTreeNode can be set. This can be of any kind, but to display it, its toString() value is used. This is not what I need.
How can I change the way a user object is displayed?
NOTE: My user object has to be something different than a String to be able to maintain map...
Testing UI is difficult. What do you think is the best unit testing framework for Swing?
...