swing

How can I get the background color of a selected element?

In Swing when using a JTree/JList/JTable selecting an item changes its background color. Is there any way to retrieve this color for the current look and feel when the component is not selected? Thank you. ...

Information icon

I would like to make use in a normal JDialog of the information icon provided by the JOptionPane.INFORMATION_MESSAGE. Is it possible? ...

Java Data binding best practices

Even if I'm not new to Java, I've only used it in school/university environment so I don't know all the best practices used in the enterprise. In particular I'm now developing a Java desktop application (using Swing at the UI Layer) and I'm particularly interested in best practices about data binding with swing components. For example ...

How to change values of panel on selecting a row in a table : jgoodies

Hi, I am using Jgoodies binding to bind the table with my data. What listener i should implement so that when a cell is selected the values in a panel are changed. My model class of table extends AbstractTableAdapter which is an Jgoodies binding class. thanks ...

Responding to key events in scala

Hi chaps, I'm experimenting with a bit of Scala gui programming (my first project in scala, so I thought I'd start with something simple). But I seem to have got stuck at something that seems like it should be relatively trivial. I have a class that extends scala.swing.MainFrame, and I'd like to detect when a user presses a key when that...

How to enable tooltip display during drag-n-drop in Java Swing.

How can I show tooltips while performing drag-n-drop. It seems that tooltip display during drag-n-drop operation is disabled or not triggered. I want to use the tooltip to indicate to the user why the drop is being denied. ...

How to ... with MigLayout

I am trying to create a layout that will looking like: +---+--------+---+ | | | | | | | | +---+ +---+ | | | | | | | | +---+--------+---+ Central cell should be twice as wide as other. I am trying achieve this with such code: val panel = new JPanel(new MigLayout("debug", "grow","g...

How to trigger Java Swing InputVerifier on enter in JComboBox (actionPerformed)?

I have a Swing JComboBox with an InputVerifier set correctly. I am using the combo box to set an integer. If I type "cat" in the field and hit tab, my InputVerifier triggers and resets the value to "0". If I type "cat" and hit enter, my InputVerifier is never called from actionPerformed. Do I need to explicitly call my InputVerifier ...

JButton action Listener

Hey there, I'm searching for a Key Listener which always activates himself when the mouse is pressed down... for example if I keep pressing the button it will always write something on the console and stops writing that when I releas the mouse button. ...

Rich swing radiobutton

Developing a desktop application based on Java + Swing I faced the problem of creating a radio button which instead of text next to it, should have and image or, say, another widget like a spinner. Clicking on the image or the spinner should select also the corresponding radioButton. Is it possible? if so, how? ...

JCheckBox to display and perform functionality in JList

I am trying to get a JCheckBox to display on a line that is in the multiple select JList and still perform its functionality. Right now if I add the JCheckBox as an element it just prints its toString format. Help/ideas? ...

How to detect Swing thread policy violations

I am looking for an automatic way to detect violations of the Swing's single threaded policy in my code. I'm looking for something along the lines of some AOP code you drop into the VM while the swing app is running and have it log any places where a swing component is modified outside of the EDT. I'm not an AOP guy but I would imagine...

Setting Java Swing application name on Mac

I'm writing a Java Swing application for the Mac using Java 1.6. I've read a number of tutorials that step you through how to better integrate your Java application with OS X, but there's one thing I haven't been able to get working. I can't get the application name (the first, bolded menu item in the Mac menu bar) to display. By defa...

Java GUI JProgressBar not painting

Hello everyone, I have a GUI problem that I would like to get sorted out, but I am baffled as to what's happening and hope one of you can explain it. The code base is way too large to upload however I will explain in detail what's happening: I have a class ProgessBar which is a JDialog containing a swing JProgressBar. I have some gett...

Java swing how to set application background dynamically.

I would like to know normally how they let a user choose the background color? For example, user chooses the background color to be red color, next time when the user runs the application again the background color will automatically become red color instead of the default color. Do they store the value in the database, so next time user...

What components should I use for building a Java WYSIWYG HTML editor

Hello all I like to build java WYSIWYG HTML to practice my or better learn Java swing all the simple swing layouts and simple components i understand , but what should i use to represent tables text place holders html graphic Div representation and so on.. they all have to have drag and drop icons that i drop to the main windows and res...

How to left or right justify a column header in a JTable

Hi All, I searched and couldn't find an answer for this. By default column headers in a JTable are centered. How do I make certain column headers left or right justified instead? TIA ...

How to replace the AWT EventQueue with own implementation

In order to debug strange behavior in a Swing-application I'd like to replace the AWT EventQueue with my own implementation. Is this possible? How? Just in case you are interested: the implementation will be a simple wrapper around the normal Eventqueue, doing some logging. the problem I'd like to debug is a TableCellEditor, which wo...

MouseEvents for a JTabbedPane Tab component are not bleeding through

I have a JTabbedPane with a custom tab component. That component contains a JLabel (To display the tab title) and a JButton (A close button). When I change the text in the JLabel the JLabel stops receiving mouse events and I can no longer select that tab when I click directly on the label instead if I click around the label then I can se...

Java GUI threads - SwingWorker

I have a question regarding SwingWorker and Java GUI's. I have several classes which process information, we can call them Foo1, Foo2, and Foo3. This processing can take a very long time. These are all subclasses of Foo, however Foo is not called directly itself (the Foo[x] classes use methods inherited from Foo. In order to keep the...