swing

How to get the z order of JInternalFrames in a JDesktopPane

How would one go about getting the z order (layer depth of ) all the JInternalFrames inside a JDesktopPane. There does not seem to be a straight forward way for this. Any ideas? ...

Editing a JTable with Vectors

Hi, I'm doing a mini project using JTable. I used the Vector type for the row values. For example, public Vector textData = new Vector();. The problem is when I edit the cells in the JTable, it is editable but not keeping the changed value. That is, when I enter data in 1 cell and move on to next cell, the previous data is not updated....

How do I include JavaHelp with my Eclipse project?

I am writing some applications that require to have a Help Contents system tied to it. I came across JavaHelp which seems perfect for what I need. The issue I am having is that when you download JavaHelp, it comes with its own bin folder which looks like you are suppose to use separately. However, I am pretty sure if I just copy some of...

Java Swing Problem

I have a board with cards in which I have to find matches. I have two variables buttonA and buttonB to keep track of the squares clicked. When they are equal I can remove them from the board by simply adding this code: cards[buttonA].setVisible(false); cards[buttonB].setVisible(false); How can I place the same image on all the button...

FlexGantt TimelineObject color change

I'm using the FlexGantt Javax Swing package (http://www.dlsc.com/) to display some Gantt charts. The trouble I'm having is that I can't figure out how to change the color of a DefaultTimelineObject that I've extended into my own class. Actually, about the only colors I seem able to change are the ones that are for the background colors o...

Dynamically refresh JTextArea as processing occurs?

I am trying to create a very simple Swing UI that logs information onto the screen via a JTextArea as processing occurs in the background. When the user clicks a button, I want each call to: textArea.append(someString + "\n"); to immediately show up in the UI. At the moment, the JTextArea does not show all log information until the ...

How to notify the user of important events for a desktop application?

Our customer is using our software (Java Swing application started using Webstart) besides other software like MS Office, to do his job. From time to time there are important events he has to deal with in our software without much delay. The customer wants to have a prominent notification then. Now he might be using Excel at the moment, ...

Java Swing 1.6 to 1.5

Is it possible to port a UI developed using Swing in Java 1.6 to Java 1.5 without rewriting all again? ...

How to change the image of a JButton?

I'm working on a memory game program. I have 30 JButtons on a JPanel. When the user is clicking and finds a match (meaning two buttons with the same image) I want to change the image on the JButton to a different image. However this does not happen while the program is running. How can I do this? I was doing this: cards[i].setIcon...

Java Component.show() / hide() are deprecated ... why?

Anyone know the reason (just curious) ...

Change the Ctrl + click behaviour on a JTable

Is there an easy way to manipulate the controls on a JTable to give different functionality when there is a keyboard button pressed (ie. CTRL button) and a row is selected? I've been asked to create a table where the CTRL + Click (mouse click) on a row will only deselect a selected row, never select a row. If the user CTRL + Clicks an un...

Howto perform a MULTIPLY composite effect using Graphics2D

I have two different javax.swing.Icon objects and I want to a create new Icon which is the composite of these two. I want the composite to be a MULTIPLY effect, similair to what you would get in any photoshop-like image editing application when you choose that option. Specifically, per every pixel, if you have color Ca and Cb from image ...

Declarative validation of forms in Java/Swing

I use Java for client-side development with Swing. I love Swing; I believe it is one of the better GUI frameworks there. What I miss, however, is the support for declarative validation. Like this snippet from XForms. Do you know any library which allows validating data entry in forms in a declarative way, not by writing ugly validation ...

Java Swing custom text JEditorPane

I have a list of Objects (the model) that are constantly appended to (similar to a log file) and I'd like to display as rich text in a JEditorPane (the view). How can I glue them together? http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#document doesn't seem to give enough information to use. ...

Component in a JScrollPane stops receiving KeyEvents

I am putting a component ( derivative on JPanel ) inside a JScrollPane. scrollPane = new JScrollPane(component); since the component occasionally changes size, I have to occasionally do : SwingUtilities.invokeLater(new Runnable(){ public void run() { scrollPane.getViewport().setView(component); ...

how to focus a JFrame?

I am writing a small game, with one JFrame that holds the main game, and another JFrame that displays the score. the problem is, when I am done constructing them, the score JFrame always ends up focused! I have tried calling scoreDisplay.toFront(), scoreDisplay.requestFocus(), and even: display.setState(JFrame.ICONIZED); display.setStat...

Swing: how do I close a dialog when the ESC key is pressed ?

GUI development with Swing. I have a custom dialog for choosing a file to be opened in my application; its class extends javax.swing.JDialog and contains, among other components, a JFileChooser, which can be toggled to be shown or hidden. The JFileChooser component already handles the ESC key by itself: when the file chooser is shown (...

large virtual lists in Swing using AbstractListModel -- limit at 119,000,000 items?

I've got my "virtual list" in swing working well, but it seems to fail when I exceed some particular number of items. By "fail" I mean that the scroll bar magically vanishes when the number of items is > Nmax, and it comes back when the number of items is <= Nmax; Nmax seems to be somewhere around 119,304,000 on my system. What am I ru...

Java Robot createScreenCapture performance

I need to grab a series of screenshots and concatenate them into a movie. I'm trying to use the java Robot class to capture the screen. But the createScreenCapture() method takes more than 1 second on my machine. I can't even get 1 fps. Is there a way to speed it up? Or is there any other API? Edit: It is allocating a buffered image. ...

Why do JList selections occur twice?

I have a JList with some items. I've added a listener for when a item in the list is selected. Here is the code for what happens when an item in the list is selected: private void questionaireNamesListValueChanged(javax.swing.event.ListSelectionEvent evt) { try { inputPa...