swing

How can I identify in which Java Applet context I'm running without passing an ID?

I'm part of a team that develops a pretty big Swing Java Applet. Most of our code is legacy and there are tons of singleton references. We've bunched all of them to a single "application context" singleton. What we now need is to create some way to separate the shared context (shared across all applets currently showing) and non-shared c...

How do I make a list with checkboxes in Java Swing?

What would be the best way to have a list of items with a checkbox each in Java Swing? I.e. a JList with items that have some text and a checkbox each? ...

Java JPanel redraw issues

I have a Java swing application with a panel that contains three JComboBoxes that do not draw properly. The combox boxes just show up as the down arrow on the right side, but without the label of the currently selected value. The boxes will redraw correctly if the window is resized either bigger or smaller by even one pixel. All of my...

Problems running Swing application with IDEA 8M1

Is anyone else having trouble running Swing applications from IntelliJ IDEA 8 Milestone 1? Even the simplest application of showing an empty JFrame seems to crash the JVM. I don't get a stack trace or anything, it looks like the JVM itself crashes and Windows shows me a pop-up that says the usual "This process is no longer responding" ...

IDE for Swing

Is there any IDE that simplifies creating Swing applications (ideally something along the lines of Visual Studio) ...

Best GUI designer for eclipse?

I'm looking for a good GUI designer for swing in eclipse. My preference is for a free/open-source plugin. ...

Java Swing: Displaying images from within a Jar

When running a Java app from eclipse my ImageIcon shows up just fine. But after creating a jar the path to the image obviously gets screwed up. Is there a way to extract an image from the jar at runtime so I can then open it up? Or, is there a better way to do this? I'd like to distribute a single jar file if possible. ...

List in JScrollPane painting outside the viewport

I have a list, each item of which has several things in it, including a JProgressBar which can be updating a lot. Each time one of the items updates its JProgressBar, the ListDataListener on the list tries to scroll it the visible range using /* * This makes the updating content item automatically scroll * into view if i...

How do I restrict JFileChooser to a directory?

I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitraty directory. How should I go about doing that? ...

My (Java/Swing) MouseListener isn't listening, help me figure out why.

So I've got a JPanel implementing MouseListener and MouseMotionListener: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DisplayArea extends JPanel implements MouseListener, MouseMotionListener { public DisplayArea(Rectangle bounds, Display display) { setLayout(null); setBounds(bounds...

drawing animations at the show of JDialog

What would be the best way to draw a simple animation just before showing a modal JDialog? (i.e. expanding borders from the mouse click point to the dialog location). I thought it would be possible to draw on the glasspane of the parent frame on the setVisible method of the dialog. However since the JDialog is modal to the parent, I coul...

Why does windows XP minimize my swing full screen window on my second screen ?

Hello dear fellows, In the application I'm developping (in Java/swing), I have to show a full screen window on the second screen of the user. I did this using a code similar to the one you'll find below... Be, as soon as I click in a window opened by windows explorer, or as soon as I open windows explorer (i'm using windows XP), the ful...

How do I get InputVerifier to work with an editable JComboBox

I've got an JComboBox with a custom inputVerifyer set to limit MaxLength when it's set to editable. The verify method never seems to get called. The same verifyer gets invoked on a JTextField fine. What might I be doing wrong? Thanks. ...

Java Right Click does not make a selection. What is the easiest way to solve this globally?

Is there a way to globally make right click also select the element that you right click on? From what I understand this has been a bug in Swing for a long time likely to never be fixed because at this point applications depend on it. Any advice on doing this on a global scale? Perhaps on the L&F? ...

JComboBox Selection Change Listener?

I'm trying to get an event to fire whenever a choice is made from a JComboBox. The problem I'm having is that there is no obvious addSelectionListener method. I've tried to use actionPerformed but it never fires. Short of overriding the model for the JComboBox I'm out of ideas. How do I get notified of a selection change on a JComb...

How to implement draggable tab using Java Swing?

How do I implement a draggable tab using Java Swing? Instead of the static JTabbedPane I would like to drag-and-drop a tab to different position to rearrange the tabs. EDIT: The Java Tutorials - Drag and Drop and Data Transfer. ...

Is there an easy way to change the behavior of a Java/Swing control when it gets focus?

For most GUI's I've used, when a control that contains text gets the focus, the entire contents of the control are selected. This means if you just start typing, you completely replace the former contents. Example: You have spin control that is initialized with the value zero. You tab to it and type "1" The value in the control is n...

Best way for a Swing GUI to communicate with domain logic?

I have some domain logic implemented in a number of POJOs. I want to write a Swing user interface to allow the user to initiate and see the results of various domain actions. What's the best pattern/framework/library for communications between the UI and the domain? This boils down into: the UI being able to convert a user gesture int...

How can I detect from a Swing app that the PC is being shut-down?

Well behaved windows programs need to allow users to save their work when they are shutting the PC down. How can I make my app detect the shutdown event? Any solution should allow the user to abort the shutdown if user selects, say "Cancel". The normal Swing window closing hook doesn't work, nor does adding a shutdown hook. On testing...

Modal dialogs in IE gets hidden behind IE if user clicks on IE pane

I have to write an applet that brings up a password dialog. The problem is that dialog is set to be always on top but when user clicks on IE window dialog gets hidden behind IE window nevertheless. And since dialog is modal and holds all IE threads IE pane does not refresh and dialog window is still painted on top of IE (but not refreshe...